Public Member Functions | |
__construct ($version, $redirectTo=self::REDIR_ADMINTOOL, $showPreview=true) | |
Constructs new editor object. | |
Protected Member Functions | |
processSave ($oldCM) | |
Processes user input from editor. | |
showEditor ($cm, $failed) | |
Displays editor for content. |
This class is a toolkit component which can be easily embedded in a page. This base class implements most of the functionality for the editors. The derived classes need only provide a method for building an input form and for processing user input.
TKSnapEditor::__construct | ( | $ | version, | |
$ | redirectTo = self::REDIR_ADMINTOOL , |
|||
$ | showPreview = true | |||
) |
Constructs new editor object.
$version | [SnapVersion]: version object that we are editing | |
$redirectTo | [string]: URL to redirect to when exiting the editor | |
$showPreview | [boolean]: whether to include a TKSnapPreview in the editor |
TKSnapEditor::processSave | ( | $ | oldCM | ) | [abstract, protected] |
Processes user input from editor.
This method should gather user input from the submitted form, process it and create a new content module based on that input. If that fails, false should be returned. Otherwise, return the new content module. The current content module is provided as the $oldCM parameter, if some values from it are needed
$oldCM | [SnapContent]: latest content module associated with content in database |
Reimplemented in TKSnapCssEditor, TKSnapHtmlEditor, TKSnapInteractivateInstructorEditor, TKSnapInteractivateLessonEditor, TKSnapLessonPlanEditor, TKSnapMediaAgentsheetsEditor, TKSnapMediaDocumentEditor, TKSnapMediaFileEditor, TKSnapMediaImageEditor, TKSnapMediaInteractivateEditor, TKSnapMediaNetlogoEditor, and TKSnapXmlEditor.
TKSnapEditor::showEditor | ( | $ | cm, | |
$ | failed | |||
) | [abstract, protected] |
Displays editor for content.
The $cm passed in is the content module representing the current content in the version and it should be used, if possible or need be, to pre-fill form fields when editing an existing version. If $failed is true, then that means the last save action failed. In this case, it would be useful to prefill the form with what the user had just entered. However, this may not make sense in all cases. This method should not return anything. Rather, any form that is created should be add()ed to $this, since $this is a toolkit container.
$cm | [SnapContent]: content module from version representing latest stored content | |
$failed | [boolean]: whether the editor is being displayed again because the last save attempt failed (due to bad input or some other error) |
Reimplemented in TKSnapCssEditor, TKSnapHtmlEditor, TKSnapInteractivateInstructorEditor, TKSnapInteractivateLessonEditor, TKSnapLessonPlanEditor, TKSnapMediaAgentsheetsEditor, TKSnapMediaDocumentEditor, TKSnapMediaFileEditor, TKSnapMediaImageEditor, TKSnapMediaInteractivateEditor, TKSnapMediaNetlogoEditor, and TKSnapXmlEditor.