Datamanager 2 Data Manager AJAX controller class.

This is an AJAX-enabled controller class intended for usage directly with a storage backend. It has no creation support whatsoever, but the multi-edit loop will work without problems. The form will only be synchronized with the datamanager if validation succeeds. (Naturally, types operating directly on blobs / parameters are exempt of this.)

You need to set both datamanager and (thus) schema database before initializing.

package midcom.helper.datamanager2

 Methods

get_content_html ()

Get contents of the form in AJAX-editable format

Returns

ArrayAll field values in their HTML representation indexed by their name.

initialize (string $identifier)

AJAX controller initialization.

Loads required Javascript libraries and connects to the parent class initialization.

Parameters

$identifier

stringThe form identifier

Returns

booleanIndicating success.

process_ajax ($exit)

This function wraps AJAX processing completely.

If component wishes to do post-processing after an edit, save or preview state in this call it must set the exit parameter to false. view state simply returns processing to component.

The return values in this processor are:

  • view: user can only view the content, no AJAX functionality available
  • ajax_editable: the content is editable via AJAX, highlight
  • ajax_edit: User is currently editing the contents via AJAX
  • ajax_save: Content has been saved via AJAX
  • ajax_preview: User is currently previewing contents via AJAX

If required, we will here create a form manager instance and save or preview contents

Parameters

$exit

process_form ()

This function wraps the form manager processing.

If processing is successful, (that is, only 'save'). If editing was successful, the form is frozen in case you want to display it again (usually you want to redirect to the view target).

There are several possible return values:

  • save and the variants next and previous (for wizard usage) suggest successful form processing. The form has already been validated, synchronized with and saved to the data source.
  • cancel the user cancelled the form processing, no I/O has been done.
  • edit, previous, next indicates that the form is not yet successfully completed. This can mean many things, including validation errors, which the renderer already outlines in the Form output. No I/O processing has been done.

The form will be automatically validated for 'save' and 'next', but not for 'previous'. If you want to have save the data for example even during 'next', you need to call datamanager->save after this function returned the according return code.

Normally, all validation should be done during the Form processing, but sometimes this is not possible. These are the cases where type validation rules fail instead of form validation ones. At this time, the integration of type validation is rudimentary and will transparently return edit instead of validation.

todo Integrate type validation checks cleanly.

Returns

stringOne of 'save', 'cancel', 'next', 'previous', 'edit', depending on the schema configuration.

_generate_editor_config ()

_is_ajax_editable ()

Is the object AJAX editable

Returns

booleanFalse if the object isn't AJAX editable

 Properties

 

mixed $_editable

 

mixed $allow_removal

 

mixed $form_identifier

 

mixed $wide_mode

 

mixed $window_mode