SproutCMS

This is the code documentation for the SproutCMS project

class Treenode

Represents a node in the tree

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-11-25
**/
class NewClassName extends Treenode {
    
    /**
    * ArrayAccess function for checking if a specified key exists
    **/
    public function offsetExists (mixed $offset) {
        // Method code goes here
    }
    
    /**
    * ArrayAccess function for getting a value by its key
    **/
    public function offsetGet (mixed $offset) {
        // Method code goes here
    }
    
    /**
    * ArrayAccess function for setting a value by its key
    **/
    public function offsetSet (mixed $offset, mixed $value) {
        // Method code goes here
    }
    
    /**
    * ArrayAccess function for unsetting a value
    **/
    public function offsetUnset (mixed $offset) {
        // Method code goes here
    }
    
    /**
    * Creates a node, with the specified data
    **/
    public function __construct (array $data) {
        // Method code goes here
    }
    
    /**
    * Returns true if this node is the root node
    **/
    public function isRoot () {
        // Method code goes here
    }
    
    /**
    * Loads a flat table into a tree structure.
    * Requires the table to have an id, parent_id and record_order field.
    **/
    public function loadTree (string $table, array $conditions, string $order) {
        // Method code goes here
    }
    
    /**
    * 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 function findNodeValue (mixed $key, mixed $value) {
        // Method code goes here
    }
    
    /**
    * 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 function findNode (TreenodeMatcher $matcher) {
        // Method code goes here
    }
    
    /**
    * Finds all nodes which match the specified matcher.
    **/
    public function findAllNodes (TreenodeMatcher $matcher) {
        // Method code goes here
    }
    
    /**
    * 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 function findAncestors () {
        // Method code goes here
    }
    
    /**
    * 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 function filterChildren (TreenodeMatcher $matcher) {
        // Method code goes here
    }
    
    /**
    * Removes the currently active filter
    **/
    public function removeFilter () {
        // Method code goes here
    }
    
    /**
    * Returns an array of all children nodes, including sub-children
    * 
    * The array will be id =&gt; 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 function getAllChildren ($exclude_id, $indent_str, $indent) {
        // Method code goes here
    }
    
    public function getChildren () {
        // Method code goes here
    }
    
    /**
    * Is this node an orphan?
    * Orphans are at the top of the tree, and they don't have any children.
    **/
    public function isOrphan () {
        // Method code goes here
    }
    
    /**
    * Generic field getter for unknown properties - used for TreeNode-&gt;children
    * 
    * Be aware that data gotten through this getter is BY REFERENCE
    * For by-value data retrival, use the array-access functions.
    **/
    public function __get (string $field) {
        // Method code goes here
    }
    
    /**
    * Generic field getter for unknown properties - used for TreeNode-&gt;children
    **/
    public function __set (string $field, mixed $value) {
        // Method code goes here
    }
    
}
?>