Generic Create-Read-Update-Delete handler baseclass

package midcom.baseclasses

 Methods

_get_object_url (\midcom_core_dbaobject $object)

Method for getting URL to an object.

Note: This implementation uses MidCOM's permalink resolution service for generating the link, which is slow. Overriding this with a local implementation is recommended.

Parameters

$object

\midcom_core_dbaobjectThe object in question

Returns

stringURL to the current object

_get_url_prefix ()

Helper function to convert the user's prefix (if any) into a URL prefix

Returns

stringURL prefix to the current object

_handler_callback (mixed $handler_id, array $args, array $data)

Helper function to extend the baseclass handlers

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_handler_create (mixed $handler_id, array $args, array $data)

Generates an object creation view.

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_handler_delete (mixed $handler_id, array $args, array $data)

Displays an object delete confirmation view.

Note, that the object for non-index mode operation is automatically determined in the can_handle phase.

If create privileges apply, we relocate to the index creation object

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_handler_read (mixed $handler_id, array $args, array $data)

Generates an object view.

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_handler_update (mixed $handler_id, array $args, array $data)

Generates an object update view.

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_index_object (\$dm $dm)

Method for adding or updating an object to the MidCOM indexer service.
todo implement this properly now it's just a stub

Parameters

$dm

\$dmDatamanager2 instance containing the object

_load_controller (string $type)

Internal helper, loads the controller for the current object.

Any error triggers a 500.

Parameters

$type

stringController to instantiate (typically 'simple' or 'ajax')

_load_datamanager ()

Internal helper, loads the datamanager for the current object.

Any error triggers a 500.

_load_defaults ()

Loads default values for the creation controller.

_load_object (mixed $handler_id, array $args, array $data)

Method for loading an object, must be implemented in the component handler.

The method will generate an error if the object could not be found.

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_load_parent (mixed $handler_id, array $args, array $data)

Method for loading parent object for an object that is to be created, must be implemented in the component handler.

The method will generate an error if the object could not be found.

Parameters

$handler_id

mixedThe ID of the handler.

$args

arrayThe argument list.

$data

array&$data The local request data.

_load_schemadb ()

Loads and prepares the schema database.

The operations are done on all available schemas within the DB.

_on_initialize ()

Maps the content topic from the request data to local member variables.

Also makes sure that DM2 is loaded

_populate_toolbar (mixed $handler_id)

Method for adding the supported operations into the toolbar.

Parameters

$handler_id

mixedThe ID of the handler.

_prepare_request_data ()

Simple helper which references all important members to the request data listing for usage within the style listing.

_select_schema (array $args)

Selects the schema name based on arguments.

Parameters

$args

arrayURL arguments

_show_create (mixed $handler_id, array $data)

Shows the object creation form.

Parameters

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_show_delete (mixed $handler_id, array $data)

Shows a delete dialog with an object preview.

Parameters

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_show_read (mixed $handler_id, array $data)

Shows the loaded object.

Parameters

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_show_update (mixed $handler_id, array $data)

Shows the loaded object in editor.

Parameters

$handler_id

mixedThe ID of the handler.

$data

array&$data The local request data.

_update_breadcrumb (mixed $handler_id)

Method for updating breadcrumb for current object and handler, must be implemented in the component handler.

Parameters

$handler_id

mixedThe ID of the handler.

_update_title (mixed $handler_id)

Method for updating title for current object and handler, should be implemented in the component handler for better performance.

Parameters

$handler_id

mixedThe ID of the handler.

dm2_create_callback ($controller)

DM2 creation callback.

Parameters

$controller

DM2 creation controller

_get_style_prefix ()

Helper function to convert the user's prefix (if any) into a style name prefix

Returns

stringstylename prefix

 Properties

 

\midcom_db_topic $_content_topic

The content topic to use
 

\midcom_helper_datamanager2_controller_simple $_controller

The Datamanager2 controller of the object used for editing
 

\midcom_helper_datamanager2_datamanager $_datamanager

Datamanager2 to be used for displaying an object used for delete preview
 

string $_dba_class

The DBA class to use
 

array $_defaults

Default values to be given to creation controller.
 

string $_mode

The mode (Create, Read, Update, Delete) we're in
 

mixed $_object

The object to operate on
 

mixed $_parent

The parent of an object to be created
 

string $_prefix

The prefix to use for style element names and URLs, if any
 

string $_schema

The schema name to use when creating new objects
 

array $_schemadb

The schema database in use, available only while a datamanager is loaded.