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