Documentation

Horde_Tree_Renderer_Html extends Horde_Tree_Renderer_Base
in package

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.

Tags
author

Marko Djukic marko@oblo.com

author

Jan Schneider jan@horde.org

category

Horde

license

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

Table of Contents

$_altCount  : int
Current value of the alt tag count.
$_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.
$_dropline  : array<string|int, mixed>
Drop line cache.
$_extra  : array<string|int, mixed>
An array containing extra columns for the tree nodes.
$_header  : array<string|int, mixed>
Hash with header information.
$_images  : array<string|int, mixed>
Images array.
$_node_pos  : array<string|int, mixed>
Node position list.
$_nodes  : array<string|int, mixed>
An array containing all the tree nodes.
$_options  : array<string|int, mixed>
Option values.
$_root_nodes  : array<string|int, mixed>
Unsure if using this variable is actually a mistake and _nodes should be used instead.
$_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.
_addColumn()  : mixed
_buildHeader()  : string
Returns the HTML code for a header row, if necessary.
_buildLine()  : string
Function to create a single line of the tree.
_buildTree()  : string
Recursive function to walk through the tree array and build the output.
_generateImage()  : string
Generate the icon image.
_generateUrlTag()  : string
Generate a link URL.
_setLabel()  : string
Sets the label on the tree line.
_setNodeIcon()  : string
Sets the icon for the node.
_setNodeToggle()  : string
Sets the node toggle on the tree line.

Properties

$_altCount

Current value of the alt tag count.

protected int $_altCount = 0

$_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

$_dropline

Drop line cache.

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

$_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()

$_images

Images array.

protected array<string|int, mixed> $_images = array('line' => \null, 'blank' => \null, 'join' => \null, 'join_bottom' => \null, 'join_top' => \null, 'plus' => \null, 'plus_bottom' => \null, 'plus_only' => \null, 'minus' => \null, 'minus_bottom' => \null, 'minus_only' => \null, 'null_only' => \null, 'folder' => \null, 'folderopen' => \null, 'leaf' => \null)

$_node_pos

Node position list.

protected array<string|int, mixed> $_node_pos = 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)

$_root_nodes

Unsure if using this variable is actually a mistake and _nodes should be used instead.

protected array<string|int, mixed> $_root_nodes = []

$_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

The name of this tree instance.

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

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

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. The following keys are allowed:

class - The CSS class of the header cell
html - The HTML content of the header cell
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

_addColumn()

protected _addColumn(mixed $column) : mixed
Parameters
$column : mixed
Return values
mixed

_buildHeader()

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

protected _buildHeader() : string
Return values
string

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

_buildLine()

Function to create a single line of the tree.

protected _buildLine(string $node_id) : string
Parameters
$node_id : string

The Node ID.

Return values
string

The rendered line.

_buildTree()

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

protected _buildTree(string $node_id) : string
Parameters
$node_id : string

The Node ID.

Return values
string

The tree rendering.

_generateImage()

Generate the icon image.

protected _generateImage(string $src[, string $class = '' ][, string $alt = null ]) : string
Parameters
$src : string

The source image.

$class : string = ''

Additional class to add to image.

$alt : string = null

Alt text to add to the image.

Return values
string

A HTML tag to display the image.

_generateUrlTag()

Generate a link URL.

protected _generateUrlTag(string $node_id) : string
Parameters
$node_id : string

The node ID.

Return values
string

The link tag.

_setLabel()

Sets the label on the tree line.

protected _setLabel(string $node_id) : string
Parameters
$node_id : string

The Node ID.

Return values
string

The label for the tree line.

_setNodeIcon()

Sets the icon for the node.

protected _setNodeIcon(string $node_id) : string
Parameters
$node_id : string

The Node ID.

Return values
string

The node icon for the tree line.

_setNodeToggle()

Sets the node toggle on the tree line.

protected _setNodeToggle(string $node_id) : string
Parameters
$node_id : string

The Node ID.

Return values
string

The node toggle for the tree line.

Search results