Framework  3.9
SubordinateAutoForm Class Reference
+ Inheritance diagram for SubordinateAutoForm:
+ Collaboration diagram for SubordinateAutoForm:

Public Member Functions

 SubordinateAutoForm ($parent, $form, $allowEmpty=false)
 
 createForm ()
 
 getValidationEngine ()
 Retrieve the validation engine for this AutoForm. More...
 
 getData ()
 Returns the target data item for the form. More...
 
 setDataSet ($params)
 
 writeScript ()
 This method writes any Javascript code that will be required for the generated form to operate, including code for Rich Text Editors, Date Pickers and field validation. More...
 
 drawForm ()
 Renders the form to HTML. More...
 
 drawReadOnly ()
 Draws the form in read-only mode. More...
 
 makeSubordinate ()
 Set this AutoForm to be a subordinate form within a CompositeAutoForm. More...
 
 save ()
 Saves the posted values to the database. More...
 
 isEmpty ()
 
- Public Member Functions inherited from AutoForm
 AutoForm ($target, $method="POST", $action="", $id="")
 Creates a new AutoForm, based on the supplied target DataItem. More...
 
 setLayout ($layout)
 Override the default layout manager. More...
 
 setFieldOrder ()
 Override the display order for ungrouped field. More...
 
 createRenderer ($field)
 This factory method creates a FieldRender based on the type of the specified field. More...
 
 addDefaultValidators ()
 Creates default validators for fields in the form. More...
 
 configureValidators ()
 
 getRenderer ($field)
 Retrieves the FieldRenderer object for the specified field. More...
 
 override ($field, $label="", $renderer=null)
 Overrides the defaults for the specifed form field, providing a new label and/or FieldRenderer. More...
 
 overrideType ($field, $type, $label="")
 Override the default type for the specified form field, providing a FieldRenderer based on the supplied type (and optionally also override the field label) More...
 
 add ($renderer, $field="", $label="")
 Adds an additional (pseudo) field to the form. More...
 
 hide ()
 Call this method to hide one or more fields in the form's user interface. More...
 
 hideExcept ()
 Call this method to hide all the fields in the form's user interface EXCEPT the fields specified. More...
 
 isHidden ($field)
 Check whether the specified field is hidden in the form. More...
 
 annotate ($field, $text)
 Adds an annotation (such as brief explanatory text) to the specified field. More...
 
 alias ()
 Use this method to override the display name for fields in the form. More...
 
 related ($class, $constraint="", $format=null, $field=null, $label=null, $allowAdd=false, $allowNone=true)
 Utility function to add a RelatedItemSelectFieldRender. More...
 
 crossReference ($xrefClass, $options, $format, $field, $label=null, $xrefField=null)
 Utility function to add a CrossReferenceSelectFieldRenderer. More...
 
 dropdown ($field, $label="", $options=null, $onchange=null, $grouped=false)
 Utility function to add a SelectFieldRenderer. More...
 
 groupedDropdown ($field, $label, $options, $onchange=null)
 Utility function to add a SelectFieldRenderer with grouped options. More...
 
 radio ($field, $label, $options, $onchange=null)
 Utility function to add a RadioButtonFieldRenderer. More...
 
 checklist ($field, $label, $options, $grouped=false)
 Utility function to add a CheckListFieldRenderer. More...
 
 toggle ($field, $label="", $ragged=false)
 Utility function to create a ToggleFieldRenderer. More...
 
 group ($name)
 Define a field grouping. More...
 
 addToGroup ($name)
 Add more fields to the specified group. More...
 
 groupDescription ($name, $description, $position='start')
 Add a description block to a group. More...
 
 getGroupDescription ($name, $position='start')
 Retrieves the group description for the specified group. More...
 
 makeGroupCollapsible ($name, $toggleControl)
 Allows a group to be shown or hidden based on the value of another control. More...
 
 setGroupCSSClass ($name, $cssClass)
 Sets a specific CSS class on the specified CSS group. More...
 
 getGroupCSSClass ($name)
 Gets the CSS class for the specified group, if one has been set. More...
 
 removeGroup ($name)
 Remove the specified field grouping from the form. More...
 
 hideLabel ()
 Use this method to hide the labels for the specified fields in the form. More...
 
 readonly ()
 Call this method to make one or more fields read-only in the form's user interface. More...
 
 isReadOnly ($field)
 Determine whether the specified field is being displayed read-only. More...
 
 required ()
 Call this method to mark one or more fields as being required fields. More...
 
 hasAdditional ($field)
 Check if this field exists as an additional field. More...
 
 isRequired ($field)
 Determine whether the specified field is a required field for the form. More...
 
 requiredIfChecked ($field, $checkbox, $fieldTitle="", $checkboxTitle="", $message="")
 Make a field required if a given checkbox is checked. More...
 
 requiredSubSelect ($field, $fieldTitle, $subFieldTitle="", $message="")
 Make a subselect field required. More...
 
 regexp ($field, $expr, $message)
 Validate the user input for the specified field against a regular expression, outputting the supplied message if the entered value does not match. More...
 
 dateRange ($field, $min="", $max="", $message=null)
 
 unique ()
 Adds a uniqueness validator to the specified field(s). More...
 
 uniqueWithConstraint ($field, $message, $constraint="")
 
 range ($field, $min, $max, $message=null)
 Adds a range validator to the specified field. More...
 
 match ($field, $title, $match, $matchTitle, $caseSensitive=true)
 Specifies that two field values must match (as in a password/confirmation pair, for instance). More...
 
 password ($field, $title)
 Adds a password validator to the specified field. More...
 
 disableAutoComplete ()
 Disable autocomplete for the selected fields. More...
 
 button ($text, $url, $confirm=null, $isScript=false, $cssClass=null)
 Adds a custom button to the form. More...
 
 ajaxSubmit ($success, $failure=null)
 Put the form into AJAX submission mode. More...
 
 partialSaveButton ($containerID, $label="Save")
 Activate partial saves for this form. More...
 
 matchesSubmitted ()
 Determine if this form is the one that was submitted. More...
 
 drawSubmitButtons ($obj, $pk, $submitLabel)
 
 renderAllFields ($obj)
 
 renderFields ($obj)
 
 renderOneField ($field, $renderScript=false)
 
 renderAdditionalFields ($obj)
 
 drawButtons ()
 Draws any additional buttons specified in the calling script. More...
 
 prettifyFieldName ($field)
 Generates a human-readable label from the given field name. More...
 
 load ($id)
 Loads the underlying DataItem from the database, using the specified primary key value. More...
 
 handlePartialSave ($success)
 
 preProcessFields ($pk, $filter)
 
 postProcessFields ($pk, $filter)
 
 remove (&$obj)
 
 validate ()
 Validate the posted values for the form. More...
 
 patchUpReferences ()
 

