Class: I2CE DataTree (4.1.12)
This article describes the class I2CE_DataTree .
- Location: Part of the module Lists in the package I2CE 4.1.12-release
- Source: Defined in the file modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 31
- Author: Luke Duncan <lduncan@intrahealth.org>
- Since: v4.1.5
Base object for dealing with data trees from I2CE_List objects.
Variables
$curr_alias
The report alias to use for fields in the getSQLField Callback
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 36
- Type: static protected string $curr_alias
Methods
_flattenDataTree()
Recursive method to flatten the data tree into a single array of results
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 326
- Signature: static protected function _flattenDataTree($data,$list,$keyvalue,$reverse)
- Parameters:
- Returns: array
addFormIdToLimit()
Update the limits array to add the necessary form if it's an id field because that is needed for buildDataTree since ids always include the form for joining.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 408
- Signature: static protected function addFormIdToLimit($form,$limit)
- 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_DataTree.php on line 52
- Signature: static public function buildDataTree($fields,$forms,$limits,$orders,$show_hidden,$report,$style)
- 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()
- int $show_hidden
0=non-hidden, 1=All, 2=hidden only. Defaults to 0- Default Value: 0
- array $report
A report name to use for the query instead of building it from form cache or directly.- Default Value: null
- $style
- Default Value: 'default'
- array $fields
- Returns: array
buildReportTree()
Create a data tree from a report of the selectable forms. Deisgned to be fed into tree select
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 449
- Signature: static public function buildReportTree($fields,$forms,$displayed,$limits,$orders,$show_hidden,$report)
- Parameters:
- array $fields
- array $forms
An unorderd array of form names whose values we allow to be selected - array $displayed
The displayed forms for the tree - 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()
- int $show_hidden
0=non-hidden, 1=All, 2=hidden only. Defaults to 0- Default Value: 0
- string $report
A report name to use for the query instead of building it from form cache or directly.- Default Value: null
- Returns: array
flattenDataTree()
Flatten the data tree into a single array of results
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 309
- Signature: static public function flattenDataTree($data,$keyvalue,$reverse)
- Parameters:
- Returns: array
getSQLField()
Return the appropriate sql field for limits for the report tree.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 433
- Signature: static public function getSQLField($form,$field)
- Parameters:
- 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_DataTree.php on line 280
- Signature: static protected function removeNotShownNodes($data)
- Parameters:
- array $data
showHiddenLimit()
Modifies a where clause to limit to hidden fields as neccesary @param int $show_hideden 0=non-hidden, 1=All, 2=hidden only.
- Defined in i2ce/modules/Forms/modules/Lists/lib/I2CE_DataTree.php on line 354
- Signature: static public function showHiddenLimit($where,$show_hidden)
- Parameters:
- array $where
- $show_hidden
- Returns: array()