Exemple #1
0
 /**
  * Creates a flat list node items.
  *
  * @param \Aimeos\MW\Tree\Node\Iface $node Root node
  * @return Associated list of ID / node object pairs
  */
 protected function getNodeMap(\Aimeos\MW\Tree\Node\Iface $node)
 {
     $map = array();
     $map[(string) $node->getId()] = $node;
     foreach ($node->getChildren() as $child) {
         $map += $this->getNodeMap($child);
     }
     return $map;
 }
Exemple #2
0
 /**
  * Tests if the first node is a child of the second node.
  *
  * @param \Aimeos\MW\Tree\Node\Iface $node Node to test
  * @param \Aimeos\MW\Tree\Node\Iface $parent Parent node
  * @return boolean True if not is a child of the second node, false if not
  */
 protected function isChild(\Aimeos\MW\Tree\Node\Iface $node, \Aimeos\MW\Tree\Node\Iface $parent)
 {
     return $node->__get('left') > $parent->__get('left') && $node->__get('right') < $parent->__get('right');
 }