/** * processAction * Update the record previously selected * @return unknown_type */ public function processAction() { $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector'); $form = $this->getForm("/admin/roles/process"); $request = $this->getRequest(); // Create the buttons in the edit form $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/roles/list", "label" => $this->translator->translate('List'), "params" => array('css' => null)), array("url" => "/admin/roles/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null))); // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('list', 'roles', 'admin'); } if ($form->isValid($request->getPost())) { $params = $request->getPost(); $role = AdminRoles::SaveAll($params, $params['role_id']); if ($role) { $this->_helper->redirector('edit', 'roles', 'admin', array('id' => (string) $role->role_id, 'mex' => $this->translator->translate("The task requested has been executed successfully."), 'status' => 'success')); } else { $this->_helper->redirector('list', 'roles', 'admin', array('mex' => $this->translator->translate("There was an error saving the data. Please try again."), 'status' => 'danger')); } } else { $this->view->form = $form; $this->view->title = "Role edit"; $this->view->description = "Here you can edit the role data."; return $this->render('applicantform'); } }