Public Attributes

 $id
 
 $form
 
 $parent
 
 $msg
 
 $allowEmpty
 
- Public Attributes inherited from AutoForm
 $formCSS = ""
 CSS Class to use for the table containing the form. More...
 
 $labelCSS = ""
 CSS Class to use for label cells. More...
 
 $valueCSS = ""
 CSS Class to use for field/value cells. More...
 
 $buttonCSS = ""
 CSS Class to use for buttons. More...
 
 $buttonLineCSS = "submit"
 CSS Class to use for the button line (container for form buttons) More...
 
 $inputCSS = ""
 CSS Class to use for input fields. More...
 
 $checkboxCSS = ""
 CSS Class to use for checkbox fields. More...
 
 $style = ""
 
 $componentPath ="/fakoli"
 
 $buttonAlignment = "left"
 Default Form button alignment. More...
 
 $passwordEncryptor = ""
 Password Encryption method name. More...
 
 $hideButtons = false
 Set to true to hide form submission button line(s) More...
 
 $capitalizationMode = "word"
 Capitalization to be used for labels. Can be 'lower', 'upper', 'first' or 'word'. More...
 
 $submitLabel = ""
 Text to display on the form's submit button. If not specified defaut text will be generated based on the target DataItem. More...
 
 $allowDelete = false
 If true, the form will display a delete button if editing an existing item. More...
 
 $deleteLabel = ""
 Text to display on the form's delete button. If not specified defaut text will be generated based on the target DataItem. More...
 
 $deleteMessage = ""
 Confirmation message to display when the form's delete button is pressed. If not specified defaut text will be generated based on the target DataItem. More...
 
 $method = "POST"
 HTTP method that will be used to submit the form. More...
 
 $action = ""
 Action URL for submitting the form. Generally this can be left blank to submit back to the same page. More...
 
 $renderers = array()
 The field renderers collection. More...
 
 $overrides = array()
 The field overrides collection. More...
 
 $hidden = array()
 The hidden fields collection. More...
 
 $additional = array()
 The additional (pseudo) fields collection. More...
 
 $additional_at_top = false
 whether additional fields are rendered above the datamodel's field list; if false, then rendered below More...
 
 $readonly = array()
 The read-only fields collection. More...
 
 $annotations = array()
 The field annotations collection. More...
 
 $buttons = array()
 The custom buttons collection. More...
 
 $fieldOrder = array()
 The order in which to display ungrouped fields. More...
 
 $validator
 The ValidationEngine for this form. More...
 
 $useLinkSubmit = false
 Flag to indicate whether the submit button for the form should be rendered as a link (not common). More...
 
 $HTMLEditorHideStyleBar = false
 Flag to indicate that Rich Text Editors should be displayed with or without the style editing toolbar. More...
 
 $HTMLEditorDefaultWidth = "540px"
 Default width for Rich Text Editor controls. More...
 
 $HTMLEditorDefaultHeight = "200px"
 Default height for Rich Text Editor controls. More...
 
 $passwordEnterLabel = "Enter"
 Text for Password Enter label. More...
 
 $passwordConfirmLabel = "Confirm"
 Text for Password Confirm label. More...
 
 $onDrawStart = null
 Callback event handler that is fired just prior to drawing the form. More...
 
 $onDrawComplete = null
 Callback event handler that is fired just after the form been drawn. More...
 
 $onInsertPreProcess = null
 Callback event handler that is fired after fields have been preprocessed, but before the data has been saved to the database as a new record. More...
 
 $onSavePreProcess = null
 Callback event handler that is fired after fields have been preprocessed, but before the data has been saved to the database. More...
 
 $onSaveComplete = null
 Callback event handler that is fired after the AutoForm has finished saving data to the database. More...
 
 $confirmPrompt = null
 Specify a confirmation message. This will be shown to the user to have them confirm the form submission after the submit button is pressed. More...
 
 $onDelete = ""
 delete method name More...
 
 $customSaveHandler = null
 Use this field to override the default save behavior of your form. More...
 
 $markRequiredFields = false
 Set to true to add an asterisk after required field labels. More...
 
 $onFormatLabel = null
 Label Processing hook. More...
 
 $buttons_at_top = false
 
 $ajaxSubmitHandler = false
 JavaScript Callback for AJAX Submit mode - called on success. More...
 
 $ajaxFailureHandler = false
 JavaScript Callback for AJAX Submit mode - called on failure. More...
 
 $onSubmitHandler = null
 Javascript Callback for user-defined onsubmit hook. More...
 
 $required = array()
 List of required fields. More...
 
 $requiredFieldsText = "* indicates required field"
 Text prompt to display when a form contains required fields. More...
 
 $interstitialMessage = null
 Specifies the message to display in an interstitial while the form is being submitted. More...
 
 $interstitialSpinner = '/fakoli/images/loader.gif'
 Set this property to override the default interstitial spinner animation. More...
 
 $fields
 Local field cache. More...
 
 $groups = array()
 List of field groups. More...
 
 $collapsibleGroups = array()
 List of collapsible groups and their default states. More...
 
 $groupDescriptions = array()
 List of group descriptions. More...
 
 $groupDescriptionCSS = "group_description"
 CSS class for group description blocks. More...
 
 $groupCSSClasses = array()
 Additional classes for specific groups. More...
 
 $readOnlyForm
 Specifies whether the entire form is read-only. More...
 
 $subordinate
 Specifies whether this form is a subordinate member of a composite form. More...
 
 $hideEmptyFields = false
 Specifies whether to hide empty fields when displaying a read-only form. More...
 
 $showAnnotations = true
 Set to false to hide field annotations. More...
 
 $layout
 Layout handler object. More...
 
 $default_layout = "table"
 
 $allowPartialSave = false
 Whether to allow partial (i.e. in-progress) saves via AJAX. More...
 
 $partialSaveContainerID
 DOM ID for the element that will contain the partial save button. More...
 
 $partialSaveLabel = "Save"
 Label text for the partial save button. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from AutoForm
