Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcTreeNodeList

Tree::ezcTreeNodeList

Class ezcTreeNodeList

ezcTreeNodeList represents a lists of nodes.

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->addNode( new ezcTreeNode( $tree, 'Leo' ) );
  5.      $list->addNode( new 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.  ?>

Source for this file: /Tree/src/tree_node_list.php

Implements interfaces:

  • ArrayAccess (internal interface)
Version:   //autogentag//

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.

Documentation generated by phpDocumentor 1.4.3