Skip to content

icms_ipf_Tree

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_ipf_Tree

A tree structures with objects as nodes

  • Class name: icms_ipf_Tree
  • Namespace:

Properties

$_parentId

private string $_parentId

Field name of parent object ID

  • Visibility: private

$_myId

public string $_myId

Field name of object ID

  • Visibility: public

$_rootId

private string $_rootId = \null

Field name of root object ID

  • Visibility: private

$_tree

public array $_tree = array()

Array of Tree

  • Visibility: public

$_objects

private \icms_core_Object[] $_objects = array()

Array of objects

  • Visibility: private

Methods

__construct

mixed icms_ipf_Tree::__construct(\icms_core_Object objectArr, string myId, string parentId, string rootId)

Constructor

  • Visibility: public

Arguments

  • objectArr icms_core_Object - <p>Array of objects</p>
  • myId string - <p>field name of object ID</p>
  • parentId string - <p>field name of parent object ID</p>
  • rootId string - <p>field name of root object ID</p>

_initialize

mixed icms_ipf_Tree::_initialize()

Initialize the object

  • Visibility: private

getTree

array icms_ipf_Tree::getTree()

Get the tree

  • Visibility: public

getByKey

object icms_ipf_Tree::getByKey(string key)

returns an object from the tree specified by its id

  • Visibility: public

Arguments

  • key string - <p>ID of the object to retrieve</p>

getFirstChild

array icms_ipf_Tree::getFirstChild(string key)

returns an array of all the first child object of an object specified by its id

  • Visibility: public

Arguments

  • key string - <p>ID of the parent object</p>

getAllChild

array icms_ipf_Tree::getAllChild(string key, array ret)

returns an array of all child objects of an object specified by its id

  • Visibility: public

Arguments

  • key string - <p>ID of the parent</p>
  • ret array - <p>(Empty when called from client) Array of children from previous recursions.</p>

getAllParent

array icms_ipf_Tree::getAllParent(string key, array ret, int uplevel)

returns an array of all parent objects.

the key of returned array represents how many levels up from the specified object

  • Visibility: public

Arguments

  • key string - <p>ID of the child object</p>
  • ret array - <p>(empty when called from outside) Result from previous recursions</p>
  • uplevel int - <p>(empty when called from outside) level of recursion</p>

_makeSelBoxOptions

mixed icms_ipf_Tree::_makeSelBoxOptions(string fieldName, string selected, int key, string ret, string prefix_orig, string prefix_curr)

Make options for a select box from

  • Visibility: private

Arguments

  • fieldName string - <p>Name of the member variable from the node objects that should be used as the title for the options.</p>
  • selected string - <p>Value to display as selected</p>
  • key int - <p>ID of the object to display as the root of select options</p>
  • ret string - <p>(reference to a string when called from outside) Result from previous recursions</p>
  • prefix_orig string - <p>String to indent items at deeper levels</p>
  • prefix_curr string - <p>String to indent the current item</p>

makeSelBox

string icms_ipf_Tree::makeSelBox(string name, string fieldName, string prefix, string selected, bool addEmptyOption, int key)

Make a select box with options from the tree

  • Visibility: public

Arguments

  • name string - <p>Name of the select box</p>
  • fieldName string - <p>Name of the member variable from the node objects that should be used as the title for the options.</p>
  • prefix string - <p>String to indent deeper levels</p>
  • selected string - <p>Value to display as selected</p>
  • addEmptyOption bool - <p>Set TRUE to add an empty option with value "0" at the top of the hierarchy</p>
  • key int - <p>ID of the object to display as the root of select options</p>
Clone this wiki locally