API - XOOPS 2.5.11 Beta 2
By monxoops.fr
XoopsObjectTree Class Reference

Public Member Functions

 __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)
 

Protected Member Functions

 initialize ()
 
 makeSelBoxOptions ($fieldName, $selected, $key, &$ret, $prefix_orig, $prefix_curr='')
 
 addSelectOptions ($element, $fieldName, $key, $prefix_orig, $prefix_curr='')
 

Protected Attributes

 $parentId
 
 $myId
 
 $rootId
 
 $tree = array()
 
 $objects
 

Constructor & Destructor Documentation

◆ __construct()

__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
Here is the call graph for this function:

Member Function Documentation

◆ __get()

__get (   $name)

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$nameunknown 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$elementform element to receive tree values as options
string$fieldNameName of the member variable from the node objects that should be used as the title for the options.
int$keyID of the object to display as the root of select options
string$prefix_origString to indent items at deeper levels
string$prefix_currString to indent the current item
Returns
void @access private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllChild()

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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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$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.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getByKey()

& 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

◆ getFirstChild()

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

◆ getTree()

& getTree ( )

Get the tree

Returns
array Associative array comprising the tree

◆ initialize()

initialize ( )
protected

Initialize the object

@access private

Here is the caller graph for this function:

◆ makeSelBox()

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

Make a select box with options from the tree

Parameters
string$nameName of the select box
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
Returns
string HTML select box
Deprecated:
since 2.5.9, please use makeSelectElement()
Here is the call graph for this function:

◆ makeSelBoxOptions()

makeSelBoxOptions (   $fieldName,
  $selected,
  $key,
$ret,
  $prefix_orig,
  $prefix_curr = '' 
)
protected

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
Deprecated:
since 2.5.9, please use makeSelectElement() functionality
Here is the call graph for this function:
Here is the caller graph for this function:

◆ makeSelectElement()

makeSelectElement (   $name,
  $fieldName,
  $prefix = '-',
  $selected = '',
  $addEmptyOption = false,
  $key = 0,
  $extra = '',
  $caption = '' 
)

Make a select box with options from the tree

Parameters
string$nameName of the select box
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$extraextra content to add to the element
string$captionoptional caption for form element
Returns
XoopsFormSelect form element
Here is the call graph for this function:

Field Documentation

◆ $myId

$myId
protected

◆ $objects

$objects
protected

◆ $parentId

$parentId
protected

@access private

◆ $rootId

$rootId
protected

◆ $tree

$tree = array()
protected

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