Path

ez components / documentation / api reference / 2009.2.1 / tree


eZ Components 2009.2.1

Tree: ezcTreeNodeList

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcTreeNodeList

ezcTreeNodeList represents a lists of nodes. [source]

Implemented Interfaces

  • ArrayAccess (internal interface)

The nodes in the list can be accessed through an array as this class implements the ArrayAccess SPL interface. The array is indexed based on the the node's ID.
Example:
 1.  <?php
 2.      // Create a list with two elements
 3.      $list new ezcTreeNodeList;
 4.      $list->addNodenew ezcTreeNode$tree'Leo' ) );
 5.      $list->addNodenew ezcTreeNode$tree'Virgo' ) );
 6.  
 7.      // Retrieve the list's size
 8.      echo $list->size"\n"// prints 2
 9.  
10.      // Find a node in the list
11.      $node $list['Virgo'];
12.  
13.      // Add nodes in an alternative way
14.      $list['Libra'new ezcTreeNode$tree'Libra' );
15.  
16.      // Remove a node from the list
17.      unset$list['Leo');
18.  
19.      // Checking if a node exists
20.      if isset$list['Scorpius') )
21.      {
22.          // do something if it exists
23.      }
24.  
25.      // Use the associated data store to fetch the data for all nodes at once
26.      $list->fetchDataForNodes();
27.  ?>

Properties

array(string=>ezcTreeNode) read  $nodes
The nodes belonging to this list.
string read  $size
The number of nodes in the list.

Method Summary

public ezcTreeNodeList __construct( )
Constructs a new ezcTreeNodeList object.
public void addNode( $node )
Adds the node $node to the list.
public void fetchDataForNodes( )
Fetches data for all nodes in the node list.

Methods

__construct

ezcTreeNodeList __construct( )
Constructs a new ezcTreeNodeList object.

addNode

void addNode( ezcTreeNode $node )
Adds the node $node to the list.

Parameters

Name Type Description
$node ezcTreeNode  

fetchDataForNodes

void fetchDataForNodes( )
Fetches data for all nodes in the node list.

Last updated: Tue, 23 Mar 2010