/** * Move menu */ public function ajaxMoveMenuItemAction() { $idFrom = (int) $this->_getParam('idFrom'); $idTo = (int) $this->_getParam('idTo'); $idBefore = (int) $this->_getParam('idBefore'); if ($idTo == 'menu') { $idTo = 0; } $menuItem = new MenuItem(); $menuItem->menuId = $idFrom; $menuItem->populate(); if ($idBefore > 0) { //this is the sibling reorder case $beforeMenuItem = new MenuItem(); $beforeMenuItem->menuId = $idBefore; $beforeMenuItem->populate(); $menuItem->updateDisplayOrder($beforeMenuItem->displayOrder); } else { //this is the hierarchy level move case $menuItem->parentId = $idTo; $menuItem->persist(); } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(true); }