public function moveAction()
 {
     $moveType = $this->_getParam('moveType');
     $newParentId = $this->_getParam('newParentId');
     $categoryId = $this->_getParam('catId');
     $model = new Axis_NSTree_Table();
     switch ($moveType) {
         case 'moveTo':
             $success = $model->replaceNode($categoryId, $newParentId);
             break;
         case 'moveBefore':
             $success = $model->replaceBefore($categoryId, $newParentId);
             break;
     }
     if (!$success) {
         return $this->_helper->json->sendFailure();
     }
     return $this->_helper->json->sendSuccess();
 }
示例#2
0
 /**
  * Replace node to new parent
  *
  * @param int $id
  * @param int $newParentId
  * @return bool true on success
  * @throws Axis_NSTree_Exception
  */
 public function replaceNode($id, $newParentId)
 {
     $this->_table->replaceNode($id, $newParentId);
 }