Class Horde_Tree

Description

The Horde_Tree:: class provides a tree view of hierarchical information. It allows for expanding/collapsing of branches and maintains their state. It can work together with the Horde_Tree javascript class to achieve this in DHTML on supported browsers.

Copyright 2003-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

$Horde: framework/Tree/Tree.php,v 1.46.6.18 2009/01/06 15:23:44 jan Exp $

Located in /Tree/Tree.php (line 36)


	
			
Direct descendents
Class Description
 class Horde_Tree_html The Horde_Tree_html:: class extends the Horde_Tree class to provide HTML specific rendering functions.
 class Horde_Tree_javascript The Horde_Tree_javascript:: class extends the Horde_Tree class to provide javascript specific rendering functions.
 class Horde_Tree_select The Horde_Tree_select:: class extends the Horde_Tree class to provide <option> tag rendering.
Variable Summary
 array $_header
 string $_instance
 array $_nodes
 array $_options
 array $_root_nodes
 boolean $_static
 boolean $_usesession
Method Summary
 static Horde_Tree &factory (string $name, mixed $renderer, [array $params = array()])
 static Horde_Tree &singleton (mixed $name, string $renderer, [array $params = array()])
 Horde_Tree Horde_Tree (string $name, [array $params = array()])
 void addNode (string $id, string $parent, string $label, [string $indent = null], [boolean $expanded = true], [array $params = array()], [array $extra_right = array()], [array $extra_left = array()])
 void addNodeExtra (mixed $id, integer $side, array $extra)
 void addNodeParams (string $id, [array $params = array()])
 string fallback ( $renderer)
 mixed getOption (string $option, [boolean $html = false], [string $default = null])
 boolean isExpanded (mixed $id)
 void renderTree ([boolean $static = false])
 void setHeader (array $header)
 void setOption ( $options, [ $value = null], mixed $option, mixed $val)
 void sort (string $criteria, [integer $id = -1])
 void _buildIndents ( $nodes, [ $indent = 0])
Variables
integer $_extra_cols_left = 0 (line 72)

Keep count of how many extra columns there are on the left side of the node.

integer $_extra_cols_right = 0 (line 80)

Keep count of how many extra columns there are on the right side of the node.

array $_header = array() (line 50)

Hash with header information.

string $_instance = null (line 43)

The name of this instance.

array $_nodes = array() (line 57)

An array containing all the tree nodes.


Redefined in descendants as:
array $_options = array('lines' => true) (line 87)

Option values.

array $_root_nodes = array() (line 64)

The top-level nodes in the tree.

string $_sortCriteria (line 94)

Stores the sorting criteria temporarily.

boolean $_static = false (line 108)

Should the tree be rendered statically?

boolean $_usesession = true (line 101)

Use session to store cached Tree data?

Methods
static factory (line 162)

Attempts to return a concrete Horde_Tree instance.

  • return: The newly created concrete Horde_Tree instance, or PEAR_Error on error.
static Horde_Tree &factory (string $name, mixed $renderer, [array $params = array()])
  • string $name: The name of this tree instance.
  • mixed $renderer: The type of concrete Horde_Tree subclass to return. This is based on the rendering driver ($renderer). The code is dynamically included.
  • array $params: Any additional parameters the constructor needs.
static singleton (line 128)

Attempts to return a reference to a concrete Horde_Tree instance based on $name and $renderer. It will only create a new instance if no Horde_Tree instance with the same parameters currently exists.

This method must be invoked as: $var = &Horde_Tree::singleton($name[, $renderer]);

  • return: The concrete Horde_Tree reference, or PEAR_Error on error.
static Horde_Tree &singleton (mixed $name, string $renderer, [array $params = array()])
  • mixed $name: @see Horde_Tree::factory.
  • string $renderer: @see Horde_Tree::factory.
  • array $params: @see Horde_Tree::factory.
Constructor Horde_Tree (line 205)

Constructor.

