The Horde_Tree_Base:: class provides the abstract interface that all
drivers must derive from.
Copyright 2010-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
Methods summary
public
|
#
__construct( string $name, array $params = array() )
Constructor.
Parameters
- $name
- The name of this tree instance.
- $params
- Additional parameters.
<pre>session - (<span class="php-keyword1">array</span>) Callbacks used to store session data. Must <span class="php-keyword2">define</span>
two keys: <span class="php-quote">'get'</span> <span class="php-keyword1">and</span> <span class="php-quote">'set'</span>. <span class="php-keyword1">Function</span> definitions:
(string) = get([string - Instance], [string - ID]);
set([string - Instance], [string - ID], [boolean - value]);
<span class="php-keyword1">DEFAULT</span>: No session storage</pre>
|
public
string
|
#
fallback( )
Provide a simpler renderer to fallback to.
Provide a simpler renderer to fallback to.
Returns
string The next best renderer.
Throws
|
abstract public
string
|
#
getTree( boolean $static = false )
Returns the tree.
Parameters
- $static
- <p>If true the tree nodes can't be expanded and
collapsed and the tree gets rendered expanded.</p>
Returns
string The HTML code of the rendered tree.
|
public
|
#
renderTree( boolean $static = false )
Renders the tree.
Parameters
- $static
- <p>If true the tree nodes can't be expanded and
collapsed and the tree gets rendered expanded.</p>
|
public
|
#
setOption( mixed $options, mixed $value = null )
Sets an option.
Parameters
- $options
- <p>$option The option name -or- an array of option
name/value pairs. See constructor for available
options.</p>
- $value
- The option's value.
|
public
mixed
|
#
getOption( string $option )
Gets an option's value.
Parameters
- $option
- The name of the option to fetch.
Returns
mixed The option's value.
|
public
|
#
addNode( string $id, string $parent, string $label, string $indent = null, boolean $expanded = true, array $params = array(), array $extra_right = array(), array $extra_left = array() )
Adds a node to the node tree array.
Adds a node to the node tree array.
Parameters
- $id
- The unique node id.
- $parent
- The parent's unique node id.
- $label
- The text label for the node.
- $indent
- <p>Deprecated, this is calculated automatically
based on the parent node.</p>
- $expanded
- Is this level expanded or not.
- $params
- <p>Any other parameters to set (@see
self::addNodeParams() for full details).</p>
- $extra_right
- <p>Any other columns to display to the right of
the tree.</p>
- $extra_left
- <p>Any other columns to display to the left of
the tree.</p>
|
public
|
#
addNodeParams( string $id, array $params = array() )
Adds additional parameters to a node.
Adds additional parameters to a node.
Parameters
- $id
- The unique node id.
- $params
- Parameters to set (key/value pairs).
|
public
|
#
sort( string $criteria, integer $id = -1 )
Sorts the tree by the specified node property.
Sorts the tree by the specified node property.
Parameters
- $criteria
- The node property to sort by.
- $id
- Used internally for recursion.
|
public
|
#
sortHelper( mixed $a, mixed $b )
Helper method for sort() to compare two tree elements.
Helper method for sort() to compare two tree elements.
|
public
boolean
|
#
isExpanded( mixed $id )
Returns whether the specified node is currently expanded.
Returns whether the specified node is currently expanded.
Parameters
Returns
boolean True if the specified node is expanded.
|
public
boolean
|
#
isSupported( )
Check the current environment to see if we can render the tree.
Check the current environment to see if we can render the tree.
Returns
boolean Whether or not this backend will function.
|
public
|
#
count( )
Implementation of
Countable::count()
|