Creates a basic tree view of a data object using html ordered/unordered lists. More...
Public Member Functions | |
__construct ($model=null, $options=array()) | |
Class constructor. | |
map ($node) | |
Returns html output of the object. | |
render_leaf ($leaf) | |
Method to customise with the leaf information Example: return "<a href='" . | |
add_node ($node, $parent_node_or_id) | |
Add a node to a parent. | |
remove_node ($node_or_id) | |
Remove node from list. | |
get_node ($id) | |
Get node by id. | |
get_children ($id) | |
Get the children of a node. | |
render ($node_id=null) | |
Recursive method which creates an HTML list from the record's children [and its children's children etc. | |
__toString () | |
Returns html output of the object. | |
![]() | |
__call ($function, $params) | |
The 'magic' call method will get/set for us invoked when the interpreter can not find a method the user is asking for. | |
set_parameters ($arguments) | |
Set variables from an array to member fields requires $this->optional_arguments or $this->required_arguments to have been set by the subclass. |
Protected Attributes | |
$nodes = array() | |
Array of key => value pairs representing a record. | |
![]() | |
$optional_arguments = array() | |
Array of options that can be set to variables. | |
$required_arguments = array() | |
Array of options that need to be set to variables. |
Creates a basic tree view of a data object using html ordered/unordered lists.
For a flat record set, it will create a list of 'li' elements; for records which contain one-to-many relationships, it will display nested items if available. If more than one table is required, you need to specify the tables you wish to use in the $tables array, e.g. array('table_name' => array('to_string' => 'field_name'));
Abstract_tree::__construct | ( | $model = null , |
|
$options = array() |
|||
) |
Class constructor.
Abstract_tree::get_children | ( | $id | ) |
Get the children of a node.
$id | the id of the node |
Abstract_tree::get_node | ( | $id | ) |
Get node by id.
$id | the id of the node |
Abstract_tree::render | ( | $node_id = null | ) |
Recursive method which creates an HTML list from the record's children [and its children's children etc.
].
|
abstract |
Method to customise with the leaf information Example: return "<a href='" .
URL_PHANG_VIRTUAL . '/pages/' . $leaf->link . "/'>" . $leaf->name . "</a>";