Class: I2CE List (4.0.12)
This article describes the abstract class I2CE_List .
- Extends the class: I2CE_Form.
- Child Classes:
- iHRIS_Contact
- iHRIS_Country
- I2CE_SimpleList
- I2CE_User_Form
- iHRIS_Position
- iHRIS_Cadre
- iHRIS_Scheduled_Training_Course
- iHRIS_Training_Course
- iHRIS_ContinuingEducationCourse
- iHRIS_Currency
- iHRIS_ListByCountry
- iHRIS_County
- iHRIS_District
- iHRIS_Region
- I2CE_Form_Locale
- iHRIS_Degree
- I2CE_ArchivedReport
- I2CE_Role
- iHRIS_EstablishmentPeriod
- iHRIS_Establishment
- iHRIS_Classification
- iHRIS_SalaryGrade
- iHRIS_Job
- iHRIS_Department
- iHRIS_ConfirmationType
- iHRIS_Certificate
- iHRIS_DisciplinaryActionReason
- iHRIS_TrainingDisruptionReason
- iHRIS_TrainingProgram
- iHRIS_ISCO_08_Major
- iHRIS_ISCO_08_Sub_Major
- iHRIS_ISCO_08_Minor
- iHRIS_ISCO_08_Unit
- iHRIS_ISCO_88_Major
- iHRIS_ISCO_88_Sub_Major
- iHRIS_ISCO_88_Minor
- iHRIS_ISCO_88_Unit
- iHRIS_Competency
- iHRIS_Training_Course_Evaluation
- Location: Part of the module Lists in the package I2CE 4.0.12-release
- Source: Defined in the file modules/Forms/modules/Lists/lib/I2CE_List.php on line 38
- Author: Luke Duncan <lduncan@intrahealth.org>
- Since: v1.0.0
Base object for dealing with lists of data. This is an abstract object with base code for many of the I2CE_Form interface methods. It is used for many of the list database objects such as AcademicLevel and District . It assumes all lists have a code field and by default a description field but this can be overwritten by certain objects like Cadre . @abstract
Form Fields
This class is a form class and provides the following form fields
The form field i2ce_hidden is implemented by YESNO
Variables
$mapped_fields_by_form
of array index by names of lists of arrays where keys are form names, values are arrays with keys field names and values field objects
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 44
- Type: static protected array $mapped_fields_by_form
$cache
An array to cache lookup entries Any lookups done to the database will be cached in this static array so additional lookups using the same id won't have to access the database. @static
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 103
- Type: static protected array $cache
Methods
_findLowerMatches()
Internal method to find all the ids for forms that are below the given matched form id. This will go through the list of fields until the form that is being matched is found. @param string $match The form id to match at the top.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 901
- Signature: static protected function _findLowerMatches($match_form,$match_ids,$fields,$forms,$displayed,$show_hidden)
- Parameters:
- Returns: array
_flattenDataTree()
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 875
- Signature: static protected function _flattenDataTree($data,$list)
- Parameters:
- $data
- &$list
_getDisplayFields()
Worker function to get the display fields
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 194
- Signature: protected function _getDisplayFields($style)
- Parameters:
- string $style
Defaults to 'default'- Default Value: 'default'
- string $style
- Returns: array
of string
_getDisplayString()
worker method to get the display string
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 203
- Signature: protected function _getDisplayString($style)
- Parameters:
- string $style
Defaults to 'default'- Default Value: 'default'
- string $style
- Returns: string
_getSortFields()
Worker function to get the display fields
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 278
- Signature: protected function _getSortFields($style)
- Parameters:
- string $style
Defaults to 'default'- Default Value: 'default'
- string $style
- Returns: array
of string
_monsterMash()
Gets the id's for a form that live at @param string $use_display value. Defaults to true in which case the displayed fields are returned based on the display value. If false, then the displa
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 464
- Signature: static protected function _monsterMash($options,$form_name,$opt_field,$opt_form,$opt_id,$sub_fields,$show_hidden)
- Parameters:
- array &$options
Where the id's are saved. Array with keys the ids of $form_name. For values, if $use_dislpay_value is true, then the displayed fields for $form_name that corresponds to that value. - string $form_name
- stirng $opt_field
The field we are limiting $form_name on. - stirng $opt_form
The form we wish to look that $opt_field takes values in - string $opt_id
The id wish to look that $opt_field takes values. e.g. we are looking for all instances of $form_name where $opt_field is $opt_form|$opt_id - artary $sub_fields
Example array(county+district,district+region,[region]) - boolean $show_hidden
Show the hidden members of the list, defaults to false.- Default Value: false
- array &$options
_searchLowerMatches()
Internal method to search all the ids for forms that are below the given matched form id. @param string $match The form id to match at the top.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 928
- Signature: static protected function _searchLowerMatches($match_form,$match_ids,$fields,$forms,$displayed,$show_hidden)
- Parameters:
- Returns: array
addCache()
Adds the id number to the cache . @param integer $code The code of the entry to add.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 655
- Signature: static final protected function addCache($table_name,$id,$value)
- Parameters:
buildDataTree()
Create a data tree of the selectable forms. Deisgned to be fed into tree select
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 691
- Signature: static public function buildDataTree($fields,$forms,$limits,$orders,$show_hidden)
- Parameters:
- array $fields
an ordered array E.g array('village+county','county','district,'region+country','country'). it is an "bottom up" array of string where strings are of the form "$form" or "$form+$link_field". In the case of the former type, then $link_field is assumed to be the next form. So for example, "county" has link field "district". If a "$form(+$link_field)" is surrounded by brackets [ ] , it is not displayed. - array $forms
An unorderd array of form names whose values we allow to be selected - array $limits
An array with keys form names and value limit data - array $orders
An array with keys form names and values array of field orders for that form. If the form name has no orders, we use default ordering for that form based on its displayed firelds- Default Value: array()
- boolean $show_hidden
Show the hidden members of the list, defaults to false.- Default Value: false
- array $fields
componentizeQuery()
returns the posible componentization of a form|id
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 114
- Signature: static public function componentizeQuery($qry,$forms,$component)
- Parameters:
- Returns: string.
They query need to turn $qry into one componentized to $component.
findLowerMatches()
For the list of displayed fields for a field, find all the ids for forms that are below the given matched form id. For example if a location has the displayed fields of: array( 'county', 'district', '[region]', 'country' ) with selectable fields: array( 'county', 'district' ) if you want to match the district: district|10 this method will return all the county ids that are in district|10. This will also return 'district|10' in the list to have a complete list of valid selectable forms.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 978
- Signature: static public function findLowerMatches($match,$fields,$forms,$show_hidden)
- Parameters:
- Returns: array
flattenDataTree()
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 868
- Signature: static public function flattenDataTree($data)
- Parameters:
- $data
getCache()
Return the cache cached entry for the id number. @param integer $code The code of the entry to lookup.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 668
- Signature: static final protected function getCache($table_name,$id)
- Parameters:
- string $table_name
The name of the table in the database. - $id
- string $table_name
- Returns: string
The value of the cached code.
getDisplayFields()
Returns a list of fields used for displaying this list.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 237
- Signature: static public function getDisplayFields($form_name,$style)
- Parameters:
- Returns: array
getDisplayString()
Returns display string used for displaying this list.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 215
- Signature: static public function getDisplayString($form_name,$style)
- Parameters:
- Returns: string
getFieldsMappingToList()
Get all fields mapping to the given list type
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 50
- Signature: static public function getFieldsMappingToList($list)
- Parameters:
- mixed $list
Either a string a list name or isntance of {I2CE_List}
- mixed $list
- Returns: array
keys are form names, values are arrays with keys field names and values field objects
getHTMLTemplate()
Return the HTML file name for the form template for this form.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 133
- Signature: public function getHTMLTemplate()
- Returns: string
getListType()
Return the list edit type for this list. The possible return values are "list," "dual," or "select." Select will display a drop down of all choices and list and dual will list them all in a table. Dual includes the linked list object for the object.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 153
- Signature: public function getListType()
- Returns: string
getSortFields()
Returns a list of fields used for sorting this list.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 258
- Signature: static public function getSortFields($form_name,$style)
- Parameters:
- Returns: array
getViewTemplate()
Return the HTML file name for the view template for this form.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 141
- Signature: public function getViewTemplate()
- Returns: string
isCached()
Checks to see if the id number is cached. Checks the cache to see if code has been cached or not. @param integer $code The code of the entry to lookup.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 641
- Signature: static final protected function isCached($table_name,$id)
- Parameters:
- string $table_name
The name of the table in the database. - $id
- string $table_name
- Returns: boolean
listOptions()
Return the list of options for this list as an array.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 296
- Signature: static public function listOptions($form_name,$opt_field,$opt_value,$sub_fields,$selectable_forms,$show_hidden)
- Parameters:
- string $form_name
The form being listed. This needs to be a subclass of I2CE_List - string $opt_field
An optional field to further limit the list of choices- Default Value: ""
- integer $opt_value
If the $opt_field is used then this is the value to limit it by.- Default Value: '|'
- array $sub_fields
of string. If $op_value is is set, it is an array of linked ($form+)$field's to include results under the optional value. e.g. if $opt_value was 'country|10' and $sub_fields was array(county+district,district+region,[region],country) we would display all counties and district who are under country|10. In this case we display the extended version of the option- Default Value: array()
- $selectable_forms
- Default Value: array()
- boolean $show_hidden
Show the hidden members of the list, defaults to false.- Default Value: false
- string $form_name
- Returns: array
lookup()
Looks up the description of the item based on the code. This is the default method that most implementations of lookup () use. It finds the description of the object based on the code and saves it in the cache and returns it.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 617
- Signature: static public function lookup($id,$form_name)
- Parameters:
- integer $id
The code of the entry to lookup. - string $form_name
The name of the form in the database.
- integer $id
- Returns: string
monsterMash()
Gets the id's for a form that live at
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 426
- Signature: static public function monsterMash($form_name,$opt_field,$opt_formid,$sub_fields,$show_hidden)
- Parameters:
- string $form_name
Example person - stirng $opt_field
The field we are limiting $form_name on. Example 'residence' - stirng $opt_formid
The form|id and we wish to look that $opt_field takes values in - artary $sub_fields
Example array(county+district,district+region,[region]) If a non-empty array it are the sub-fields path we wish to add to the results. In the example, if $opt_form|$opt_id = country|10 and $link_field = country, then we add in person where residence = country|10, then those person where residence is an region where region+country = country|10. Then we add in those person id's where residence is any distrinct whose region is a region with region+country = country|10. Then we add in those person id's where residence is an county whose district has rgion field a region whose country field is country|10. - boolean $show_hidden
Show the hidden members of the list, defaults to false.- Default Value: false
- string $form_name
name()
Return the display name for this list object. This will return the same value as lookup() but from the current object instead of from the database.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 174
- Signature: public function name($style)
- Parameters:
- string $style
Defaults to 'default'- Default Value: 'default'
- string $style
- Returns: string
removeNotShownNodes()
Remove any nodes from buildDataTree that shouldn't be shown and move the children to the previous node.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 848
- Signature: static protected function removeNotShownNodes($data)
- Parameters:
- array $data
setDisplayData()
Sets the field values to be displayed in the HTML template.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 159
- Signature: public function setDisplayData($template)
- Parameters:
- I2CE_Template &$template
showHiddenLimit()
Modifies a where clause to limit to hidden fields as neccesary @param boolean $show_hideden
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 382
- Signature: static protected function showHiddenLimit($where,$show_hidden)
- Parameters:
- array $where
- $show_hidden
- Returns: array()
walkupFieldPath()
Walk up a form/linked field path until. Return the id of the top form. $param mixed. Either an array of string or a colon-sepearted string. (imploded) values is a string of the form: form1(+field1):...:formM(+fieldM):..:fieldN there needs to be at least one colon/array needs to be at least two in length
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_List.php on line 549
- Signature: static public function walkupFieldPath($field_path,$formid)
- Parameters:
- $field_path
- string $formid
string of the form "$form|$id". the starting value. $form should be one of formX above (e.g. the dbvalue of a map field)
- Returns: mixed.
False on failure, string of the form "$form|$id" on success
Inherited Methods
__construct()
This public method is inherited from I2CE_Form->__construct()
addChildForm()
This public method is inherited from I2CE_Form->addChildForm()
cleanup()
This public method is inherited from I2CE_Form->cleanup()
displayField()
This public method is inherited from I2CE_Form->displayField()
form()
This public method is inherited from I2CE_Form->form()
getAllowedParentForms()
This public method is inherited from I2CE_Form->getAllowedParentForms()
getChildForms()
This public method is inherited from I2CE_Form->getChildForms()
getChildFormsByForm()
This public method is inherited from I2CE_Form->getChildFormsByForm()
getChildren()
This public method is inherited from I2CE_Form->getChildren()
getDisplayName()
This public method is inherited from I2CE_Form->getDisplayName()
getField()
This public method is inherited from I2CE_Form->getField()
getFormID()
This public method is inherited from I2CE_Form->getFormID()
getHistory()
This public method is inherited from I2CE_Form->getHistory()
getParent()
This public method is inherited from I2CE_Form->getParent()
getParentForm()
This public method is inherited from I2CE_Form->getParentForm()
getParentID()
This public method is inherited from I2CE_Form->getParentID()
getPost()
This public method is inherited from I2CE_Form->getPost()
listFields()
This public method is inherited from I2CE_Form->listFields()
parentIsSet()
This public method is inherited from I2CE_Form->parentIsSet()
processDOM()
This public method is inherited from I2CE_Form->processDOM()
reset()
This public method is inherited from I2CE_Form->reset()
search()
This public method is inherited from I2CE_Form->search()
setDisplayName()
This public method is inherited from I2CE_Form->setDisplayName()
setForm()
This public method is inherited from I2CE_Form->setForm()
setFromPost()
This public method is inherited from I2CE_Form->setFromPost()
setParent()
This public method is inherited from I2CE_Form->setParent()
lookupArray()
This protected method is inherited from I2CE_Form->lookupArray()
setupParentField()
This protected method is inherited from I2CE_Form->setupParentField()
__get()
This public method is inherited from I2CE_FieldContainer->__get()
__isset()
This public method is inherited from I2CE_FieldContainer->__isset()
__set()
This public method is inherited from I2CE_FieldContainer->__set()
__unset()
This public method is inherited from I2CE_FieldContainer->__unset()
addField()
This public method is inherited from I2CE_FieldContainer->addField()
clearFields()
This public method is inherited from I2CE_FieldContainer->clearFields()
current()
This public method is inherited from I2CE_FieldContainer->current()
getAttribute()
This public method is inherited from I2CE_FieldContainer->getAttribute()
getContainerType()
This public method is inherited from I2CE_FieldContainer->getContainerType()
getFieldNames()
This public method is inherited from I2CE_FieldContainer->getFieldNames()
getHTMLName()
This public method is inherited from I2CE_FieldContainer->getHTMLName()
getId()
This public method is inherited from I2CE_FieldContainer->getId()
getLoad()
This public method is inherited from I2CE_FieldContainer->getLoad()
getMeta()
This public method is inherited from I2CE_FieldContainer->getMeta()
getName()
This public method is inherited from I2CE_FieldContainer->getName()
getNameId()
This public method is inherited from I2CE_FieldContainer->getNameId()
getQueryDisplay()
This public method is inherited from I2CE_FieldContainer->getQueryDisplay()
getQueryFields()
This public method is inherited from I2CE_FieldContainer->getQueryFields()
getQueryString()
This public method is inherited from I2CE_FieldContainer->getQueryString()
hasAttribute()
This public method is inherited from I2CE_FieldContainer->hasAttribute()
hasInvalid()
This public method is inherited from I2CE_FieldContainer->hasInvalid()
hasMeta()
This public method is inherited from I2CE_FieldContainer->hasMeta()
isValid()
This public method is inherited from I2CE_FieldContainer->isValid()
key()
This public method is inherited from I2CE_FieldContainer->key()
load()
This public method is inherited from I2CE_FieldContainer->load()
next()
This public method is inherited from I2CE_FieldContainer->next()
removeField()
This public method is inherited from I2CE_FieldContainer->removeField()
rewind()
This public method is inherited from I2CE_FieldContainer->rewind()
setAttribute()
This public method is inherited from I2CE_FieldContainer->setAttribute()
setId()
This public method is inherited from I2CE_FieldContainer->setId()
setMeta()
This public method is inherited from I2CE_FieldContainer->setMeta()
setName()
This public method is inherited from I2CE_FieldContainer->setName()
valid()
This public method is inherited from I2CE_FieldContainer->valid()
validate()
This public method is inherited from I2CE_FieldContainer->validate()
addFields()
This protected method is inherited from I2CE_FieldContainer->addFields()
getAttributes()
This protected method is inherited from I2CE_FieldContainer->getAttributes()
_hasMethod()
This public method is inherited from I2CE_Fuzzy->_hasMethod()
Inherited Variables
$children
Theis public variable is inherited from I2CE_Form->$children
$parent_forms
Theis protected variable is inherited from I2CE_Form->$parent_forms
$parentField
Theis protected variable is inherited from I2CE_Form->$parentField
$name
Theis protected variable is inherited from I2CE_FieldContainer->$name
$display_name
Theis protected variable is inherited from I2CE_FieldContainer->$display_name
$fields
Theis protected variable is inherited from I2CE_FieldContainer->$fields
$attributes
Theis protected variable is inherited from I2CE_FieldContainer->$attributes
$id
Theis protected variable is inherited from I2CE_FieldContainer->$id
$factory
Theis protected variable is inherited from I2CE_FieldContainer->$factory
Inherited Fuzzy Methods
isNumeric()
This method is inherited from I2CE_Form->isNumeric()
getLimitStyles()
This method is inherited from I2CE_Form->getLimitStyles()
checkLimit()
This method is inherited from I2CE_Form->checkLimit()
checkWhereClause()
This method is inherited from I2CE_Form->checkWhereClause()
createCheckFunction()
This method is inherited from I2CE_Form->createCheckFunction()
createCheckLimitString()
This method is inherited from I2CE_Form->createCheckLimitString()
generateLimit()
This method is inherited from I2CE_Form->generateLimit()
generateWhereClause()
This method is inherited from I2CE_Form->generateWhereClause()
isComponentized()
This method is inherited from I2CE_Form->isComponentized()
addChild()
This method is inherited from I2CE_Form->addChild()
getChildIds()
This method is inherited from I2CE_Form->getChildIds()
getStorage()
This method is inherited from I2CE_Form->getStorage()
isWritable()
This method is inherited from I2CE_Form->isWritable()
populate()
This method is inherited from I2CE_Form->populate()
storeHistory()
This method is inherited from I2CE_Form->storeHistory()
populateChild()
This method is inherited from I2CE_Form->populateChild()
populateChildren()
This method is inherited from I2CE_Form->populateChildren()
populateFirst()
This method is inherited from I2CE_Form->populateFirst()
populateHistory()
This method is inherited from I2CE_Form->populateHistory()
populateLast()
This method is inherited from I2CE_Form->populateLast()
delete()
This method is inherited from I2CE_Form->delete()
save()
This method is inherited from I2CE_Form->save()
setChangeType()
This method is inherited from I2CE_Form->setChangeType()
changeID()
This method is inherited from I2CE_Form->changeID()
userMessage()
This method is inherited from I2CE_Fuzzy->userMessage()