Class: I2CE Form: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 79: Line 79:
** [[Class: iHRIS_Training_Course_Competency_Evaluation | iHRIS_Training_Course_Competency_Evaluation]]
** [[Class: iHRIS_Training_Course_Competency_Evaluation | iHRIS_Training_Course_Competency_Evaluation]]
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Location: Part of the module [[I2CE Module List#forms|forms]] in the package [https://launchpad.net/i2ce I2CE]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.1-release/annotate/head:/modules/Forms/lib/I2CE_Form.php modules/Forms/lib/I2CE_Form.php]
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L36 modules/Forms/lib/I2CE_Form.php] on line 36
*Author: Luke Duncan <lduncan@intrahealth.org>
*Author: Luke Duncan <lduncan@intrahealth.org>
*Since: v1.0.0
*Since: v1.0.0
Line 87: Line 87:
===$form_name===
===$form_name===
The name of this form for the database.
The name of this form for the database.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L41 i2ce/modules/Forms/lib/I2CE_Form.php] on line 41
*Type: private [http://www.php.net/manual/en/language.types.string.php string ] $form_name
*Type: private [http://www.php.net/manual/en/language.types.string.php string ] $form_name


===$display_name===
===$display_name===
The text name of this form for display.
The text name of this form for display.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L46 i2ce/modules/Forms/lib/I2CE_Form.php] on line 46
*Type: private [http://www.php.net/manual/en/language.types.string.php string ] $display_name
*Type: private [http://www.php.net/manual/en/language.types.string.php string ] $display_name


===$fields===
===$fields===
The list of fields with all the information about each field.
The list of fields with all the information about each field.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L51 i2ce/modules/Forms/lib/I2CE_Form.php] on line 51
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $fields
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $fields


===$parent===
===$parent===
String or boolean (false) The form and id  of the parent record for this form if there is one.  Of the form "$form|$id"
String or boolean (false) The form and id  of the parent record for this form if there is one.  Of the form "$form|$id"
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L56 i2ce/modules/Forms/lib/I2CE_Form.php] on line 56
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $parent
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $parent


===$id===
===$id===
The record id for this entry.
The record id for this entry.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L61 i2ce/modules/Forms/lib/I2CE_Form.php] on line 61
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $id
*Type: protected [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $id


===$children===
===$children===
An array of children objects for this form. It is an array of arrays.  The first being an associative array with the name of the form, the second level is a simple array of the objects.
An array of children objects for this form. It is an array of arrays.  The first being an associative array with the name of the form, the second level is a simple array of the objects.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L70 i2ce/modules/Forms/lib/I2CE_Form.php] on line 70
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $children
*Type: public [http://www.php.net/manual/en/language.types.array.php array ] $children


===$attributes===
===$attributes===
A list of attributes for this form.
A list of attributes for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L75 i2ce/modules/Forms/lib/I2CE_Form.php] on line 75
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $attributes
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $attributes


===$parent_forms===
===$parent_forms===
parent_forms. The array with keys form names and values which are arrays of form names, the form names which the form's parent id can take values in
parent_forms. The array with keys form names and values which are arrays of form names, the form names which the form's parent id can take values in
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L202 i2ce/modules/Forms/lib/I2CE_Form.php] on line 202
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $parent_forms
*Type: static protected [http://www.php.net/manual/en/language.types.array.php array ] $parent_forms


Line 120: Line 128:
===__construct()===
===__construct()===
Create a new instance of a I2CE_Form object.
Create a new instance of a I2CE_Form object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L248 i2ce/modules/Forms/lib/I2CE_Form.php] on line 248
*Signature: public function __construct($form,$id)
*Signature: public function __construct($form,$id)
*Parameters:
*Parameters:
Line 127: Line 136:
===__get()===
===__get()===
Return the [[Class: I2CE_FormField | form field]] value from the [[#$fields | $fields]] array.
Return the [[Class: I2CE_FormField | form field]] value from the [[#$fields | $fields]] array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L82 i2ce/modules/Forms/lib/I2CE_Form.php] on line 82
*Signature: protected function __get($key)
*Signature: protected function __get($key)
*Parameters:
*Parameters:
Line 133: Line 143:
===__isset()===
===__isset()===
Check to see if a [[Class: I2CE_FormField | form field]] value has been set.
Check to see if a [[Class: I2CE_FormField | form field]] value has been set.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L106 i2ce/modules/Forms/lib/I2CE_Form.php] on line 106
*Signature: protected function __isset($key)
*Signature: protected function __isset($key)
*Parameters:
*Parameters:
Line 139: Line 150:
===__set()===
===__set()===
Set the [[Class: I2CE_FormField | form field]] value in the [[#$fields | $fields]] array.
Set the [[Class: I2CE_FormField | form field]] value in the [[#$fields | $fields]] array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L95 i2ce/modules/Forms/lib/I2CE_Form.php] on line 95
*Signature: protected function __set($key,$value)
*Signature: protected function __set($key,$value)
*Parameters:
*Parameters:
Line 145: Line 157:
===__unset()===
===__unset()===
Unset a [[Class: I2CE_FormField | form field]].
Unset a [[Class: I2CE_FormField | form field]].
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L118 i2ce/modules/Forms/lib/I2CE_Form.php] on line 118
*Signature: protected function __unset($key)
*Signature: protected function __unset($key)
*Parameters:
*Parameters:
Line 150: Line 163:
===addChildForm()===
===addChildForm()===
Add a child form object to this forms list of children.
Add a child form object to this forms list of children.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L683 i2ce/modules/Forms/lib/I2CE_Form.php] on line 683
*Signature: public function addChildForm($child_form,$replace)
*Signature: public function addChildForm($child_form,$replace)
*Parameters:
*Parameters:
Line 157: Line 171:
===addField()===
===addField()===
Adds a field to this form.
Adds a field to this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L426 i2ce/modules/Forms/lib/I2CE_Form.php] on line 426
*Signature: public function addField($name,$args)
*Signature: public function addField($name,$args)
*Parameters:
*Parameters:
Line 163: Line 178:
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>I2CE_FormField or false on failure
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]<br/>I2CE_FormField or false on failure
===addFormFields()===
===addFormFields()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L299 i2ce/modules/Forms/lib/I2CE_Form.php] on line 299
*Signature: protected function addFormFields($data)
*Signature: protected function addFormFields($data)
*Parameters:
*Parameters:
Line 168: Line 184:
===cleanup()===
===cleanup()===
Clean up all the fields for this form. This will unset all the fields associated with this form.  This will remove all circular references to this form so it can be cleaned up by the garbage collector. This should only be called when the form is no longer needed.  Trying to access it after this may cause unexpected results or errors.
Clean up all the fields for this form. This will unset all the fields associated with this form.  This will remove all circular references to this form so it can be cleaned up by the garbage collector. This should only be called when the form is no longer needed.  Trying to access it after this may cause unexpected results or errors.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L366 i2ce/modules/Forms/lib/I2CE_Form.php] on line 366
*Signature: public function cleanup()
*Signature: public function cleanup()
===clearFields()===
===clearFields()===
Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.
Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L734 i2ce/modules/Forms/lib/I2CE_Form.php] on line 734
*Signature: public function clearFields($fields,$keep)
*Signature: public function clearFields($fields,$keep)
*Parameters:
*Parameters:
Line 178: Line 196:
===current()===
===current()===
Return the current value for the [[#$fields | $fields]] array for iterating through the form fields.
Return the current value for the [[#$fields | $fields]] array for iterating through the form fields.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L134 i2ce/modules/Forms/lib/I2CE_Form.php] on line 134
*Signature: public function current()
*Signature: public function current()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===displayField()===
===displayField()===
Display the field in the given node.
Display the field in the given node.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L583 i2ce/modules/Forms/lib/I2CE_Form.php] on line 583
*Signature: public function displayField($node,$template,$args)
*Signature: public function displayField($node,$template,$args)
*Parameters:
*Parameters:
Line 189: Line 209:
===form()===
===form()===
Return the form name for this form.
Return the form name for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L556 i2ce/modules/Forms/lib/I2CE_Form.php] on line 556
*Signature: public function form()
*Signature: public function form()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getAllowedParentForms()===
===getAllowedParentForms()===
Gets the allowed parent forms for a given form
Gets the allowed parent forms for a given form
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L213 i2ce/modules/Forms/lib/I2CE_Form.php] on line 213
*Signature: static public function getAllowedParentForms($form,$use_cache)
*Signature: static public function getAllowedParentForms($form,$use_cache)
*Parameters:
*Parameters:
Line 201: Line 223:
===getAttribute()===
===getAttribute()===
Return the attribute value for a given attribute.
Return the attribute value for a given attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L941 i2ce/modules/Forms/lib/I2CE_Form.php] on line 941
*Signature: public function getAttribute($key)
*Signature: public function getAttribute($key)
*Parameters:
*Parameters:
Line 207: Line 230:
===getChildForms()===
===getChildForms()===
Get the registered child forms for this form.
Get the registered child forms for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L162 i2ce/modules/Forms/lib/I2CE_Form.php] on line 162
*Signature: public function getChildForms()
*Signature: public function getChildForms()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The list of child form names registered for this form.
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>The list of child form names registered for this form.
===getChildFormsByForm()===
===getChildFormsByForm()===
Get the registered child forms for the given form.
Get the registered child forms for the given form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L171 i2ce/modules/Forms/lib/I2CE_Form.php] on line 171
*Signature: static public function getChildFormsByForm($form)
*Signature: static public function getChildFormsByForm($form)
*Parameters:
*Parameters:
Line 217: Line 242:
===getChildren()===
===getChildren()===
Get the added children for this form
Get the added children for this form
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L185 i2ce/modules/Forms/lib/I2CE_Form.php] on line 185
*Signature: public function getChildren($form)
*Signature: public function getChildren($form)
*Parameters:
*Parameters:
Line 224: Line 250:
===getDisplayName()===
===getDisplayName()===
Return the display name for this form object.
Return the display name for this form object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L572 i2ce/modules/Forms/lib/I2CE_Form.php] on line 572
*Signature: public function getDisplayName()
*Signature: public function getDisplayName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getField()===
===getField()===
Return the I2CE_FormField for the given field name.
Return the I2CE_FormField for the given field name.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L704 i2ce/modules/Forms/lib/I2CE_Form.php] on line 704
*Signature: public function getField($field)
*Signature: public function getField($field)
*Parameters:
*Parameters:
Line 234: Line 262:
===getFieldNames()===
===getFieldNames()===
Get the names of all the fields added in this form
Get the names of all the fields added in this form
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L239 i2ce/modules/Forms/lib/I2CE_Form.php] on line 239
*Signature: public function getFieldNames()
*Signature: public function getFieldNames()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string, the field names.
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string, the field names.
===getFormFieldsData()===
===getFormFieldsData()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L273 i2ce/modules/Forms/lib/I2CE_Form.php] on line 273
*Signature: protected function getFormFieldsData($class,$data)
*Signature: protected function getFormFieldsData($class,$data)
*Parameters:
*Parameters:
Line 243: Line 273:
===getFormId()===
===getFormId()===
Returns the form id for this record.
Returns the form id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L387 i2ce/modules/Forms/lib/I2CE_Form.php] on line 387
*Signature: public function getFormId()
*Signature: public function getFormId()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>of the form "$form|$id"
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]<br/>of the form "$form|$id"
===getHTMLName()===
===getHTMLName()===
Return the value for the name attribute to be used for this field in a form.
Return the value for the name attribute to be used for this field in a form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L846 i2ce/modules/Forms/lib/I2CE_Form.php] on line 846
*Signature: public function getHTMLName()
*Signature: public function getHTMLName()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getId()===
===getId()===
Returns the id for this record.
Returns the id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L379 i2ce/modules/Forms/lib/I2CE_Form.php] on line 379
*Signature: public function getId()
*Signature: public function getId()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getParent()===
===getParent()===
Return the parent id for this record. If there isn't a parent record set then return the id for this record.
Return the parent id for this record. If there isn't a parent record set then return the id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L453 i2ce/modules/Forms/lib/I2CE_Form.php] on line 453
*Signature: public function getParent()
*Signature: public function getParent()
*Returns: mixed.<br/>false if there is no parent id or string  a parent id of the form "$form|$id"
*Returns: mixed.<br/>false if there is no parent id or string  a parent id of the form "$form|$id"
===getParentForm()===
===getParentForm()===
Return the name of the parent form for this record. If there isn't a parent record set then return the id for this record.
Return the name of the parent form for this record. If there isn't a parent record set then return the id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L481 i2ce/modules/Forms/lib/I2CE_Form.php] on line 481
*Signature: public function getParentForm()
*Signature: public function getParentForm()
*Returns: mixed.<br/>false if there is no parent  the parent form
*Returns: mixed.<br/>false if there is no parent  the parent form
===getParentID()===
===getParentID()===
Return the parent id for this record. If there isn't a parent record set then return the id for this record.
Return the parent id for this record. If there isn't a parent record set then return the id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L463 i2ce/modules/Forms/lib/I2CE_Form.php] on line 463
*Signature: public function getParentID()
*Signature: public function getParentID()
*Returns: mixed.<br/>false if there is no parent id or string  a parent id
*Returns: mixed.<br/>false if there is no parent id or string  a parent id
===getQueryDisplay()===
===getQueryDisplay()===
Return the values of all the fields that are set.
Return the values of all the fields that are set.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L865 i2ce/modules/Forms/lib/I2CE_Form.php] on line 865
*Signature: public function getQueryDisplay()
*Signature: public function getQueryDisplay()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getQueryFields()===
===getQueryFields()===
Return all the fields as an associative array
Return all the fields as an associative array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L853 i2ce/modules/Forms/lib/I2CE_Form.php] on line 853
*Signature: public function getQueryFields()
*Signature: public function getQueryFields()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]
===getQueryString()===
===getQueryString()===
Return all the fields as a query string to be sent to a URL
Return all the fields as a query string to be sent to a URL
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L833 i2ce/modules/Forms/lib/I2CE_Form.php] on line 833
*Signature: public function getQueryString()
*Signature: public function getQueryString()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===hasAttribute()===
===hasAttribute()===
Return true if a given attribute exists for this form.
Return true if a given attribute exists for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L954 i2ce/modules/Forms/lib/I2CE_Form.php] on line 954
*Signature: public function hasAttribute($key)
*Signature: public function hasAttribute($key)
*Parameters:
*Parameters:
Line 285: Line 325:
===hasInvalid()===
===hasInvalid()===
Checks to see if any fields of form has in invalid message
Checks to see if any fields of form has in invalid message
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L897 i2ce/modules/Forms/lib/I2CE_Form.php] on line 897
*Signature: public function hasInvalid()
*Signature: public function hasInvalid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===key()===
===key()===
Return the current key for the [[#$fields | $fields]] array for iterating through the form fields.
Return the current key for the [[#$fields | $fields]] array for iterating through the form fields.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L141 i2ce/modules/Forms/lib/I2CE_Form.php] on line 141
*Signature: public function key()
*Signature: public function key()
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
===listFields()===
===listFields()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L1012 i2ce/modules/Forms/lib/I2CE_Form.php] on line 1012
*Signature: static public function listFields($form,$fields,$where_data,$ordering,$limit)
*Signature: static public function listFields($form,$fields,$where_data,$ordering,$limit)
*Parameters:
*Parameters:
Line 305: Line 348:
===load()===
===load()===
Load the member variables from an array
Load the member variables from an array
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L803 i2ce/modules/Forms/lib/I2CE_Form.php] on line 803
*Signature: public function load($post,$loadID,$populate_on_set_id)
*Signature: public function load($post,$loadID,$populate_on_set_id)
*Parameters:
*Parameters:
Line 314: Line 358:
===lookupArray()===
===lookupArray()===
Lookup a given id in the given array.
Lookup a given id in the given array.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L914 i2ce/modules/Forms/lib/I2CE_Form.php] on line 914
*Signature: static protected function lookupArray($id,$arr)
*Signature: static protected function lookupArray($id,$arr)
*Parameters:
*Parameters:
Line 321: Line 366:
===next()===
===next()===
Advance the internal pointer for the [[#$fields | $fields]] array for iterating through the form fields.
Advance the internal pointer for the [[#$fields | $fields]] array for iterating through the form fields.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L147 i2ce/modules/Forms/lib/I2CE_Form.php] on line 147
*Signature: public function next()
*Signature: public function next()
===processDOM()===
===processDOM()===
Process the DOM for this form.
Process the DOM for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L602 i2ce/modules/Forms/lib/I2CE_Form.php] on line 602
*Signature: public function processDOM($node,$template,$method,$args)
*Signature: public function processDOM($node,$template,$method,$args)
*Parameters:
*Parameters:
Line 332: Line 379:
===removeField()===
===removeField()===
Removes a field from this form. @param array $args The arguments for this field
Removes a field from this form. @param array $args The arguments for this field
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L414 i2ce/modules/Forms/lib/I2CE_Form.php] on line 414
*Signature: public function removeField($name)
*Signature: public function removeField($name)
*Parameters:
*Parameters:
Line 337: Line 385:
===reset()===
===reset()===
Reset this object to its original state.
Reset this object to its original state.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L672 i2ce/modules/Forms/lib/I2CE_Form.php] on line 672
*Signature: public function reset()
*Signature: public function reset()
===rewind()===
===rewind()===
Rewind the internal pointer for the [[#$fields | $fields]] array for iterating through the form fields.
Rewind the internal pointer for the [[#$fields | $fields]] array for iterating through the form fields.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L127 i2ce/modules/Forms/lib/I2CE_Form.php] on line 127
*Signature: public function rewind()
*Signature: public function rewind()
===search()===
===search()===
@param mixed $limit. Defaults to false.  It true, returns only one result.  If an integer it is the numeber of records to limit to. If it is as an array of two integers, it is the offset and then number of results to limit to.
@param mixed $limit. Defaults to false.  It true, returns only one result.  If an integer it is the numeber of records to limit to. If it is as an array of two integers, it is the offset and then number of results to limit to.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L973 i2ce/modules/Forms/lib/I2CE_Form.php] on line 973
*Signature: static public function search($form,$where_data,$ordering,$limit_one)
*Signature: static public function search($form,$where_data,$ordering,$limit_one)
*Parameters:
*Parameters:
Line 355: Line 406:
===setAttribute()===
===setAttribute()===
Set an attribute for this form.
Set an attribute for this form.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L932 i2ce/modules/Forms/lib/I2CE_Form.php] on line 932
*Signature: public function setAttribute($key,$value)
*Signature: public function setAttribute($key,$value)
*Parameters:
*Parameters:
Line 361: Line 413:
===setDisplayName()===
===setDisplayName()===
Set the display name for this form object.
Set the display name for this form object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L564 i2ce/modules/Forms/lib/I2CE_Form.php] on line 564
*Signature: final public function setDisplayName($display)
*Signature: final public function setDisplayName($display)
*Parameters:
*Parameters:
Line 366: Line 419:
===setForm()===
===setForm()===
Set the form name for this form object.
Set the form name for this form object.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L548 i2ce/modules/Forms/lib/I2CE_Form.php] on line 548
*Signature: final public function setForm($name)
*Signature: final public function setForm($name)
*Parameters:
*Parameters:
Line 371: Line 425:
===setFromPost()===
===setFromPost()===
Load the member variables from an array The array can contain the keys 'id', 'parent', 'fields'.  The later of which is an array indexed by field names and which contains the values of the field
Load the member variables from an array The array can contain the keys 'id', 'parent', 'fields'.  The later of which is an array indexed by field names and which contains the values of the field
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L755 i2ce/modules/Forms/lib/I2CE_Form.php] on line 755
*Signature: public function setFromPost($post,$populate_on_set_id)
*Signature: public function setFromPost($post,$populate_on_set_id)
*Parameters:
*Parameters:
Line 378: Line 433:
===setId()===
===setId()===
Set the id for this record.
Set the id for this record.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L396 i2ce/modules/Forms/lib/I2CE_Form.php] on line 396
*Signature: public function setId($id)
*Signature: public function setId($id)
*Parameters:
*Parameters:
Line 383: Line 439:
===setParent()===
===setParent()===
Set the parent id for this record
Set the parent id for this record
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L497 i2ce/modules/Forms/lib/I2CE_Form.php] on line 497
*Signature: public function setParent($parent,$set_id)
*Signature: public function setParent($parent,$set_id)
*Parameters:
*Parameters:
Line 390: Line 447:
===valid()===
===valid()===
Check to see if the current internal pointer for the [[#$fields | $fields]] array is valid.
Check to see if the current internal pointer for the [[#$fields | $fields]] array is valid.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L154 i2ce/modules/Forms/lib/I2CE_Form.php] on line 154
*Signature: public function valid()
*Signature: public function valid()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===validate()===
===validate()===
Validate all fields that are marked as required or unique. This will check all the fields in this form and if they're required or unique it will perform the required checks
Validate all fields that are marked as required or unique. This will check all the fields in this form and if they're required or unique it will perform the required checks
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.2-release/annotate/head:/modules/Forms/lib/I2CE_Form.php#L886 i2ce/modules/Forms/lib/I2CE_Form.php] on line 886
*Signature: public function validate()
*Signature: public function validate()
==Inherited Methods==
==Inherited Methods==

Revision as of 08:49, 10 November 2009

This article describes the class I2CE_Form.

Abstract class for objects using the class that interact with a database and HTML form. This class has a few default functions that are used when interacting with the template engine in setting up form values and displaying the data for objects that tie directly to database tables.

Variables

$form_name

The name of this form for the database.

$display_name

The text name of this form for display.

$fields

The list of fields with all the information about each field.

$parent

String or boolean (false) The form and id of the parent record for this form if there is one. Of the form "$form|$id"

$id

The record id for this entry.

$children

An array of children objects for this form. It is an array of arrays. The first being an associative array with the name of the form, the second level is a simple array of the objects.

$attributes

A list of attributes for this form.

$parent_forms

parent_forms. The array with keys form names and values which are arrays of form names, the form names which the form's parent id can take values in

Methods

__construct()

Create a new instance of a I2CE_Form object.

__get()

Return the form field value from the $fields array.

__isset()

Check to see if a form field value has been set.

__set()

Set the form field value in the $fields array.

__unset()

Unset a form field.

addChildForm()

Add a child form object to this forms list of children.

addField()

Adds a field to this form.

addFormFields()

cleanup()

Clean up all the fields for this form. This will unset all the fields associated with this form. This will remove all circular references to this form so it can be cleaned up by the garbage collector. This should only be called when the form is no longer needed. Trying to access it after this may cause unexpected results or errors.

clearFields()

Remove fields from the form. This is to be used when only certain fields of the form are being dealt with so the others can be removed to save processing.

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 734
  • Signature: public function clearFields($fields,$keep)
  • Parameters:
    • array $fields
      The fields being worked with.
    • boolean $keep
      A flag to determine if the given fields should be removed or all except the given fields.
      • Default Value: true

current()

Return the current value for the $fields array for iterating through the form fields.

displayField()

Display the field in the given node.

form()

Return the form name for this form.

getAllowedParentForms()

Gets the allowed parent forms for a given form

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 213
  • Signature: static public function getAllowedParentForms($form,$use_cache)
  • Parameters:
    • string $form
    • boolean $use_cache
      Defaults to true in which case we cached result of finding parent forms
      • Default Value: true
  • Returns: array
    of string, the form names.

getAttribute()

Return the attribute value for a given attribute.

getChildForms()

Get the registered child forms for this form.

getChildFormsByForm()

Get the registered child forms for the given form.

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 171
  • Signature: static public function getChildFormsByForm($form)
  • Parameters:
    • string $form
      The form to get the children of.
  • Returns: array
    The list of child form names registered for the form.

getChildren()

Get the added children for this form

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 185
  • Signature: public function getChildren($form)
  • Parameters:
    • string $form
      Defaults to null, in which case we get all children. otherwise we get the popoluated children with the specified form
      • Default Value: null
  • Returns: array
    If $form is null, it is an array with keys the form names and values array of the children of that form type. If $form is set, then it is an array of the forms of type $form

getDisplayName()

Return the display name for this form object.

getField()

Return the I2CE_FormField for the given field name.

getFieldNames()

Get the names of all the fields added in this form

getFormFieldsData()

getFormId()

Returns the form id for this record.

getHTMLName()

Return the value for the name attribute to be used for this field in a form.

getId()

Returns the id for this record.

getParent()

Return the parent id for this record. If there isn't a parent record set then return the id for this record.

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 453
  • Signature: public function getParent()
  • Returns: mixed.
    false if there is no parent id or string a parent id of the form "$form|$id"

getParentForm()

Return the name of the parent form for this record. If there isn't a parent record set then return the id for this record.

getParentID()

Return the parent id for this record. If there isn't a parent record set then return the id for this record.

getQueryDisplay()

Return the values of all the fields that are set.

getQueryFields()

Return all the fields as an associative array

getQueryString()

Return all the fields as a query string to be sent to a URL

hasAttribute()

Return true if a given attribute exists for this form.

hasInvalid()

Checks to see if any fields of form has in invalid message

key()

Return the current key for the $fields array for iterating through the form fields.

listFields()

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 1012
  • Signature: static public function listFields($form,$fields,$where_data,$ordering,$limit)
  • Parameters:
    • string $form
      The form name
    • array $fields
      of string. The fields we want returned
    • mixed $where_data
      Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested
      • Default Value: array()
    • array $ordering
      An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order.
      • Default Value: array()
    • mixed $limit
      Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. If it is as an array of two integers, it is the offset and then number of results to limit to.
      • Default Value: false
  • Returns: mixed
    an array with key id's and value and array of values. the array of values has as keys the fields with their corresponding value.

load()

Load the member variables from an array

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 803
  • Signature: public function load($post,$loadID,$populate_on_set_id)
  • Parameters:
    • array $post
      The Post vairables. Usually from an http request.
    • boolean $loadID
      Defaults to true. If true, and there is exactly one of entry in the array $post['forms'][$this->form_name], we set the values of the form's field, id and parent from that entry. If false, we set the values from $post['forms'][$this->form_name][$this->getID()] if it is present
      • Default Value: true
    • $populate_on_set_id
      • Default Value: true

lookupArray()

Lookup a given id in the given array.

next()

Advance the internal pointer for the $fields array for iterating through the form fields.

processDOM()

Process the DOM for this form.

removeField()

Removes a field from this form. @param array $args The arguments for this field

reset()

Reset this object to its original state.

rewind()

Rewind the internal pointer for the $fields array for iterating through the form fields.

search()

@param mixed $limit. Defaults to false. It true, returns only one result. If an integer it is the numeber of records to limit to. If it is as an array of two integers, it is the offset and then number of results to limit to.

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 973
  • Signature: static public function search($form,$where_data,$ordering,$limit_one)
  • Parameters:
    • string $form
      The form name.
    • mixed $where_data
      Either I2CE_MagicDataNode or array. contains the where clause information about this form or a nested
      • Default Value: array()
    • array $ordering
      An array of fields to order by. Defaults to the empty array. Prepend a - to order by in descending order.
      • Default Value: array()
    • $limit_one
      • Default Value: false
  • Returns: mixed
    an array of matching form ids. However, ff $limit_one is true or 1 or array ($offset,1) then then we return either the id or false, if none found or there was an error.

setAttribute()

Set an attribute for this form.

setDisplayName()

Set the display name for this form object.

setForm()

Set the form name for this form object.

setFromPost()

Load the member variables from an array The array can contain the keys 'id', 'parent', 'fields'. The later of which is an array indexed by field names and which contains the values of the field

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 755
  • Signature: public function setFromPost($post,$populate_on_set_id)
  • Parameters:
    • array $post
      The post object is passed as a reference
    • $populate_on_set_id
      • Default Value: false

setId()

Set the id for this record.

setParent()

Set the parent id for this record

  • Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 497
  • Signature: public function setParent($parent,$set_id)
  • Parameters:
    • mixed $parent
      string or I2CE_Form
    • boolean $set_id
      If the parent will only have one child object then you can set the id by setting this to true.
      • Default Value: false

valid()

Check to see if the current internal pointer for the $fields array is valid.

validate()

Validate all fields that are marked as required or unique. This will check all the fields in this form and if they're required or unique it will perform the required checks

Inherited Methods

_hasMethod()

This public method is inherited from I2CE_Fuzzy->_hasMethod()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

isNumeric()

This method is implemented by I2CE_Module_CustomReports->isNumeric()

getLimitStyles()

This method is implemented by I2CE_Module_FormLimits->getLimitStyles()

checkLimit()

This method is implemented by I2CE_Module_FormLimits->checkLimit()

checkWhereClause()

This method is implemented by I2CE_Module_FormLimits->checkWhereClause()

createCheckFunction()

This method is implemented by I2CE_Module_FormLimits->createCheckFunction()

createCheckLimitString()

This method is implemented by I2CE_Module_FormLimits->createCheckLimitString()

generateLimit()

This method is implemented by I2CE_Module_FormLimits->generateLimit()

generateWhereClause()

This method is implemented by I2CE_Module_FormLimits->generateWhereClause()

processLimit()

This method is implemented by I2CE_Module_FormLimits->processLimit()

getDisplayedExistingLimit()

This method is implemented by I2CE_Module_FormLimits->getDisplayedExistingLimit()

isComponentized()

This method is implemented by I2CE_FormStorage->isComponentizedForm()

addChild()

This method is implemented by I2CE_FormStorage->addChild()

getChildIds()

This method is implemented by I2CE_FormStorage->getChildIds()

getStorage()

This method is implemented by I2CE_FormStorage->getStorage()

isWritable()

This method is implemented by I2CE_FormStorage->isWritable()

populate()

This method is implemented by I2CE_FormStorage->populate()

populateChild()

This method is implemented by I2CE_FormStorage->populateChild()

populateChildren()

This method is implemented by I2CE_FormStorage->populateChildren()

populateFirst()

This method is implemented by I2CE_FormStorage->populateFirst()

populateHistory()

This method is implemented by I2CE_FormStorage->populateHistory()

populateLast()

This method is implemented by I2CE_FormStorage->populateLast()

delete()

This method is implemented by I2CE_FormStorage->delete()

save()

This method is implemented by I2CE_FormStorage->save()

setChangeType()

This method is implemented by I2CE_FormStorage->setChangeType()