/** * Move action for contact controller * @throws Exception */ public function moveAction() { // action body try { $translate = Zend_Registry::get('Zend_Translate'); $id = $this->_request->getParam('id'); $direction = $this->_request->getParam('direction'); $mdlContact = new Contact_Model_Contact(); $contact = $mdlContact->find($id)->current(); if (!$contact) { throw new Exception($translate->translate("MENU_ITEM_NOT_FOUND")); } if (!in_array($direction, array('down', 'up'))) { throw new Exception($translate->translate("LBL_UP_DOWN_NOT_SPECIFIED")); } if ($direction == "up") { $mdlContact->moveUp($contact); $this->_helper->flashMessenger->addMessage(array('type' => 'info', 'header' => '', 'message' => $translate->translate("LBL_ITEM_MOVED_UP_SUCCESSFULLY"))); } elseif ($direction == "down") { $mdlContact->moveDown($contact); $this->_helper->flashMessenger->addMessage(array('type' => 'info', 'header' => '', 'message' => $translate->translate("LBL_ITEM_MOVED_DOWN_SUCCESSFULLY"))); } $this->_helper->redirector("listregistered", "contact", "contact"); } catch (Exception $e) { $this->_helper->flashMessenger->addMessage(array('type' => 'error', 'header' => '', 'message' => $e->getMessage())); $this->_helper->redirector("listregistered", "contact", "contact"); } return; }