Class: I2CE DataTree (4.1.12)

From IHRIS Wiki
(Redirected from Class: I2CE DataTree)


This article describes the class I2CE_DataTree .

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

Methods

_flattenDataTree()

Recursive method to flatten the data tree into a single array of results

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.

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'
  • 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:
    • array $data
    • boolean $keyvalue
      Return an array as key value pairs.
      • Default Value: false
    • boolean $reverse
      If using keyvalue pairs, then reverse the array so the value is the key. Any duplicates will be overwritten!
      • Default Value: false
  • Returns: array

getSQLField()

Return the appropriate sql field for limits for the report tree.

removeNotShownNodes()

Remove any nodes from buildDataTree that shouldn't be shown and move the children to the previous node.

showHiddenLimit()

Modifies a where clause to limit to hidden fields as neccesary @param int $show_hideden 0=non-hidden, 1=All, 2=hidden only.