Horde_Tree Horde_Tree (string $name, [array $params = array()])
  • string $name: The name of this tree instance.
  • array $params: Additional parameters.
     'nosession'  --  (boolean) If true, do not store tree data in session.
addNode (line 304)

Adds a node to the node tree array.

void addNode (string $id, string $parent, string $label, [string $indent = null], [boolean $expanded = true], [array $params = array()], [array $extra_right = array()], [array $extra_left = array()])
  • string $id: The unique node id.
  • string $parent: The parent's unique node id.
  • string $label: The text label for the node.
  • string $indent: Deprecated, this is calculated automatically based on the parent node.
  • boolean $expanded: Is this level expanded or not.
  • array $params: Any other parameters to set (@see addNodeParams() for full details).
  • array $extra_right: Any other columns to display to the right of the tree.
  • array $extra_left: Any other columns to display to the left of the tree.
addNodeExtra (line 405)

Adds extra columns to be displayed to the side of the node.

void addNodeExtra (mixed $id, integer $side, array $extra)
  • mixed $id: The unique node id.
  • integer $side: Which side to place the extra columns on.
  • array $extra: Extra columns to display.
addNodeParams (line 379)

Adds additional parameters to a node.

void addNodeParams (string $id, [array $params = array()])
  • string $id: The unique node id.
  • array $params: Any other parameters to set.
     class     --  CSS class to use with this node
     icon      --  Icon to display next node
     iconalt   --  Alt text to use for the icon
     icondir   --  Icon directory
     iconopen  --  Icon to indicate this node as expanded
     onclick   --  Onclick event attached to this node
     url       --  URL to link the node to
     urlclass  --  CSS class for the node's URL
     title     --  Link tooltip title
     target    --  Target for the 'url' link

Redefined in descendants as:
fallback (line 185)

Try to fall back to a simpler renderer.

  • return: | PEAR_Error The next best renderer, or an error if we've run out of renderers.
string fallback ( $renderer)
  • $renderer
getOption (line 267)

Gets an option's value.

  • return: The option's value.
mixed getOption (string $option, [boolean $html = false], [string $default = null])
  • string $option: The name of the option to fetch.
  • boolean $html: True or false whether to format the return value in html. Defaults to false.
  • string $default: A default value to use in case none is set for the requested option.
isExpanded (line 478)

Returns whether the specified node is currently expanded.

  • return: True if the specified node is expanded.
boolean isExpanded (mixed $id)
  • mixed $id: The unique node id.
renderTree (line 225)

Renders the tree.

void renderTree ([boolean $static = false])
  • boolean $static: If true the tree nodes can't be expanded and collapsed and the tree gets rendered expanded.
setHeader (line 498)

Adds column headers to the tree table.

void setHeader (array $header)
  • array $header: An array containing hashes with header information. The following keys are allowed:
     html  -- The HTML content of the header cell
     width -- The width of the header cell
     align -- The alignment inside the header cell
     class -- The CSS class of the header cell
setOption (line 245)

Sets an option.

Available options:

   alternate    --  Alternate shading in the table? (boolean)
   hideHeaders  --  Don't render any HTML for the header row, just use the widths.
   class        --  The class to use for the table. (string)
   lines        --  Show tree lines? (boolean)
   multiline    --  Do the node labels contain linebreaks? (boolean)

void setOption ( $options, [ $value = null], mixed $option, mixed $val)
  • mixed $option: The option name -or- an array of option name/value pairs.
  • mixed $val: The option's value.
  • $options
  • $value
sort (line 436)

Sorts the tree by the specified node property.

void sort (string $criteria, [integer $id = -1])
  • string $criteria: The node property to sort by.
  • integer $id: Used internally for recursion.
_buildIndents (line 506)

Set the indent level for each node in the tree.

void _buildIndents ( $nodes, [ $indent = 0])
  • $nodes
  • $indent

Documentation generated on Sun, 30 Jan 2011 05:22:57 +0000 by phpDocumentor 1.4.3