|
| __construct (&$objectArr, $myId, $parentId, $rootId=null) |
|
| _initialize () |
|
& | getTree () |
|
& | getByKey ($key) |
|
& | getFirstChild ($key) |
|
& | getAllChild ($key, $ret=[]) |
|
& | getAllParent ($key, $ret=[], $uplevel=1) |
|
| _makeSelBoxOptions ($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr='') |
|
& | makeSelBox ($name, $fieldName, $prefix='-', $selected='', $addEmptyOption=false, $key=0) |
|
Definition at line 14 of file tree.php.
◆ __construct()
__construct |
( |
& | $objectArr, |
|
|
| $myId, |
|
|
| $parentId, |
|
|
| $rootId = null ) |
#- Constructor
- Parameters
-
array | $objectArr | Array of XoopsObject s |
string | $myId | field name of object ID |
string | $parentId | field name of parent object ID |
string | $rootId | field name of root object ID |
Definition at line 35 of file tree.php.
◆ _initialize()
Initialize the object
@access private
Definition at line 51 of file tree.php.
◆ _makeSelBoxOptions()
_makeSelBoxOptions |
( |
| $fieldName, |
|
|
| $selected, |
|
|
| $key, |
|
|
& | $ret, |
|
|
| $prefix_orig, |
|
|
| $prefix_curr = '' ) |
Make options for a select box from
- Parameters
-
string | $fieldName | Name of the member variable from the node objects that should be used as the title for the options. |
string | $selected | Value to display as selected |
int | $key | ID of the object to display as the root of select options |
string | $ret | (reference to a string when called from outside) Result from previous recursions |
string | $prefix_orig | String to indent items at deeper levels |
string | $prefix_curr | String to indent the current item |
- Returns
- void
@access private
Definition at line 159 of file tree.php.
◆ getAllChild()
& getAllChild |
( |
| $key, |
|
|
| $ret = [] ) |
returns an array of all child objects of an object specified by its id
- Parameters
-
string | $key | ID of the parent |
array | $ret | (Empty when called from client) Array of children from previous recursions. |
- Returns
- array Array of child nodes.
Definition at line 110 of file tree.php.
◆ getAllParent()
& getAllParent |
( |
| $key, |
|
|
| $ret = [], |
|
|
| $uplevel = 1 ) |
returns an array of all parent objects. the key of returned array represents how many levels up from the specified object
- Parameters
-
string | $key | ID of the child object |
array | $ret | (empty when called from outside) Result from previous recursions |
int | $uplevel | (empty when called from outside) level of recursion |
- Returns
- array Array of parent nodes.
Definition at line 133 of file tree.php.
◆ getByKey()
returns an object from the tree specified by its id
- Parameters
-
string | $key | ID of the object to retrieve |
- Returns
- object Object within the tree
Definition at line 81 of file tree.php.
◆ getFirstChild()
returns an array of all the first child object of an object specified by its id
- Parameters
-
string | $key | ID of the parent object |
- Returns
- array Array of children of the parent
Definition at line 92 of file tree.php.
◆ getTree()
Get the tree
- Returns
- array Associative array comprising the tree
Definition at line 70 of file tree.php.
◆ makeSelBox()
& makeSelBox |
( |
| $name, |
|
|
| $fieldName, |
|
|
| $prefix = '-', |
|
|
| $selected = '', |
|
|
| $addEmptyOption = false, |
|
|
| $key = 0 ) |
Make a select box with options from the tree
- Parameters
-
string | $name | Name of the select box |
string | $fieldName | Name of the member variable from the node objects that should be used as the title for the options. |
string | $prefix | String to indent deeper levels |
string | $selected | Value to display as selected |
bool | $addEmptyOption | Set TRUE to add an empty option with value "0" at the top of the hierarchy |
int | $key | ID of the object to display as the root of select options |
- Returns
- string HTML select box
Definition at line 189 of file tree.php.
◆ $_myId
◆ $_objects
◆ $_parentId
#+ @access private
Definition at line 20 of file tree.php.
◆ $_rootId
◆ $_tree
The documentation for this class was generated from the following file: