Ejemplo n.º 1
0
 /**
  * addUnitNode   
  * @param integer $intParentId
  * @param array $arrData
  * @author Thomas Schedler <*****@*****.**>
  * @version 1.0 
  */
 public function addUnitNode($intParentId, $arrData = array())
 {
     try {
         $intNodeId = null;
         $this->getUnitTable();
         $objNestedSet = new NestedSet($this->objUnitTable);
         $objNestedSet->setDBFParent('idParentUnit');
         $objNestedSet->setDBFRoot('idRootUnit');
         /**
          * if $intParentId == 0, this is a root unit node
          */
         if ($intParentId == 0) {
             $intNodeId = $objNestedSet->newRootNode($arrData);
         } else {
             $intNodeId = $objNestedSet->newLastChild($intParentId, $arrData);
         }
         return $intNodeId;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }