Class: I2CE Form (Development)
This article describes the class I2CE_Form .
- Extends the class: I2CE_Fuzzy.
- Implements the interface Iterator
- Child Classes:
- I2CE_List
- iHRIS_Contact
- iHRIS_Currency
- iHRIS_Country
- I2CE_SimpleList
- iHRIS_Job
- iHRIS_Position
- iHRIS_Cadre
- iHRIS_TrainingProgram
- iHRIS_Competency
- iHRIS_Scheduled_Training_Course
- iHRIS_Training_Course
- iHRIS_ContinuingEducationCourse
- iHRIS_ListByCountry
- iHRIS_County
- iHRIS_District
- iHRIS_Region
- I2CE_Form_Locale
- iHRIS_Degree
- I2CE_Role
- iHRIS_Classification
- iHRIS_SalaryGrade
- iHRIS_Department
- iHRIS_Certificate
- iHRIS_DisciplinaryActionReason
- iHRIS_TrainingDisruptionReason
- iHRIS_ISCO_08_Major
- iHRIS_ISCO_08_Sub_Major
- iHRIS_ISCO_88_Major
- iHRIS_ISCO_88_Sub_Major
- iHRIS_ISCO_88_Minor
- iHRIS_ISCO_88_Unit
- iHRIS_Training_Course_Evaluation
- iHRIS_Person
- iHRIS_UUID_Map
- I2CE_User_Form
- iHRIS_Applicant
- iHRIS_Benefit
- iHRIS_PersonPosition
- iHRIS_DisciplinaryAction
- iHRIS_Exam
- iHRIS_License
- iHRIS_PrivatePractice
- iHRIS_Registration
- iHRIS_Training
- iHRIS_TrainingDisrupt
- iHRIS_ContinuingEducation
- iHRIS_Document
- iHRIS_Demographic
- iHRIS_Education
- iHRIS_Employment
- iHRIS_PersonID
- iHRIS_PersonLanguage
- iHRIS_Notes
- iHRIS_Photo
- I2CE_GeneratedDoc
- iHRIS_RecordVerify
- iHRIS_Accident
- iHRIS_PositionInterview
- iHRIS_PositionDecision
- iHRIS_Salary
- iHRIS_Deployment
- iHRIS_SecondaryEducation
- iHRIS_FacilityInstitution
- iHRIS_FacilityInstitutionEditFacility
- iHRIS_FacilityInstitutionEditInstitution
- iHRIS_InstitutionInspection
- iHRIS_OutMigration
- iHRIS_PersonCompetency
- iHRIS_Person_Scheduled_Training_Course
- iHRIS_Training_Course_Competency_Evaluation
- I2CE_List
- Location: Part of the module forms in the package I2CE 4.0-dev
- Source: Defined in the file modules/Forms/lib/I2CE_Form.php on line 36
- Author: Luke Duncan <lduncan@intrahealth.org>
- Since: v1.0.0
- See: I2CE_Template
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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 41
- Type: private string $form_name
$display_name
The text name of this form for display.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 46
- Type: private string $display_name
$fields
The list of fields with all the information about each field.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 51
- Type: protected array $fields
$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"
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 56
- Type: protected mixed $parent
$id
The record id for this entry.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 61
- Type: protected mixed $id
$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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 70
- Type: public array $children
$attributes
A list of attributes for this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 75
- Type: protected array $attributes
$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
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 202
- Type: static protected array $parent_forms
Methods
__construct()
Create a new instance of a I2CE_Form object.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 248
- Signature: public function __construct($form,$id)
- Parameters:
- string $form
The name of this form - integer $id
- Default Value: '0'
- string $form
__get()
Return the form field value from the $fields array.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 82
- Signature: public function __get($key)
- Parameters:
- string $key
- Returns: mixed
__isset()
Check to see if a form field value has been set.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 106
- Signature: public function __isset($key)
- Parameters:
- string $key
- Returns: boolean
__set()
Set the form field value in the $fields array.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 95
- Signature: public function __set($key,$value)
- Parameters:
__unset()
Unset a form field.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 118
- Signature: public function __unset($key)
- Parameters:
- string $key
addChildForm()
Add a child form object to this forms list of children.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 649
- Signature: public function addChildForm($child_form,$replace)
- Parameters:
addField()
Adds a field to this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 392
- Signature: public function addField($name,$args)
- Parameters:
- Returns: mixed
I2CE_FormField or false on failure
addFormFields()
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 299
- Signature: protected function addFormFields($data)
- Parameters:
- $data
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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 332
- Signature: public function cleanup()
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 700
- Signature: public function clearFields($fields,$keep)
- Parameters:
current()
Return the current value for the $fields array for iterating through the form fields.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 134
- Signature: public function current()
- Returns: mixed
displayField()
Display the field in the given node.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 549
- Signature: public function displayField($node,$template,$args)
- Parameters:
- DOMNode $node
- I2CE_Template $template
- array $args
form()
Return the form name for this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 522
- Signature: public function form()
- Returns: string
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:
- Returns: array
of string, the form names.
getAttribute()
Return the attribute value for a given attribute.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 907
- Signature: public function getAttribute($key)
- Parameters:
- string $key
- Returns: mixed
getChildForms()
Get the registered child forms for this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 162
- Signature: public function getChildForms()
- Returns: array
The list of child form names registered 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.
- string $form
- 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
- string $form
- 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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 538
- Signature: public function getDisplayName()
- Returns: string
getField()
Return the I2CE_FormField for the given field name.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 670
- Signature: public function getField($field)
- Parameters:
- string $field
the field name or a form name:field name
- string $field
- Returns: I2CE_FormField
getFieldNames()
Get the names of all the fields added in this form
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 239
- Signature: public function getFieldNames()
- Returns: array
of string, the field names.
getFormFieldsData()
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 273
- Signature: protected function getFormFieldsData($class,$data)
- Parameters:
- $class
- &$data
getFormId()
Returns the form id for this record.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 353
- Signature: public function getFormId()
- Returns: string
of the form "$form|$id"
getHTMLName()
Return the value for the name attribute to be used for this field in a form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 812
- Signature: public function getHTMLName()
- Returns: string
getId()
Returns the id for this record.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 345
- Signature: public function getId()
- Returns: string
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 419
- 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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 447
- Signature: public function getParentForm()
- Returns: mixed.
false if there is no parent the parent form
getParentID()
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 429
- Signature: public function getParentID()
- Returns: mixed.
false if there is no parent id or string a parent id
getQueryDisplay()
Return the values of all the fields that are set.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 831
- Signature: public function getQueryDisplay()
- Returns: string
getQueryFields()
Return all the fields as an associative array
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 819
- Signature: public function getQueryFields()
- Returns: array
getQueryString()
Return all the fields as a query string to be sent to a URL
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 799
- Signature: public function getQueryString()
- Returns: string
hasAttribute()
Return true if a given attribute exists for this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 920
- Signature: public function hasAttribute($key)
- Parameters:
- string $key
- Returns: boolean;
hasInvalid()
Checks to see if any fields of form has in invalid message
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 863
- Signature: public function hasInvalid()
- Returns: boolean
key()
Return the current key for the $fields array for iterating through the form fields.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 141
- Signature: public function key()
- Returns: mixed
listFields()
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 978
- 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
- string $form
- 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 769
- 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
- array $post
lookupArray()
Lookup a given id in the given array.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 880
- Signature: static protected function lookupArray($id,$arr)
- Parameters:
- integer $id
The id to lookup. - array $arr
The array to search through.
- integer $id
- Returns: string
next()
Advance the internal pointer for the $fields array for iterating through the form fields.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 147
- Signature: public function next()
processDOM()
Process the DOM for this form.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 568
- Signature: public function processDOM($node,$template,$method,$args)
- Parameters:
- DOMNode $node
- I2CE_Template $template
- string $method
- array $args
removeField()
Removes a field from this form. @param array $args The arguments for this field
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 380
- Signature: public function removeField($name)
- Parameters:
- string $name
reset()
Reset this object to its original state.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 638
- Signature: public function reset()
rewind()
Rewind the internal pointer for the $fields array for iterating through the form fields.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 127
- Signature: public function rewind()
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 939
- 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
- string $form
- 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.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 898
- Signature: public function setAttribute($key,$value)
- Parameters:
setDisplayName()
Set the display name for this form object.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 530
- Signature: final public function setDisplayName($display)
- Parameters:
- string $display
setForm()
Set the form name for this form object.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 514
- Signature: final public function setForm($name)
- Parameters:
- string $name
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 721
- 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
- array $post
setId()
Set the id for this record.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 362
- Signature: public function setId($id)
- Parameters:
- mixed $id
setParent()
Set the parent id for this record
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 463
- Signature: public function setParent($parent,$set_id)
- Parameters:
valid()
Check to see if the current internal pointer for the $fields array is valid.
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 154
- Signature: public function valid()
- Returns: boolean
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
- Defined in i2ce/modules/Forms/lib/I2CE_Form.php on line 852
- Signature: public function validate()
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()