Class midcom_helper_datamanager_datatype_communityhtml

Description

The DATATYPE concept is the main interface between the data stored at a Midgard Object, the Widget that displays the Data and the Datamanger core class.

It does:

  • Load and store the data
  • Present the data in a usable way to the client (get_value)
  • Widget instantination
  • Provide a mechanism to synchronize the data with the widget class
  • Provide good configuration defaults.
This is the cornerstone of the Datamanger Design. Though the Datamanger knows how to use Widgets, the DATATYPE is the instance actually responsible for createion, configuration of and data synchronization with the widget.

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. The derived datatype TEXT is more or less exactly this class, apart from some additional defaults.

Note, that since the introduction of the create method, all datatypes must be able to be initialized without a storage object, leading in an empty value and (in turn) an empty form element. The viewport must not neccesserily be operational, but the form interface must.

Datatype configuration

The basic datatype requires at least two configuration options:

location referrs to the storage location of the data. This can be either a valid member field of the storage object (e.g. "abstract"), "parameter" or "attachment". The latter two will define the name of the parameter or attachment automatically you just tell the Type to store itself in a parameter, that's it. Note, that parameters are limited to 255 characters in length, as are many of the regular Midgard object members.

widget defines the Widget to use for displaying the content of the type. You need to specify only the actual name of the widget, not the complete class name (e.g. "text" instead of "midcom_helper_datamanager_widget_text" or something like that).

Datatypes authors are strongly encouraged to define defaults for both of these configuration parameters, so that trival configurations can be made easily. The default storage location should be either a parameter or an attachment, as this is the only way to ensure multiple definitions of the same type will work out of the box.

Located in /midcom/helper/datamanager/datatype_communityhtml.php (line 3)

midcom_helper_datamanager_datatype
   |
   --midcom_helper_datamanager_datatype_communityhtml
Variable Summary
 mixed $_colors
 mixed $_sizes
 mixed $_smileys
Method Summary
 midcom_helper_datamanager_datatype_communityhtml midcom_helper_datamanager_datatype_communityhtml (mixed &$datamanager, mixed &$storage, mixed $field)
 void get_value ()
 void _format_string (mixed $raw)
Variables
Methods
Constructor midcom_helper_datamanager_datatype_communityhtml (line 10)
midcom_helper_datamanager_datatype_communityhtml midcom_helper_datamanager_datatype_communityhtml (mixed &$datamanager, mixed &$storage, mixed $field)
get_value (line 41)
void get_value ()

Redefinition of:
midcom_helper_datamanager_datatype::get_value()
Returns the Datatype's Value.
_format_string (line 54)
void _format_string (mixed $raw)
_get_default_colors (line 110)
void _get_default_colors ()
_get_default_sizes (line 123)
void _get_default_sizes ()
_get_default_smileys (line 95)
void _get_default_smileys ()
_get_widget_default_value (line 49)
void _get_widget_default_value ()

Redefinition of:
midcom_helper_datamanager_datatype::_get_widget_default_value()
This function must return the default value to be used when creating the widget.

Inherited Methods

Inherited From midcom_helper_datamanager_datatype

 midcom_helper_datamanager_datatype::midcom_helper_datamanager_datatype()
 midcom_helper_datamanager_datatype::destroy()
 midcom_helper_datamanager_datatype::get_csv_data()
 midcom_helper_datamanager_datatype::get_value()
 midcom_helper_datamanager_datatype::get_widget()
 midcom_helper_datamanager_datatype::is_empty()
 midcom_helper_datamanager_datatype::load_from_storage()
 midcom_helper_datamanager_datatype::save_to_storage()
 midcom_helper_datamanager_datatype::sync_data_with_widget()
 midcom_helper_datamanager_datatype::sync_widget_with_data()
 midcom_helper_datamanager_datatype::validate()
 midcom_helper_datamanager_datatype::_constructor()
 midcom_helper_datamanager_datatype::_datamanager_set_storage()
 midcom_helper_datamanager_datatype::_get_default_value()
 midcom_helper_datamanager_datatype::_get_empty_value()
 midcom_helper_datamanager_datatype::_get_widget_default_value()

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