PHP 클래스 Horde_Tree, horde

Copyright 2003-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.
저자: Marko Djukic ([email protected])
저자: Michael Slusarz ([email protected])
저자: Jan Schneider ([email protected])
상속: implements Countable
파일 보기 프로젝트 열기: horde/horde 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$instance string The name of this instance.

보호된 프로퍼티들

프로퍼티 타입 설명
$_nodes array An array containing all the tree nodes.
$_root_nodes array The top-level nodes in the tree.
$_session array Callbacks used to store session data.

공개 메소드들

메소드 설명
__construct ( string $name, array $session = [] ) Constructor.
addNode ( array $node ) Adds a node to the node tree array.
addNodeParams ( string $id, array $params = [] ) Adds additional parameters to a node.
count ( ) * Countable methods.
getNodes ( ) : array Returns the nodes of the tree.
getRootNodes ( ) : array Returns the root node IDs.
isExpanded ( mixed $id ) : boolean Returns whether the specified node is currently expanded.
nodeId ( string $id ) : string Returns the escaped node ID.
sort ( string $criteria, integer $id ) Sorts the tree by the specified node property.
sortHelper ( $a, $b ) Helper method for sort() to compare two tree elements.

보호된 메소드들

메소드 설명
_buildIndents ( array $nodes, integer $indent ) Set the indent level for each node in the tree.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( string $name, array $session = [] )
$name string The name of this tree instance.
$session array Callbacks used to store session data. Must define two keys: 'get' and 'set'. Function definitions: (string) = get([string - Instance], [string - ID]); set([string - Instance], [string - ID], [boolean - value]); DEFAULT: No session storage

_buildIndents() 보호된 메소드

Set the indent level for each node in the tree.
protected _buildIndents ( array $nodes, integer $indent )
$nodes array TODO
$indent integer TODO

addNode() 공개 메소드

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

addNodeParams() 공개 메소드

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

count() 공개 메소드

* Countable methods.
public count ( )

getNodes() 공개 메소드

Returns the nodes of the tree.
public getNodes ( ) : array
리턴 array The nodes with IDs as keys and node hashes as values.

getRootNodes() 공개 메소드

Returns the root node IDs.
public getRootNodes ( ) : array
리턴 array The root nodes.

isExpanded() 공개 메소드

Returns whether the specified node is currently expanded.
public isExpanded ( mixed $id ) : boolean
$id mixed The unique node id.
리턴 boolean True if the specified node is expanded.

nodeId() 공개 메소드

Returns the escaped node ID.
public nodeId ( string $id ) : string
$id string Node ID.
리턴 string Escaped node ID.

sort() 공개 메소드

Sorts the tree by the specified node property.
public sort ( string $criteria, integer $id )
$criteria string The node property to sort by.
$id integer Used internally for recursion.

sortHelper() 공개 메소드

Helper method for sort() to compare two tree elements.
public sortHelper ( $a, $b )

프로퍼티 상세

$_nodes 보호되어 있는 프로퍼티

An array containing all the tree nodes.
protected array $_nodes
리턴 array

$_root_nodes 보호되어 있는 프로퍼티

The top-level nodes in the tree.
protected array $_root_nodes
리턴 array

$_session 보호되어 있는 프로퍼티

Callbacks used to store session data.
protected array $_session
리턴 array

$instance 공개적으로 프로퍼티

The name of this instance.
public string $instance
리턴 string