Phang  2.1
 All Classes Files Functions Variables Pages
Public Member Functions | Protected Attributes
Abstract_tree Class Reference

Creates a basic tree view of a data object using html ordered/unordered lists. More...

Inheritance diagram for Abstract_tree:
Base

List of all members.

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.
- Public Member Functions inherited from Base
 __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.
- Protected Attributes inherited from Base
 $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.

Detailed Description

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'));


Constructor & Destructor Documentation

Abstract_tree::__construct (   $model = null,
  $options = array() 
)

Class constructor.

  • $data: Data/UI object

Member Function Documentation

Abstract_tree::get_children (   $id)

Get the children of a node.

Parameters:
$idthe id of the node
Abstract_tree::get_node (   $id)

Get node by id.

Parameters:
$idthe 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_tree::render_leaf (   $leaf)
abstract

Method to customise with the leaf information Example: return "<a href='" .

URL_PHANG_VIRTUAL . '/pages/' . $leaf->link . "/'>" . $leaf->name . "</a>";


The documentation for this class was generated from the following file: