![]() |
Framework
3.9
|
Field renderer for handling one-to-many relationships that are implemented through a back-reference table. More...
Public Member Functions | |
__construct (&$form, $field, $label, $relatedClass, $constraint, $nameField) | |
setSize ($width, $height) | |
groupBy ($groupBy, $format="") | |
getMatchingPK ($relatedClass, $obj) | |
Find the field in the DataItem obj displayed in the AutoForm that exists in the back-reference class e.g., if ProductCategory AutoForm's obj, and products are the option items displayed, then product_category_id would exist in the Product table. More... | |
renderField ($field="") | |
FieldRenderers must override this method to provide the HTML implementation of the control used to edit the field. More... | |
getRelatedItems () | |
getSelected ($obj, $itempk, $pk) | |
renderCheckboxes ($field, $items, $pk, $selected) | |
renderReadOnly ($field="") | |
postProcess ($field="") | |
FieldRenderers can override this method to provide behavior that occurs after the parent form's target object has been saved to the database. More... | |
![]() | |
FieldRenderer ($parent) | |
Constructor. More... | |
_printLabel ($field, $colspan=1, $styles="", $annotation="") | |
Internal method to generate the HTML for the field label. More... | |
_getLabel ($field, $addSuffix=true) | |
_startField ($field, $styles="") | |
Internal method to generate the starting HTML for the field (including the label) More... | |
_endField ($field) | |
Internal method to generate the closing HTML for the field. More... | |
addValidatorsToForm ($field, $required=false) | |
This method is called by the AutoForm to add any default input validators that are required by the FieldRenderer. More... | |
addSearchValidatorsToForm ($field, $mode, $required=false) | |
For SearchForm, the validator field needs to match the name tag in the form which is in the format field:mode. More... | |
formatName ($item, $name) | |
Formats the given DataItem based on the supplied format string. More... | |
renderScript ($field) | |
FieldRenderers can override this method to provide any Javascript that their control requires for an edit form. More... | |
renderSearchScript ($field, $mode) | |
FieldRenderers can override this method to provide any Javascript that the control requires when being used in a search form. More... | |
renderSearchField ($field, $mode) | |
FieldRenderers must override this method to provide the HTML implementation of the control displayed for the field in a search form. More... | |
renderOnSubmitHandler ($field) | |
FieldRenderers can override this method to provide any Javascript that must be executed when the form is submitted on the client. More... | |
preProcess ($field="") | |
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the parent form's target object to the database. More... | |
Public Attributes | |
$relatedClass | |
$constraint | |
$nameField | |
$field | |
$label | |
$options | |
$groupBy | |
![]() | |
$parent = null | |
$labelSuffix = "" | |
$colspan = 1 | |
$annotateBefore = false | |
$annotateNextLine = true | |
$hideLabel = false | |
$onPreProcess = null | |
callback hook for processing prior to saving the form's data object - individual renderers may override with custom processing More... | |
$onPostProcess = null | |
callback hook for processing after saving the form's data object - individual renderers may override with custom processing More... | |
Field renderer for handling one-to-many relationships that are implemented through a back-reference table.
The postProcess() method is used to automatically update the table records when the form is submitted.
e.g., AutoForm renders instance of ProductCategory containing a RelatedItemCheckListFieldRenderer additional field "products" to select the products that belong to the category. Selections are saved to the product table's field product_category_id.
Definition at line 51 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::__construct | ( | & | $form, |
$field, | |||
$label, | |||
$relatedClass, | |||
$constraint, | |||
$nameField | |||
) |
Definition at line 61 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::getMatchingPK | ( | $relatedClass, | |
$obj | |||
) |
Find the field in the DataItem obj displayed in the AutoForm that exists in the back-reference class e.g., if ProductCategory AutoForm's obj, and products are the option items displayed, then product_category_id would exist in the Product table.
unknown | $relatedClass | |
unknown | $obj |
DataItemException |
Definition at line 106 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::getRelatedItems | ( | ) |
Definition at line 182 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::getSelected | ( | $obj, | |
$itempk, | |||
$pk | |||
) |
obj | $obj | DataItem class in AutoForm |
String | $itempk | back-reference key of the related class |
String | $pk | - primary key of the back-reference related table |
Definition at line 194 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::groupBy | ( | $groupBy, | |
$format = "" |
|||
) |
Definition at line 89 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::postProcess | ( | $field = "" | ) |
FieldRenderers can override this method to provide behavior that occurs after the parent form's target object has been saved to the database.
For example, the CrossReferenceSelectFieldRenderer overrides this method to update crossference tables based on the user's selection.
string | $field |
Save each checked item to the back-reference related table
Remove the link from the back-reference related table to the form's data obj if no longer selected.
Reimplemented from FieldRenderer.
Definition at line 242 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::renderCheckboxes | ( | $field, | |
$items, | |||
$pk, | |||
$selected | |||
) |
Definition at line 201 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::renderField | ( | $field = "" | ) |
FieldRenderers must override this method to provide the HTML implementation of the control used to edit the field.
string | $field | the field name |
Reimplemented from FieldRenderer.
Definition at line 117 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::renderReadOnly | ( | $field = "" | ) |
Definition at line 219 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::setSize | ( | $width, | |
$height | |||
) |
Definition at line 83 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$constraint |
Definition at line 54 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$field |
Definition at line 56 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$groupBy |
Definition at line 59 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$label |
Definition at line 57 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$nameField |
Definition at line 55 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$options |
Definition at line 58 of file related_item_checklist_field_renderer.inc.
RelatedItemCheckListFieldRenderer::$relatedClass |
Definition at line 53 of file related_item_checklist_field_renderer.inc.