TreeItem()
addItem()
addItemToID()
collapseAll()
expandAll()
getCollapsedList()
getExpandedList()
getFlatTree()
getItemByID()
getParentNodes()
getRealCollapsedList()
getTreeParentNodes()
hasCollapsedNode()
isCustomAttributeSet()
markCollapsed()
markExpanded()
removeItem()
traverse()
$collapsed
$collapsed_icon
$custom
$expanded_icon
$id
$lastnode_icon
$level
$name
$parent
$subitems
Class TreeItem Class to create tree-based items
The treeitem class allows you to logically store tree-based structures.
Example:
Let's have a tree with 3 nodes. It's important that we always have a "root" key.
$root = new TreeItem("root", 1); $item1 = new TreeItem("node1",2); $item2 = new TreeItem("node2",3); $item3 = new TreeItem("node3",4);
$root->addItem($item1); $root->addItem($item2); $root->addItem($item3);
This represents the tree we described above.
If you know the ID of the item you want to add to, there's no need to have a specific item handy, but rather you can use the "addItemToID" function.
TreeItem(string $name, string $id, boolean $collapsed)
string
The name of that item
string
The unique ID of that item
boolean
Is this item collapsed by default
addItem(object $item)
object
the item to add
addItemToID(object $item, string $id)
Traverses all subitems to find the correct item.
object
the item to add
string
the ID to add the item to
collapseAll(string $start)
string
the ID to start collapsing from
getCollapsedList(array $list)
array
Contains the list with all collapsed items
getExpandedList(array $list)
array
Contains the list with all expanded items
getFlatTree($item, $flat_tree)
getItemByID(string $id) : object
string
the ID to find
object
The item, or false if nothing was foundgetParentNodes($parentNodes, $stop_id)
getRealCollapsedList($list)
getTreeParentNodes($parentNodes, $id)
hasCollapsedNode($item_id)
isCustomAttributeSet(string $item)
string
the attribute name to find
markCollapsed(string $id)
string
the ID to collapse
markExpanded(string $id)
string
the ID to expand, or an array with all id's
removeItem(string $id)
string
the ID to find
traverse(object $objects, integer $level)
object
all found objects
integer
Level to start on
$collapsed : boolean
$collapsed_icon : string
$custom : array
$id : string
$lastnode_icon : string
$level : integer
$name : string
$parent : array
$subitems : array