Varien_Data_Tree Class Reference

Inheritance diagram for Varien_Data_Tree:

Varien_Data_Tree_Db Varien_Data_Tree_Dbp Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree

List of all members.

Public Member Functions

 __construct ()
 getTree ()
 load ($parentNode=null)
 loadNode ($nodeId)
 appendChild ($data=array(), $parentNode, $prevNode=null)
 addNode ($node, $parent=null)
 moveNodeTo ($node, $parentNode, $prevNode=null)
 copyNodeTo ($node, $parentNode, $prevNode=null)
 removeNode ($node)
 createNode ($parentNode, $prevNode=null)
 getChild ($node)
 getChildren ($node)
 getNodes ()
 getNodeById ($nodeId)
 getPath ($node)

Protected Attributes

 $_nodes


Detailed Description

Definition at line 35 of file Tree.php.


Constructor & Destructor Documentation

__construct (  ) 

Enter description here...

Reimplemented in Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Tree.

Definition at line 49 of file Tree.php.

00050     {
00051         $this->_nodes = new Varien_Data_Tree_Node_Collection($this);
00052     }


Member Function Documentation

addNode ( node,
parent = null 
)

Enter description here...

Parameters:
Varien_Data_Tree_Node $node
Varien_Data_Tree_Node $parent
Returns:
Varien_Data_Tree_Node

Definition at line 110 of file Tree.php.

00111     {
00112         $this->_nodes->add($node);
00113         $node->setParent($parent);
00114         if (!is_null($parent) && ($parent instanceof Varien_Data_Tree_Node) ) {
00115             $parent->addChild($node);
00116         }
00117         return $node;
00118     }

appendChild ( data = array(),
parentNode,
prevNode = null 
)

Enter description here...

Parameters:
array|Varien_Data_Tree_Node $data
Varien_Data_Tree_Node $parentNode
Varien_Data_Tree_Node $prevNode
Returns:
Varien_Data_Tree_Node

Reimplemented in Varien_Data_Tree_Db.

Definition at line 90 of file Tree.php.

00091     {
00092         if (is_array($data)) {
00093             $node = $this->addNode(
00094                 new Varien_Data_Tree_Node($data, $parentNode->getIdField(), $this),
00095                 $parentNode
00096             );
00097         } elseif ($data instanceof Varien_Data_Tree_Node) {
00098             $node = $this->addNode($data, $parentNode);
00099         }
00100         return $node;
00101     }

copyNodeTo ( node,
parentNode,
prevNode = null 
)

Enter description here...

Parameters:
Varien_Data_Tree_Node $node
Varien_Data_Tree_Node $parentNode
Varien_Data_Tree_Node $prevNode

Definition at line 138 of file Tree.php.

00139     {
00140     }

createNode ( parentNode,
prevNode = null 
)

Enter description here...

Parameters:
Varien_Data_Tree_Node $parentNode
Varien_Data_Tree_Node $prevNode

Definition at line 164 of file Tree.php.

00165     {
00166     }

getChild ( node  ) 

Enter description here...

Parameters:
Varien_Data_Tree_Node $node

Definition at line 173 of file Tree.php.

00174     {
00175     }

getChildren ( node  ) 

Enter description here...

Parameters:
Varien_Data_Tree_Node $node

Definition at line 182 of file Tree.php.

00183     {
00184     }

getNodeById ( nodeId  ) 

Enter description here...

Parameters:
unknown_type $nodeId
Returns:
Varien_Data_Tree_Node

Definition at line 202 of file Tree.php.

00203     {
00204         return $this->_nodes->searchById($nodeId);
00205     }

getNodes (  ) 

Enter description here...

Returns:
Varien_Data_Tree_Node_Collection

Definition at line 191 of file Tree.php.

00192     {
00193         return $this->_nodes;
00194     }

getPath ( node  ) 

Enter description here...

Parameters:
Varien_Data_Tree_Node $node
Returns:
array

Definition at line 213 of file Tree.php.

00214     {
00215         if ($node instanceof Varien_Data_Tree_Node ) {
00216 
00217         } elseif (is_numeric($node)){
00218             if ($_node = $this->getNodeById($node)) {
00219                 return $_node->getPath();
00220             }
00221         }
00222         return array();
00223     }

getTree (  ) 

Enter description here...

Returns:
Varien_Data_Tree

Definition at line 59 of file Tree.php.

00060     {
00061         return $this;
00062     }

load ( parentNode = null  ) 

Enter description here...

Parameters:
Varien_Data_Tree_Node $parentNode

Definition at line 69 of file Tree.php.

00070     {
00071     }

loadNode ( nodeId  ) 

Enter description here...

Parameters:
unknown_type $nodeId

Reimplemented in Varien_Data_Tree_Db, and Varien_Data_Tree_Dbp.

Definition at line 78 of file Tree.php.

00079     {
00080     }

moveNodeTo ( node,
parentNode,
prevNode = null 
)

Enter description here...

Parameters:
Varien_Data_Tree_Node $node
Varien_Data_Tree_Node $parentNode
Varien_Data_Tree_Node $prevNode

Reimplemented in Varien_Data_Tree_Db.

Definition at line 127 of file Tree.php.

00128     {
00129     }

removeNode ( node  ) 

Enter description here...

Parameters:
Varien_Data_Tree_Node $node
Returns:
Varien_Data_Tree

Reimplemented in Varien_Data_Tree_Db.

Definition at line 148 of file Tree.php.

00149     {
00150         $this->_nodes->delete($node);
00151         if ($node->getParent()) {
00152             $node->getParent()->removeChild($node);
00153         }
00154         unset($node);
00155         return $this;
00156     }


Member Data Documentation

$_nodes [protected]

Definition at line 43 of file Tree.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