static registerFieldRendererClass ($type, $rendererClass)
 Registers a custom type-to-renderer mapping. More...
 
- Static Public Attributes inherited from AutoForm
static $fieldRendererMap
 Provides the mapping from Type identifier to FieldRenderer. More...
 

Detailed Description

Definition at line 344 of file composite_auto_form.inc.

Member Function Documentation

◆ createForm()

SubordinateAutoForm::createForm ( )

Definition at line 368 of file composite_auto_form.inc.

369  {
370  $this->form = new AutoForm($this->obj, "POST", "", $this->id);
371 
372  // set hidden fields, aliases, special renderers etc.
373  $this->parent->addForm($this);
374  }
AutoForm($target, $method="POST", $action="", $id="")
Creates a new AutoForm, based on the supplied target DataItem.
Definition: auto_form.inc:166

◆ drawForm()

SubordinateAutoForm::drawForm ( )

Renders the form to HTML.

Reimplemented from AutoForm.

Definition at line 399 of file composite_auto_form.inc.

400  {
401  $this->form->drawForm();
402  }

◆ drawReadOnly()

SubordinateAutoForm::drawReadOnly ( )

Draws the form in read-only mode.

This is most often used to display the details for a DataItem on a preview or details screen.

Reimplemented from AutoForm.

