PHP Class Horde_Tree_Renderer_Base, horde

Copyright 2010-2016 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.
Author: Michael Slusarz ([email protected])
Author: Jan Schneider ([email protected])
Exibir arquivo Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_colsLeft integer Keep count of how many extra columns there are on the left side of the node.
$_colsRight integer Keep count of how many extra columns there are on the right side of the node.
$_extra array An array containing extra columns for the tree nodes.
$_header array Hash with header information.
$_nodes array An array containing all the tree nodes.
$_options array Option values.
$_sortCriteria string Stores the sorting criteria temporarily.
$_static boolean Should the tree be rendered statically?
$_tree Horde_Tree The tree object.

Public Methods

Method Description
__construct ( Horde_Tree $tree, array $params = [] ) Constructor.
addNode ( array $node ) Adds a node to the node tree array.
addNodeExtra ( mixed $id, integer $side, array $extra ) Adds extra columns to be displayed to the side of the node.
addNodeParams ( string $id, array $params = [] ) Adds additional parameters to a node.
fallback ( ) : string Provide a simpler renderer to fallback to.
getOption ( string $option ) : mixed Gets an option's value.
getTree ( boolean $static = false ) : string Returns the tree.
isSupported ( ) : boolean Check the current environment to see if we can render the tree.
renderTree ( boolean $static = false ) Renders the tree.
setHeader ( array $header ) Adds column headers to the tree table.
setOption ( $options, mixed $value = null ) Sets an option.
sort ( string $criteria ) Sorts the tree by the specified node property.

Protected Methods

Method Description
_buildTree ( $id ) : string Recursive function to walk through the tree array and build the output.

Method Details

__construct() public method

Constructor.
public __construct ( Horde_Tree $tree, array $params = [] )
$tree Horde_Tree A tree object.
$params array Additional parameters.

_buildTree() protected method

Should be overwritten by a sub-class if it doesn't implement its own getTree() method.
protected _buildTree ( $id ) : string
return string The tree rendering.

addNode() public method

Adds a node to the node tree array.
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).

addNodeExtra() public method

Adds extra columns to be displayed to the side of the node.
public addNodeExtra ( mixed $id, integer $side, array $extra )
$id mixed The unique node id.
$side integer Which side to place the extra columns on.
$extra array Extra columns to display.

addNodeParams() public method

Adds additional parameters to a node.
public addNodeParams ( string $id, array $params = [] )
$id string The unique node id.
$params array Parameters to set (key/value pairs).

fallback() public method

Provide a simpler renderer to fallback to.
public fallback ( ) : string
return string The next best renderer.

getOption() public method

Gets an option's value.
public getOption ( string $option ) : mixed
$option string The name of the option to fetch.
return mixed The option's value.

getTree() public method

Returns the tree.
public getTree ( boolean $static = false ) : string
$static boolean If true the tree nodes can't be expanded and collapsed and the tree gets rendered expanded. This option has no effect in this driver.
return string The HTML code of the rendered tree.

isSupported() public method

Check the current environment to see if we can render the tree.
public isSupported ( ) : boolean
return boolean Whether or not this backend will function.

renderTree() public method

Renders the tree.
public renderTree ( boolean $static = false )
$static boolean If true the tree nodes can't be expanded and collapsed and the tree gets rendered expanded.

setHeader() public method

Adds column headers to the tree table.
public setHeader ( array $header )
$header array An array containing hashes with header information.

setOption() public method

Sets an option.
public setOption ( $options, mixed $value = null )
$value mixed The option's value.

sort() public method

Sorts the tree by the specified node property.
public sort ( string $criteria )
$criteria string The node property to sort by.

Property Details

$_colsLeft protected_oe property

Keep count of how many extra columns there are on the left side of the node.
protected int $_colsLeft
return integer

$_colsRight protected_oe property

Keep count of how many extra columns there are on the right side of the node.
protected int $_colsRight
return integer

$_extra protected_oe property

An array containing extra columns for the tree nodes.
protected array $_extra
return array

$_header protected_oe property

Hash with header information.
protected array $_header
return array

$_nodes protected_oe property

An array containing all the tree nodes.
protected array $_nodes
return array

$_options protected_oe property

Option values.
protected array $_options
return array

$_sortCriteria protected_oe property

Stores the sorting criteria temporarily.
protected string $_sortCriteria
return string

$_static protected_oe property

Should the tree be rendered statically?
protected bool $_static
return boolean

$_tree protected_oe property

The tree object.
protected Horde_Tree $_tree
return Horde_Tree