|
| | init () |
| |
| | storeItem ($item_id, $parent_id, $name, $priority) |
| |
| | buildIndex ($item_id=false) |
| |
| | getKids ($item_id) |
| |
| | getNumKids ($item_id) |
| |
| | getKidsKids ($item_id, $in_recursion=false) |
| |
| | getNumKidsKids ($item_id, $in_recursion=false) |
| |
| | isLastKid ($item_id) |
| |
| | isFirstKid ($item_id) |
| |
| | isChildOf ($ancestor_id, $item_id) |
| |
| | hasKids ($item_id) |
| |
| | getItemPath ($item_id) |
| |
| | getParents ($item_id) |
| |
| | getShortPath ($item_id, $length=null, $delimeter=">", $offset=0) |
| |
| | getMaxPriority ($parent_id) |
| |
| | getNumEntries ($item_id, $num_entries_from_kids=false) |
| |
| | getNumEntriesKids ($item_id, $in_recursion=false) |
| |
| | getValue ($item_id, $field) |
| |
◆ __construct()
◆ buildIndex()
| buildIndex |
( |
|
$item_id = false | ) |
|
build an index for sorting purpose
build an index for sorting purpose
- Parameters
-
◆ GetInstance()
| static GetInstance |
( |
|
$class_name, |
|
|
|
$args = null, |
|
|
|
$invalidate_cache = false |
|
) |
| |
|
static |
static method used to ensure that only one instance exists
use this method if you need a reference to the tree object
usage:
$my_tree = StudipRangeTree::GetInstance("name_of_tree_class")- Parameters
-
| string | $class_name | the name of the used tree_class |
| mixed | $args | argumentlist passed to the constructor in the tree_class (if needed) |
- Returns
- mixed always an object, type is one of AbstractTree s childclasses
◆ getItemPath()
Returns tree path
returns a string with the item and all parents separated with a slash
- Parameters
-
- Returns
- string
◆ getKids()
returns all direct kids
- Parameters
-
- Returns
- array
◆ getKidsKids()
| getKidsKids |
( |
|
$item_id, |
|
|
|
$in_recursion = false |
|
) |
| |
returns all direct kids and kids of kids and so on...
- Parameters
-
| string | $item_id | |
| bool | $in_recursion | only used in recursion |
- Returns
- array
◆ getMaxPriority()
| getMaxPriority |
( |
|
$parent_id | ) |
|
Returns the maximum priority value from a parents child
- Parameters
-
- Returns
- int
◆ getNumEntries()
| getNumEntries |
( |
|
$item_id, |
|
|
|
$num_entries_from_kids = false |
|
) |
| |
◆ getNumEntriesKids()
| getNumEntriesKids |
( |
|
$item_id, |
|
|
|
$in_recursion = false |
|
) |
| |
◆ getNumKids()
returns the number of all direct kids
- Parameters
-
| string | $item_id | |
| bool | $in_recursion | |
- Returns
- int
◆ getNumKidsKids()
| getNumKidsKids |
( |
|
$item_id, |
|
|
|
$in_recursion = false |
|
) |
| |
returns the number of all kids and kidskids...
- Parameters
-
| string | $item_id | |
| bool | $in_recursion | |
- Returns
- int
◆ getParents()
Returns tree path as array of item_id s
returns an array containing all parents of given item
- Parameters
-
- Returns
- array
◆ getShortPath()
| getShortPath |
( |
|
$item_id, |
|
|
|
$length = null, |
|
|
|
$delimeter = ">", |
|
|
|
$offset = 0 |
|
) |
| |
◆ getValue()
| getValue |
( |
|
$item_id, |
|
|
|
$field |
|
) |
| |
◆ hasKids()
checks if item has one or more kids
- Parameters
-
- Returns
- boolean
◆ init()
◆ isChildOf()
| isChildOf |
( |
|
$ancestor_id, |
|
|
|
$item_id |
|
) |
| |
checks if given item is a kid or kidkid...of given ancestor
checks if given item is a kid or kidkid...of given ancestor
- Parameters
-
| string | $ancestor_id | |
| string | $item_id | |
- Returns
- boolean
◆ isFirstKid()
checks if item is the first kid
- Parameters
-
- Returns
- boolean
◆ isLastKid()
checks if item is the last kid
- Parameters
-
- Returns
- boolean
◆ storeItem()
| storeItem |
( |
|
$item_id, |
|
|
|
$parent_id, |
|
|
|
$name, |
|
|
|
$priority |
|
) |
| |
store one item in tree_data array
store one item in tree_data array
- Parameters
-
| string | $item_id | |
| string | $parent_id | |
| string | $name | |
| integer | $priority | |
◆ $index_offset
◆ $root_name
the name of the root element
@access private
◆ $tree_childs
array containing the direct childs of all items
assoc. array, key is one from $tree_data, value is numeric array with keys from childs @access private
◆ $tree_data
array containing all tree items
associative array, key is an unique identifier (eg primary key from DB table) value is another assoc. array containing the other fieldname/fieldvalue pairs these fieldnames must be used : parent_id, name, priority @access public
◆ $tree_num_childs
| array $tree_num_childs = [] |
array containing the number of direct childs of all items
assoc. array, key is one from $tree_data @access private
◆ $view
object to handle database queries
@access private
The documentation for this class was generated from the following file: