XOOPS  2.6.0
XoopsObjectTree Class Reference

Public Member Functions

 __construct (&$objectArr, $myId, $parentId, $rootId=null)
 
 _makeArrayTreeOptions ($fieldName, $key, &$ret, $prefix_orig, $prefix_curr= '')
 
 getAllChild ($key, $ret=array())
 
 getAllParent ($key, $ret=array(), $uplevel=1)
 
 getByKey ($key)
 
 getFirstChild ($key)
 
 getTree ()
 
 makeArrayTree ($fieldName, $prefix= '-', $key=0)
 
 makeSelBox ($name, $fieldName, $prefix= '-', $selected= '', $addEmptyOption=false, $key=0, $extra= '')
 

Private Member Functions

 _initialize ()
 
 _makeSelBoxOptions ($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr= '')
 

Private Attributes

 $_myId
 
 $_objects
 
 $_parentId
 
 $_rootId = null
 
 $_tree = array()
 

Detailed Description

Definition at line 30 of file tree.php.

Constructor & Destructor Documentation

XoopsObjectTree::__construct ( $objectArr,
  $myId,
  $parentId,
  $rootId = null 
)

Constructor

Parameters
array$objectArrArray of XoopsObjects
string$myIdfield name of object ID
string$parentIdfield name of parent object ID
string$rootIdfield name of root object ID

Definition at line 65 of file tree.php.

References _initialize().

Here is the call graph for this function:

Member Function Documentation

XoopsObjectTree::_initialize ( )
private

Initialize the object

private

Definition at line 81 of file tree.php.

Referenced by __construct().

Here is the caller graph for this function:

XoopsObjectTree::_makeArrayTreeOptions (   $fieldName,
  $key,
$ret,
  $prefix_orig,
  $prefix_curr = '' 
)

Make a array with options from the tree

Parameters
string$fieldNameName of the member variable from the node objects that should be used as the column.
integer$keyID of the object to display as the root of the array
string$prefix_origString to indent deeper levels (origin)
string$prefix_currString to indent deeper levels (current)
Returns
void

Definition at line 258 of file tree.php.

Referenced by makeArrayTree().

Here is the caller graph for this function:

XoopsObjectTree::_makeSelBoxOptions (   $fieldName,
  $selected,
  $key,
$ret,
  $prefix_orig,
  $prefix_curr = '' 
)
private

Make options for a select box from

Parameters
string$fieldNameName of the member variable from the node objects that should be used as the title for the options.
string$selectedValue to display as selected
int$keyID 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_origString to indent items at deeper levels
string$prefix_currString to indent the current item
Returns
void

Definition at line 189 of file tree.php.

Referenced by makeSelBox().

Here is the caller graph for this function:

XoopsObjectTree::getAllChild (   $key,
  $ret = array() 
)

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

Parameters
string$keyID 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 141 of file tree.php.

XoopsObjectTree::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$keyID 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 164 of file tree.php.

XoopsObjectTree::getByKey (   $key)

returns an object from the tree specified by its id

Parameters
string$keyID of the object to retrieve
Returns
object Object within the tree

Definition at line 112 of file tree.php.

XoopsObjectTree::getFirstChild (   $key)

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

Parameters
string$keyID of the parent object
Returns
array Array of children of the parent

Definition at line 123 of file tree.php.

XoopsObjectTree::getTree ( )

Get the tree

Returns
array Associative array comprising the tree

Definition at line 101 of file tree.php.

References $_tree.

XoopsObjectTree::makeArrayTree (   $fieldName,
  $prefix = '-',
  $key = 0 
)

Make options for a array

Parameters
string$fieldNameName of the member variable from the node objects that should be used as the column.
string$prefixString to indent deeper levels
integer$keyID of the object to display as the root of the array
Returns
array

Definition at line 241 of file tree.php.

References _makeArrayTreeOptions().

Here is the call graph for this function:

XoopsObjectTree::makeSelBox (   $name,
  $fieldName,
  $prefix = '-',
  $selected = '',
  $addEmptyOption = false,
  $key = 0,
  $extra = '' 
)

Make a select box with options from the tree

Parameters
string$fieldNameName of the member variable from the node objects that should be used as the title for the options.
string$prefixString to indent deeper levels
string$selectedValue to display as selected
bool$addEmptyOptionSet TRUE to add an empty option with value "0" at the top of the hierarchy
integer$keyID of the object to display as the root of select options
string$extra
string$name
Returns
string HTML select box

Definition at line 222 of file tree.php.

References $name, and _makeSelBoxOptions().

Here is the call graph for this function:

Member Data Documentation

XoopsObjectTree::$_myId
private

Definition at line 40 of file tree.php.

XoopsObjectTree::$_objects
private

Definition at line 55 of file tree.php.

XoopsObjectTree::$_parentId
private

Definition at line 35 of file tree.php.

XoopsObjectTree::$_rootId = null
private

Definition at line 45 of file tree.php.

XoopsObjectTree::$_tree = array()
private

Definition at line 50 of file tree.php.

Referenced by getTree().


The documentation for this class was generated from the following file: