Varien_Data_Tree_Node Class Reference

Inheritance diagram for Varien_Data_Tree_Node:

Varien_Object

List of all members.

Public Member Functions

 __construct ($data, $idFeild, $tree, $parent=null)
 getId ()
 setIdField ($idField)
 getIdField ()
 setTree (Varien_Data_Tree $tree)
 getTree ()
 setParent ($parent)
 getParent ()
 hasChildren ()
 setLevel ($level)
 setPathId ($path)
 isChildOf ($node)
 loadChildren ($recursionLevel=0)
 getChildren ()
 getAllChildNodes (&$nodes=array())
 getLastChild ()
 addChild ($node)
 appendChild ($prevNode=null)
 moveTo ($parentNode, $prevNode=null)
 copyTo ($parentNode, $prevNode=null)
 removeChild ($childNode)
 getPath (&$prevNodes=array())
 getIsActive ()
 getName ()

Protected Attributes

 $_parent
 $_tree
 $_childNodes
 $_idField


Detailed Description

Definition at line 34 of file Node.php.


Constructor & Destructor Documentation

__construct ( data,
idFeild,
tree,
parent = null 
)

Data tree node constructor

Parameters:
array $data
string $idFeild
Varien_Data_Tree $tree
Varien_Data_Tree_Node $parent

Definition at line 72 of file Node.php.

00073     {
00074         $this->setTree($tree);
00075         $this->setParent($parent);
00076         $this->setIdField($idFeild);
00077         $this->setData($data);
00078         $this->_childNodes = new Varien_Data_Tree_Node_Collection($this);
00079     }


Member Function Documentation

addChild ( node  ) 

Add child node

Parameters:
Varien_Data_Tree_Node $node
Returns:
Varien_Data_Tree_Node

Definition at line 226 of file Node.php.

00227     {
00228         $this->_childNodes->add($node);
00229         return $this;
00230     }

appendChild ( prevNode = null  ) 

Definition at line 232 of file Node.php.

00233     {
00234         $this->_tree->appendChild($this, $prevNode);
00235         return $this;
00236     }

copyTo ( parentNode,
prevNode = null 
)

Definition at line 244 of file Node.php.

00245     {
00246         $this->_tree->copyNodeTo($this, $parentNode, $prevNode);
00247         return $this;
00248     }

getAllChildNodes ( &$  nodes = array()  ) 

Definition at line 206 of file Node.php.

00207     {
00208         foreach ($this->_childNodes as $node) {
00209             $nodes[$node->getId()] = $node;
00210             $node->getAllChildNodes($nodes);
00211         }
00212         return $nodes;
00213     }

getChildren (  ) 

Retrieve node children collection

Returns:
Varien_Data_Tree_Node_Collection

Definition at line 201 of file Node.php.

00202     {
00203         return $this->_childNodes;
00204     }

getId (  ) 

Retrieve node id

Returns:
mixed

Reimplemented from Varien_Object.

Definition at line 86 of file Node.php.

00087     {
00088         return $this->getData($this->getIdField());
00089     }

getIdField (  ) 

Retrieve node id field name

Returns:
string

Definition at line 108 of file Node.php.

00109     {
00110         return $this->_idField;
00111     }

getIsActive (  ) 

Definition at line 265 of file Node.php.

00266     {
00267         return $this->_getData('is_active');
00268     }

getLastChild (  ) 

Definition at line 215 of file Node.php.

00216     {
00217         return $this->_childNodes->lastNode();
00218     }

getName (  ) 

Definition at line 270 of file Node.php.

00271     {
00272         return $this->_getData('name');
00273     }

getParent (  ) 

Retrieve node parent

Returns:
Varien_Data_Tree

Definition at line 152 of file Node.php.

00153     {
00154         return $this->_parent;
00155     }

getPath ( &$  prevNodes = array()  ) 

Definition at line 256 of file Node.php.

00257     {
00258         if ($this->_parent) {
00259             array_push($prevNodes, $this);
00260             $this->_parent->getPath($prevNodes);
00261         }
00262         return $prevNodes;
00263     }

getTree (  ) 

Retrieve node tree object

Returns:
Varien_Data_Tree

Definition at line 130 of file Node.php.

00131     {
00132         return $this->_tree;
00133     }

hasChildren (  ) 

Check node children

Returns:
bool

Definition at line 162 of file Node.php.

00163     {
00164         return $this->_childNodes->count() > 0;
00165     }

isChildOf ( node  ) 

Definition at line 179 of file Node.php.

00180     {
00181 
00182     }

loadChildren ( recursionLevel = 0  ) 

Load node children

Parameters:
int $recursionLevel
Returns:
Varien_Data_Tree_Node

Definition at line 190 of file Node.php.

00191     {
00192         $this->_tree->load($this, $recursionLevel);
00193         return $this;
00194     }

moveTo ( parentNode,
prevNode = null 
)

Definition at line 238 of file Node.php.

00239     {
00240         $this->_tree->moveNodeTo($this, $parentNode, $prevNode);
00241         return $this;
00242     }

removeChild ( childNode  ) 

Definition at line 250 of file Node.php.

00251     {
00252         $this->_childNodes->delete($childNode);
00253         return $this;
00254     }

setIdField ( idField  ) 

Set node id field name

Parameters:
string $idField
Returns:
this

Definition at line 97 of file Node.php.

00098     {
00099         $this->_idField = $idField;
00100         return $this;
00101     }

setLevel ( level  ) 

Definition at line 167 of file Node.php.

00168     {
00169         $this->setData('level', $level);
00170         return $this;
00171     }

setParent ( parent  ) 

Set node parent

Parameters:
Varien_Data_Tree_Node $parent
Returns:
Varien_Data_Tree_Node

Definition at line 141 of file Node.php.

00142     {
00143         $this->_parent = $parent;
00144         return $this;
00145     }

setPathId ( path  ) 

Definition at line 173 of file Node.php.

00174     {
00175         $this->setData('path_id', $path);
00176         return $this;
00177     }

setTree ( Varien_Data_Tree tree  ) 

Set node tree object

Parameters:
Varien_Data_Tree $tree
Returns:
this

Definition at line 119 of file Node.php.

00120     {
00121         $this->_tree = $tree;
00122         return $this;
00123     }


Member Data Documentation

$_childNodes [protected]

Definition at line 55 of file Node.php.

$_idField [protected]

Definition at line 62 of file Node.php.

$_parent [protected]

Definition at line 41 of file Node.php.

$_tree [protected]

Definition at line 48 of file Node.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:25:00 2009 for Magento by  doxygen 1.5.8