Documentation

Horde_Tree_Renderer_Base
in package

The Horde_Tree_Renderer_Base class provides the abstract interface that all drivers must derive from.

Copyright 2010-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Tags
author

Michael Slusarz slusarz@horde.org

author

Jan Schneider jan@horde.org

category

Horde

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

$_colsLeft  : int
Keep count of how many extra columns there are on the left side of the node.
$_colsRight  : int
Keep count of how many extra columns there are on the right side of the node.
$_extra  : array<string|int, mixed>
An array containing extra columns for the tree nodes.
$_header  : array<string|int, mixed>
Hash with header information.
$_nodes  : array<string|int, mixed>
An array containing all the tree nodes.
$_options  : array<string|int, mixed>
Option values.
$_sortCriteria  : string
Stores the sorting criteria temporarily.
$_static  : bool
Should the tree be rendered statically?
$_tree  : Horde_Tree
The tree object.
__construct()  : mixed
Constructor.
addNode()  : mixed
Adds a node to the node tree array.
addNodeExtra()  : mixed
Adds extra columns to be displayed to the side of the node.
addNodeParams()  : mixed
Adds additional parameters to a node.
fallback()  : string
Provide a simpler renderer to fallback to.
getOption()  : mixed
Gets an option's value.
getTree()  : string
Returns the tree.
isSupported()  : bool
Check the current environment to see if we can render the tree.
renderTree()  : mixed
Renders the tree.
setHeader()  : mixed
Adds column headers to the tree table.
setOption()  : mixed
Sets an option.
sort()  : mixed
Sorts the tree by the specified node property.
_buildTree()  : string
Recursive function to walk through the tree array and build the output.

Properties

$_colsLeft

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

protected int $_colsLeft = 0

$_colsRight

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

protected int $_colsRight = 0

$_extra

An array containing extra columns for the tree nodes.

protected array<string|int, mixed> $_extra = array()

$_header

Hash with header information.

protected array<string|int, mixed> $_header = array()

$_nodes

An array containing all the tree nodes.

protected array<string|int, mixed> $_nodes = array()

$_options

Option values.

protected array<string|int, mixed> $_options = array('lines' => \true)

$_sortCriteria

Stores the sorting criteria temporarily.

protected string $_sortCriteria

$_static

Should the tree be rendered statically?

protected bool $_static = \false

Methods

__construct()

Constructor.

public __construct(Horde_Tree $tree[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$tree : Horde_Tree

A tree object.

$params : array<string|int, mixed> = array()

Additional parameters.

Return values
mixed

addNode()

Adds a node to the node tree array.

public addNode(array<string|int, mixed> $node) : mixed
Parameters
$node : array<string|int, mixed>

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).
Return values
mixed

addNodeExtra()

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

public addNodeExtra(mixed $id, int $side, array<string|int, mixed> $extra) : mixed
Parameters
$id : mixed

The unique node id.

$side : int

Which side to place the extra columns on.

$extra : array<string|int, mixed>

Extra columns to display.

Return values
mixed

addNodeParams()

Adds additional parameters to a node.

public addNodeParams(string $id[, array<string|int, mixed> $params = array() ]) : mixed
Parameters
$id : string

The unique node id.

$params : array<string|int, mixed> = array()

Parameters to set (key/value pairs).

Return values
mixed

fallback()

Provide a simpler renderer to fallback to.

public fallback() : string
Tags
throws
Horde_Tree_Exception
Return values
string

The next best renderer.

getOption()

Gets an option's value.

public getOption(string $option) : mixed
Parameters
$option : string

The name of the option to fetch.

Return values
mixed

The option's value.

getTree()

Returns the tree.

public getTree([bool $static = false ]) : string
Parameters
$static : bool = false

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 values
string

The HTML code of the rendered tree.

isSupported()

Check the current environment to see if we can render the tree.

public isSupported() : bool
Return values
bool

Whether or not this backend will function.

renderTree()

Renders the tree.

public renderTree([bool $static = false ]) : mixed
Parameters
$static : bool = false

If true the tree nodes can't be expanded and collapsed and the tree gets rendered expanded.

Return values
mixed

setHeader()

Adds column headers to the tree table.

public setHeader(array<string|int, mixed> $header) : mixed
Parameters
$header : array<string|int, mixed>

An array containing hashes with header information.

Return values
mixed

setOption()

Sets an option.

public setOption(string|array<string|int, mixed> $options[, mixed $value = null ]) : mixed
Parameters
$options : string|array<string|int, mixed>

The option name -or- an array of option name/value pairs. See constructor for available options.

$value : mixed = null

The option's value.

Return values
mixed

sort()

Sorts the tree by the specified node property.

public sort(string $criteria) : mixed
Parameters
$criteria : string

The node property to sort by.

Return values
mixed

_buildTree()

Recursive function to walk through the tree array and build the output.

protected _buildTree(string $id) : string

Should be overwritten by a sub-class if it doesn't implement its own getTree() method.

Parameters
$id : string

The Node ID.

Return values
string

The tree rendering.

Search results