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 before node identified by $beforeId
  *
  * @param int $id
  * @param int $beforeId
  * @return bool
  * @throws Axis_NSTree_Exception
  */
 public function replaceBefore($id, $beforeId)
 {
     $this->_table->replaceBefore($id, $beforeId);
 }