/** * editAction * Get a record and populate the application form * @return unknown_type */ public function editAction() { $auth = Zend_Auth::getInstance(); // Get the common resources of ShineISP from the ACL file $aclConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/acl.xml', 'acl'); $form = $this->getForm('/admin/roles/process'); $id = $this->getRequest()->getParam('id'); // 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))); if (!empty($id) && is_numeric($id)) { $rs = AdminRoles::find($id, null, true); if (!empty($rs[0])) { // Load the users connected to this role $users = AdminUser::getUserbyRoleID($id); // Load the roles of each resource $roles = AdminPermissions::getPermissionByRoleID($id); // Load the resources $this->view->resources = json_encode(AdminResources::createResourcesTree($aclConfig->modules, $roles)); // Join the roles and the users $rs[0]['users'] = $users; $form->populate($rs[0]); $this->view->buttons[] = array("url" => "/admin/roles/confirm/id/{$id}", "label" => $this->translator->translate('Delete'), "params" => array('css' => null)); } } $this->view->mex = $this->getRequest()->getParam('mex'); $this->view->mexstatus = $this->getRequest()->getParam('status'); $this->view->title = $this->translator->translate("Role edit"); $this->view->description = $this->translator->translate("Here you can edit the role permissions."); $this->view->form = $form; $this->render('applicantform'); }