Definition at line 404 of file composite_auto_form.inc.

405  {
406  $this->form->drawReadOnly();
407  }

◆ getData()

SubordinateAutoForm::getData ( )

Returns the target data item for the form.

Reimplemented from AutoForm.

Definition at line 384 of file composite_auto_form.inc.

385  {
386  return $this->form->getData();
387  }

◆ getValidationEngine()

SubordinateAutoForm::getValidationEngine ( )

Retrieve the validation engine for this AutoForm.

Reimplemented from AutoForm.

Definition at line 379 of file composite_auto_form.inc.

380  {
381  return $this->form->validator;
382  }

◆ isEmpty()

SubordinateAutoForm::isEmpty ( )

Definition at line 441 of file composite_auto_form.inc.

442  {
443  $empty = true;
444  $obj =& $this->form->getData();
445  $pk = $obj->getPrimaryKey();
446 
447  $fields = $obj->getFields();
448  $filter = $obj->getFilter();
449 
450  foreach($fields as $field => $type)
451  {
452  if ($field != $pk && !array_key_exists($field, $this->form->hidden) && !($filter && $filter->isExcluded($field)) && !array_key_exists($field, $this->parent->presetFields))
453  {
454  $value = $obj->$field;
455  if($value)
456  {
457  $empty = false;
458  break;
459  }
460  }
461  }
462  return $empty;
463  }
$fields
Local field cache.
Definition: auto_form.inc:111

◆ makeSubordinate()

SubordinateAutoForm::makeSubordinate ( )

Set this AutoForm to be a subordinate form within a CompositeAutoForm.

Reimplemented from AutoForm.

Definition at line 409 of file composite_auto_form.inc.

410  {
411  $this->form->makeSubordinate();
412  }

◆ save()

SubordinateAutoForm::save ( )

Saves the posted values to the database.

Returns
boolean - true if the save was successful.

Reimplemented from AutoForm.

Definition at line 419 of file composite_auto_form.inc.

420  {
421  $rtn = $this->form->save();
422 
423  if($rtn == false && $this->allowEmpty && $this->isEmpty())
424  {
425  $rtn = true;
426  }
427  else
428  $this->msg = $this->form->msg;
429 
430  return $rtn;
431  }

◆ setDataSet()

SubordinateAutoForm::setDataSet (   $params)

Reimplemented from AutoForm.

Definition at line 389 of file composite_auto_form.inc.

390  {
391  $this->form->setDataSet($params);
392  }

◆ SubordinateAutoForm()

SubordinateAutoForm::SubordinateAutoForm (   $parent,
  $form,
  $allowEmpty = false 
)

Definition at line 352 of file composite_auto_form.inc.

353  {
354  $this->parent = $parent;
355  $this->form = $form;
356  $this->id = $form->id;
357  $this->allowEmpty = $allowEmpty;
358 
359  $this->parent->addForm($this);
360  }

◆ writeScript()

SubordinateAutoForm::writeScript ( )

This method writes any Javascript code that will be required for the generated form to operate, including code for Rich Text Editors, Date Pickers and field validation.

Returns
string the script required for the generated form.

Reimplemented from AutoForm.

Definition at line 394 of file composite_auto_form.inc.

395  {
396  return $this->form->writeScript();
397  }

Member Data Documentation

◆ $allowEmpty

SubordinateAutoForm::$allowEmpty

Definition at line 350 of file composite_auto_form.inc.

◆ $form

SubordinateAutoForm::$form

Definition at line 347 of file composite_auto_form.inc.

◆ $id

SubordinateAutoForm::$id

Definition at line 346 of file composite_auto_form.inc.

◆ $msg

SubordinateAutoForm::$msg

Definition at line 349 of file composite_auto_form.inc.

◆ $parent

SubordinateAutoForm::$parent

Definition at line 348 of file composite_auto_form.inc.


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