/** * Delete an Action from the database, which does not exists as an action method anymore * * @view views/scripts/action/delete.phtml * @access public */ public function deleteAction() { $actionRow = new Admin_Model_DbRow_Action(); $ctrlRow = new Admin_Model_DbRow_Controller(); $action = $this->dbAction->find($this->checkActionIdParam()); if ($action->count() !== 1) { $form = new Admin_Form_Action_Delete($ctrlRow, $actionRow); $form->setAction('/noc/admin/action/delete'); $form->setErrors(array('Invalid ActionId, cannot proceed!')); } else { $actionRow->fromArray($action); $ctrlRow->fromArray($this->dbController->find($actionRow->get('mcId'))); $form = new Admin_Form_Action_Delete($ctrlRow, $actionRow); $form->setAction('/noc/admin/action/delete'); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getParams()) === TRUE && $form->getElement('chkdelete')->isChecked() === TRUE) { $this->dbAction->deleteById($actionRow->get('id')); // delete all rules which are bound to this module / controller $dbRules = new Admin_Model_DbTable_Acl_Rule(); $dbRules->deleteByActionId($actionRow->get('id')); $this->_redirect('admin/action/scan'); } else { $form->setErrors(array('Delete not successfull. Did you checked the checkbox?')); } } } $this->view->form = $form; $this->view->controller = $ctrlRow; }
/** * Delete an Action from the Database * * @return array * @todo fixme, currently unused */ public function saveDeleteActionAction() { $actionModel = new Admin_Model_DbTable_Acl_Action(); $actionRow = new Admin_Model_DbRow_Action($actionModel->find($this->request->getParam('id', 0))); if ($actionRow->get('id')) { // delete all rules which are bound to this action $rulesModel = new Admin_Model_DbTable_Acl_Rule(); $rulesModel->deleteByActionId($actionRow->get('id')); $actionModel->deleteById($actionRow->get('id')); return $this->responseSuccess(); } else { return $this->responseFailure('Failed Saving informations', 'Action Id is not valid'); } }