TKSnapEditor Class Reference

Base class for snap editors. More...

Inheritance diagram for TKSnapEditor:

Inheritance graph
[legend]

List of all members.

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.


Detailed Description

Base class for snap editors.

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.


Constructor & Destructor Documentation

TKSnapEditor::__construct ( version,
redirectTo = self::REDIR_ADMINTOOL,
showPreview = true 
)

Constructs new editor object.

Parameters:
$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
This method should not be overridden by derived classes.


Member Function Documentation

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

Parameters:
$oldCM [SnapContent]: latest content module associated with content in database
Returns:
[SnapContent]: content module representing updated content, or false on failure

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.

Parameters:
$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.


The documentation for this class was generated from the following file:

Generated on Wed Nov 24 02:04:33 2010 for Common by  doxygen 1.5.6