\Horde_Tree_Renderer_Html

The Horde_Tree_Renderer_Html class provides HTML specific rendering functions.

Additional node parameters:

  • class: CSS class to use with this node
  • icon: Icon to display next node
  • iconalt: Alt text to use for the icon
  • iconopen: Icon to indicate this node as expanded
  • url: URL to link the node to
  • urlclass: CSS class for the node's URL
  • target: Target for the 'url' link
  • title: Link tooltip title

Copyright 2003-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.

Summary

Methods
Properties
Constants
__construct()
fallback()
getTree()
renderTree()
setOption()
getOption()
addNode()
addNodeParams()
addNodeExtra()
setHeader()
sort()
isSupported()
No public properties found
No constants found
_buildTree()
_buildHeader()
_buildLine()
_addColumn()
_setLabel()
_setNodeToggle()
_generateUrlTag()
_generateImage()
_setNodeIcon()
$_tree
$_header
$_nodes
$_extra
$_colsLeft
$_colsRight
$_options
$_sortCriteria
$_static
$_node_pos
$_dropline
$_altCount
$_images
N/A
No private methods found
No private properties found
N/A

Properties

$_tree

$_tree : \Horde_Tree

The tree object.

Type

\Horde_Tree

$_header

$_header : array

Hash with header information.

Type

array

$_nodes

$_nodes : array

An array containing all the tree nodes.

Type

array

$_extra

$_extra : array

An array containing extra columns for the tree nodes.

Type

array

$_colsLeft

$_colsLeft : integer

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

Type

integer

$_colsRight

$_colsRight : integer

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

Type

integer

$_options

$_options : array

Option values.

Type

array

$_sortCriteria

$_sortCriteria : string

Stores the sorting criteria temporarily.

Type

string

$_static

$_static : boolean

Should the tree be rendered statically?

Type

boolean

$_node_pos

$_node_pos : array

Node position list.

Type

array

$_dropline

$_dropline : array

Drop line cache.

Type

array

$_altCount

$_altCount : integer

Current value of the alt tag count.

Type

integer

$_images

$_images : array

Images array.

Type

array

Methods

__construct()

__construct(string  $name, array  $params = array()) 

Constructor.

Parameters

string $name

The name of this tree instance.

array $params

Additional parameters:

alternate - (boolean) Alternate shading in the table?
            DEFAULT: false
class - (string) The class to use for the table.
        DEFAULT: ''
hideHeaders - (boolean) Don't render any HTML for the header row, just
              use the widths.
              DEFAULT: false
lines - (boolean) Show tree lines?
        DEFAULT: true
lines_base - (boolean) Show tree lines for the base level? Requires
             'lines' to be true also.
             DEFAULT: false
multiline - (boolean) Do the node labels contain linebreaks?
            DEFAULT: false

fallback()

fallback() : string

Provide a simpler renderer to fallback to.

Throws

\Horde_Tree_Exception

Returns

string —

The next best renderer.

getTree()

getTree(boolean  $static = false) : string

Returns the tree.

Parameters

boolean $static

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

Returns

string —

The HTML code of the rendered tree.

renderTree()

renderTree(boolean  $static = false) 

Renders the tree.

Parameters

boolean $static

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

setOption()

setOption(  $options, mixed  $value = null) 

Sets an option.

Parameters

$options
mixed $value

The option's value.

getOption()

getOption(string  $option) : mixed

Gets an option's value.

Parameters

string $option

The name of the option to fetch.

Returns

mixed —

The option's value.

addNode()

addNode(array  $node) 

Adds a node to the node tree array.

Parameters

array $node

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).

addNodeParams()

addNodeParams(string  $id, array  $params = array()) 

Adds additional parameters to a node.

Parameters

string $id

The unique node id.

array $params

Parameters to set (key/value pairs).

addNodeExtra()

addNodeExtra(mixed  $id, integer  $side, array  $extra) 

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

Parameters

mixed $id

The unique node id.

integer $side

Which side to place the extra columns on.

array $extra

Extra columns to display.

setHeader()

setHeader(array  $header) 

Adds column headers to the tree table.

Parameters

array $header

An array containing hashes with header information. The following keys are allowed:

class - The CSS class of the header cell
html - The HTML content of the header cell

sort()

sort(string  $criteria) 

Sorts the tree by the specified node property.

Parameters

string $criteria

The node property to sort by.

isSupported()

isSupported() : boolean

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

Returns

boolean —

Whether or not this backend will function.

_buildTree()

_buildTree(string  $node_id) : string

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

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

Parameters

string $node_id

The Node ID.

Returns

string —

The tree rendering.

_buildHeader()

_buildHeader() : string

Returns the HTML code for a header row, if necessary.

Returns

string —

The HTML code of the header row or an empty string.

_buildLine()

_buildLine(string  $node_id) : string

Function to create a single line of the tree.

Parameters

string $node_id

The Node ID.

Returns

string —

The rendered line.

_addColumn()

_addColumn(  $column) 

Parameters

$column

_setLabel()

_setLabel(string  $node_id) : string

Sets the label on the tree line.

Parameters

string $node_id

The Node ID.

Returns

string —

The label for the tree line.

_setNodeToggle()

_setNodeToggle(string  $node_id) : string

Sets the node toggle on the tree line.

Parameters

string $node_id

The Node ID.

Returns

string —

The node toggle for the tree line.

_generateUrlTag()

_generateUrlTag(string  $node_id) : string

Generate a link URL.

Parameters

string $node_id

The node ID.

Returns

string —

The link tag.

_generateImage()

_generateImage(string  $src, string  $class = '', string  $alt = null) : string

Generate the icon image.

Parameters

string $src

The source image.

string $class

Additional class to add to image.

string $alt

Alt text to add to the image.

Returns

string —

A HTML tag to display the image.

_setNodeIcon()

_setNodeIcon(string  $node_id) : string

Sets the icon for the node.

Parameters

string $node_id

The Node ID.

Returns

string —

The node icon for the tree line.