Abstract Class midcom_helper_datamanager_widget

Description

The widget concept is the interface to the user.

It displays both a simple view of the stored data within the AIS and the form elements required to modify this data. It also handles the interaction between the forms and the PHP-representation of the data.

A important point is that this is a base class for a class hierarchy of datatypes. To make creating child classes a littlebit easier and less error_prone, the classes constructor has been moved to the method _constructor, which can be overwritten by clients. The advantage of this is that you can just call parent:: on this and don't need to remeber the name of the parent class to call its constructor. As PHP automatically uses the parent classes constructor if non is defined, it is enough to define the _constructor method in the subclasses.

See also this PHP Manual Note:

If you have a complex class hierarchy, I find that it's a good idea to have a function constructor() in every class, and the 'real' php constructor only exists in the absolute base class. From the basic constructor, you call $this->constructor(). Now descendants simply have to call parent::constructor() in their own constructor, which eliminates complicated parent calls.

The default behavoir implemented in this class is sufficiant for data with a text-representation. It does not, however, implement the draw* methods.

  • abstract: Widget base class

Located in /midcom/helper/datamanager/widget.php (line 47)


	
			
Direct descendents
Class Description
 class midcom_helper_datamanager_widget_account This is a simple widget for the account datatype, it queries username, password and password verification.
 class midcom_helper_datamanager_widget_blob This is a widget to handle binary attachments.
 class midcom_helper_datamanager_widget_checkbox This is a widget for simple boolean fields.
 class midcom_helper_datamanager_widget_collection This is a widget to handle a variable-length collection of other types.
 class midcom_helper_datamanager_widget_communityhtml This is a widget to handle the simple "communityhtml" type, which is a very simplified form of bbcode.
 class midcom_helper_datamanager_widget_date This is a widget to show a JS driven date selector.
 class midcom_helper_datamanager_widget_html This is a WYSIWYG HTML widget, built on HTMLArea.
 class midcom_helper_datamanager_widget_image This is a widget to handle image attachments.
 class midcom_helper_datamanager_widget_mailtemplate This is a widget that manages E-Mail templates.
 class midcom_helper_datamanager_widget_multiselect This is a widget to handle image variable-height multi-selection lists.
 class midcom_helper_datamanager_widget_radiobox This is a widget to handle radio-box style select lists.
 class midcom_helper_datamanager_widget_select This is a widget to handle image variable-height select lists.
 class midcom_helper_datamanager_widget_text This is a flexible text widget, that allows for input of plain text in several forms. Supported widgets are:
Abstract class midcom_helper_datamanager_widget_tinymce This is a WYSIWYG HTML widget that uses the powerful TinyMCE editor
Variable Summary
 bool $required
 Array $_field
 string $_fieldname
 midcom_helper_services__i18n_l10n $_l10n
 midcom_helper_services__i18n_l10n $_l10n_midcom
 mixed $_value
Method Summary
 midcom_helper_datamanager_widget midcom_helper_datamanager_widget (midcom_helper_datamanager &$datamanager, Array $field, mixed $defaultvalue)
 void draw_helptext ()
 void draw_view ()
 void draw_widget ()
 void draw_widget_end ()
 mixed get_value ()
 void set_value (mixed $value)
 void _constructor (midcom_helper_datamanager &$datamanager, Array $field, mixed $defaultvalue)
 void _read_formdata ()
Variables
bool $missingrequired (line 121)

This flag is true if the field is a required input field which was missing in the last submit run. The rendering code should take this into account accordingly. This is used by the draw_widget_start method.

bool $required (line 111)

This flag is true if the field is a required input field. The rendering code should take this into account accordingly. This is used by the draw_widget_start method.

midcom_helper_datamanager $_datamanager (line 63)

A reference to our Datamanager.

  • access: protected
Array $_field (line 55)

A copy of the field definition we use.

  • access: protected
string $_fieldname (line 76)

The name we should use for HTML Form elements, can also be used as prefix.

This consists of the Datamanager's form prefix, the string "field_" completed with the name of the field. For ease of use it is also passed through htmlspecialchars automatically.

  • access: protected
midcom_helper_services__i18n_l10n $_l10n (line 93)

midcom.helper.datamanager L10n database reference.

  • access: protected
midcom_helper_services__i18n_l10n $_l10n_midcom (line 101)

MidCOM core L10n database reference.

  • access: protected
mixed $_value (line 85)

Our actual value as initialized by the datatype and (if applicable) extracted from the HTTP POST information.

  • access: protected
Methods
Constructor midcom_helper_datamanager_widget (line 134)

Constructor

This base-class constructor is used throughout the hierarchy and just relays the constructor call to _construct. See there.

midcom_helper_datamanager_widget midcom_helper_datamanager_widget (midcom_helper_datamanager &$datamanager, Array $field, mixed $defaultvalue)
  • midcom_helper_datamanager $datamanager: The datamanager this type is assigned to.
  • Array $field: The field definition to construct a datatype from.
  • mixed $defaultvalue: The value to initialize the snippet with (used if no HTTP POST is available).
draw_helptext (line 307)

Helper function that renders the helptext if applicable. This is usually appended directly after the label.

void draw_helptext ()
draw_widget (line 239)

This method draws the HTML-Form widgets required to edit the data. This can be anything from a single form tag to a full list of them. Note, that you will be automatically enclosed within the calls to draw_widget_start and draw_widget_end.

You must override this member.

void draw_widget ()

Redefined in descendants as:
draw_widget_end (line 296)

This is the default widget "introduction" code rendered before the actual field code. It will close the <label> tag.

void draw_widget_end ()

Redefined in descendants as:
draw_widget_start (line 275)

This is the default widget "introduction" code rendered before the actual field code. It will open a <label> tag and display the heading.

void draw_widget_start ()

Redefined in descendants as:
get_css_classes_required (line 253)

Evaluates the required and missingrequired field states and

returns an according list of CSS classes when one or both of these variables is set. Required fields are reported as 'required', while missing required fields are 'required missing'. If none of these values is set, an empty string is returned.

  • return: The CSS classes indicating the required state.
string get_css_classes_required ()

Redefined in descendants as:
get_value (line 197)

Return the widget's value.

You should override this if the _value representation of the widget does not match the one returned to the type.

  • return: Value of the widget.
mixed get_value ()

Redefined in descendants as:
set_value (line 210)

Set the value of the widget.

You should override this if the _value representation of the widget does not match the one returned to the type.

void set_value (mixed $value)
  • mixed $value: The new value to set.

Redefined in descendants as:
_constructor (line 156)

The constructor populates the internal members with a reference to the datamanger we belong to, the definition of the field we use and the default value we should use to initialize the widget's data.

After doing this, it will call _read_formdata to catch any changes submitted by the user, see there for details.

Override this method if you need a custom class construction.

  • access: protected
void _constructor (midcom_helper_datamanager &$datamanager, Array $field, mixed $defaultvalue)
  • midcom_helper_datamanager $datamanager: The datamanager this type is assigned to.
  • Array $field: The field definition to construct a datatype from.
  • mixed $defaultvalue: The value to initialize the snippet with (used if no HTTP POST is available).

Redefined in descendants as:
_read_formdata (line 181)

Reads the HTTP POST request data if available.

It checks the $_REQUEST array wether there is anything related to our widget. If yes, it will be read and stored in the widget.

You should override this only if you cannot use the Request data directly, as the default bevavoir is to copy it to the _value member.

  • access: protected
void _read_formdata ()

Redefined in descendants as:

Documentation generated on Mon, 21 Nov 2005 18:24:31 +0100 by phpDocumentor 1.3.0RC3