|
| __construct (&$objectArr, $myId, $parentId, $rootId=null) |
|
& | getTree () |
|
& | getByKey ($key) |
|
| getFirstChild ($key) |
|
| getAllChild ($key, $ret=array()) |
|
| getAllParent ($key, $ret=array(), $upLevel=1) |
|
| makeSelBox ( $name, $fieldName, $prefix='-', $selected='', $addEmptyOption=false, $key=0, $extra='') |
|
| makeSelectElement ( $name, $fieldName, $prefix='-', $selected='', $addEmptyOption=false, $key=0, $extra='', $caption='') |
|
| __get ($name) |
|
◆ __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 |
◆ __get()
Magic __get method
Some modules did not respect the leading underscore is private convention and broke when code was modernized. This will keep them running for now.
- Parameters
-
string | $name | unknown variable name requested currently only '_tree' is supported |
- Returns
- mixed value
◆ addSelectOptions()
addSelectOptions |
( |
|
$element, |
|
|
|
$fieldName, |
|
|
|
$key, |
|
|
|
$prefix_orig, |
|
|
|
$prefix_curr = '' |
|
) |
| |
|
protected |
Make options for a select box from
- Parameters
-
XoopsFormSelect | $element | form element to receive tree values as options |
string | $fieldName | Name of the member variable from the node objects that should be used as the title for the options. |
int | $key | ID of the object to display as the root of select options |
string | $prefix_orig | String to indent items at deeper levels |
string | $prefix_curr | String to indent the current item |
- Returns
- void @access private
◆ getAllChild()
getAllChild |
( |
|
$key, |
|
|
|
$ret = array() |
|
) |
| |
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.
◆ getAllParent()
getAllParent |
( |
|
$key, |
|
|
|
$ret = array() , |
|
|
|
$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.
◆ 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
◆ 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
◆ getTree()
Get the tree
- Returns
- array Associative array comprising the tree
◆ initialize()
Initialize the object
@access private
◆ makeSelBox()
makeSelBox |
( |
|
$name, |
|
|
|
$fieldName, |
|
|
|
$prefix = '-' , |
|
|
|
$selected = '' , |
|
|
|
$addEmptyOption = false , |
|
|
|
$key = 0 , |
|
|
|
$extra = '' |
|
) |
| |
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 |
integer | $key | ID of the object to display as the root of select options |
string | $extra | |
- Returns
- string HTML select box
- Deprecated:
- since 2.5.9, please use makeSelectElement()
◆ makeSelBoxOptions()
makeSelBoxOptions |
( |
|
$fieldName, |
|
|
|
$selected, |
|
|
|
$key, |
|
|
& |
$ret, |
|
|
|
$prefix_orig, |
|
|
|
$prefix_curr = '' |
|
) |
| |
|
protected |
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
- Deprecated:
- since 2.5.9, please use makeSelectElement() functionality
◆ makeSelectElement()
makeSelectElement |
( |
|
$name, |
|
|
|
$fieldName, |
|
|
|
$prefix = '-' , |
|
|
|
$selected = '' , |
|
|
|
$addEmptyOption = false , |
|
|
|
$key = 0 , |
|
|
|
$extra = '' , |
|
|
|
$caption = '' |
|
) |
| |
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 |
integer | $key | ID of the object to display as the root of select options |
string | $extra | extra content to add to the element |
string | $caption | optional caption for form element |
- Returns
- XoopsFormSelect form element
◆ $myId
◆ $objects
◆ $parentId
◆ $rootId
◆ $tree
The documentation for this class was generated from the following file: