Represents a node in the tree
This is the code documentation for the SproutCMS project
Search documentation |
class TreenodeRepresents a node in the tree
Variables
Functions
public __constructvoid $Treenode->__construct ( [ array $data ] ); Creates a node, with the specified data public __getunknown $Treenode->__get ( string &$field ); Generic field getter for unknown properties - used for TreeNode->children Be aware that data gotten through this getter is BY REFERENCE For by-value data retrival, use the array-access functions. public __setvoid $Treenode->__set ( string $field , mixed $value ); Generic field getter for unknown properties - used for TreeNode->children public filterChildrenvoid $Treenode->filterChildren ( TreenodeMatcher $matcher ); Filter the children of this node, removing any children which don't match the specified TreenodeMatcher. The nodes are not actually removed, matching nodes are just added to a filtered children list Which is returned instead of the original children list. public findAllNodesstatic[] $Treenode->findAllNodes ( TreenodeMatcher $matcher ); Finds all nodes which match the specified matcher. public findAncestorsstatic[] $Treenode->findAncestors ( ); Finds all ancestors of a specific node, including the node, not including the root node of the tree The array is in order from top to bottom, so $ancestors[0] is the top-parent, and $ancestors[len-1] is the node. A B C D E F G H I NODE RESULT ARRAY H B D H D B D B B A (empty) public findNodestatic $Treenode->findNode ( TreenodeMatcher $matcher ); Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn. If that does not match, return null public findNodeValueTreeNode $Treenode->findNodeValue ( mixed $key , mixed $value ); Finds a node by looking at this node If that does not match, looking at each of this nodes children in turn. If that does not match, return null public getAllChildrenunknown $Treenode->getAllChildren ( [ mixed $exclude_id [, mixed $indent_str [, mixed $indent ]]] ); Returns an array of all children nodes, including sub-children The array will be id => name. This function requires the table to have a column named 'name'. The name field will be indented according to the depth. If specified, the exclude_id argument will be used to exclude nodes (and their children) according to id. public getChildrenstatic[] $Treenode->getChildren ( ); This function does not have a description public isOrphanbool $Treenode->isOrphan ( ); Is this node an orphan? Orphans are at the top of the tree, and they don't have any children. public isRootunknown $Treenode->isRoot ( ); Returns true if this node is the root node public loadTreeTreenode Treenode::loadTree ( string $table [, array $conditions [, string $order ]] ); Loads a flat table into a tree structure. Requires the table to have an id, parent_id and record_order field. public offsetExistsunknown $Treenode->offsetExists ( mixed $offset ); ArrayAccess function for checking if a specified key exists public offsetGetunknown $Treenode->offsetGet ( mixed $offset ); ArrayAccess function for getting a value by its key public offsetSetvoid $Treenode->offsetSet ( mixed $offset , mixed $value ); ArrayAccess function for setting a value by its key public offsetUnsetvoid $Treenode->offsetUnset ( mixed $offset ); ArrayAccess function for unsetting a value public removeFiltervoid $Treenode->removeFilter ( ); Removes the currently active filter |
Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Monday, 3rd April, 2023 at 02:59 pm |