Property | Type | Description | |
---|---|---|---|
$instance | string | The name of this instance. |
Property | Type | Description | |
---|---|---|---|
$_nodes | array | An array containing all the tree nodes. | |
$_root_nodes | array | The top-level nodes in the tree. | |
$_session | array | Callbacks used to store session data. |
Method | Description | |
---|---|---|
__construct ( string $name, array $session = [] ) | Constructor. | |
addNode ( array $node ) | Adds a node to the node tree array. | |
addNodeParams ( string $id, array $params = [] ) | Adds additional parameters to a node. | |
count ( ) | * Countable methods. | |
getNodes ( ) : array | Returns the nodes of the tree. | |
getRootNodes ( ) : array | Returns the root node IDs. | |
isExpanded ( mixed $id ) : boolean | Returns whether the specified node is currently expanded. | |
nodeId ( string $id ) : string | Returns the escaped node ID. | |
sort ( string $criteria, integer $id ) | Sorts the tree by the specified node property. | |
sortHelper ( $a, $b ) | Helper method for sort() to compare two tree elements. |
Method | Description | |
---|---|---|
_buildIndents ( array $nodes, integer $indent ) | Set the indent level for each node in the tree. |
public __construct ( string $name, array $session = [] ) | ||
$name | string | The name of this tree instance. |
$session | array | Callbacks used to store session data. Must define two keys: 'get' and 'set'. Function definitions: (string) = get([string - Instance], [string - ID]); set([string - Instance], [string - ID], [boolean - value]); DEFAULT: No session storage |
protected _buildIndents ( array $nodes, integer $indent ) | ||
$nodes | array | TODO |
$indent | integer | TODO |
public addNode ( array $node ) | ||
$node | array | A hash with node properties: - id: (string) The unique node id. - parent: (string) The parent's unique node id. - label: (string) The text label for the node. - expanded: (boolean) Is this level expanded or not. - params: (array) Any other parameters to set (see addNodeParams() of the renderers for full details). |
public addNodeParams ( string $id, array $params = [] ) | ||
$id | string | The unique node id. |
$params | array | Parameters to set (key/value pairs). |
public getRootNodes ( ) : array | ||
return | array | The root nodes. |
public isExpanded ( mixed $id ) : boolean | ||
$id | mixed | The unique node id. |
return | boolean | True if the specified node is expanded. |
public sortHelper ( $a, $b ) |
protected array $_nodes | ||
return | array |
protected array $_root_nodes | ||
return | array |
protected array $_session | ||
return | array |