public function managerAction() { /** * Check permission */ if (false == $this->checkPermission('see_permission')) { $this->_forwardToNoPermissionPage(); return; } $this->view->headTitle(Vi_Language::translate('Permission manager')); $this->view->menu = array('usergroup', 'permissionmanager'); $config = Vi_Registry::getConfig(); /** * Load all groups */ $objGroup = new Models_Group(); /** * Set values for tempalte */ $this->view->allGroups = $objGroup->getAll(array('sorting ASC', 'group_id ASC'))->toArray(); /** * Get all applications */ $allApps = Vi_Folder::getFolders('applications'); foreach ($allApps as $index => $app) { if (!is_dir("applications/{$app}")) { unset($allApps[$index]); } } $this->view->allApps = $allApps; /** * Get all modules */ $allModules = Vi_Folder::getFolders('modules'); foreach ($allModules as $index => $module) { if (!is_dir("modules/{$module}")) { unset($allModules[$index]); } } $this->view->allModules = $allModules; $this->view->permissionMessage = $this->session->permissionMessage; $this->session->permissionMessage = null; }
public function getGroupName() { $group = Models_Group::fetchRowByID($this->audience_value); if ($group) { return $group->getGroupName(); } else { return false; } }
public function editGroupAction() { /** * Check permission */ if (false == $this->checkPermission('edit_group')) { $this->_forwardToNoPermissionPage(); return; } $id = $this->_getParam('id', false); $data = $this->_getParam('data', false); if (false == $id) { $this->_redirect('user/admin/group-manager'); } $objGroup = new Models_Group(); $errors = array(); /** * Get old group */ $oldGroup = $objGroup->find($id)->current()->toArray(); if (empty($oldGroup)) { /** * Group doesn't exsit */ $this->session->groupMessage = array('success' => false, 'message' => Vi_Language::translate('Group does NOT exist')); $this->_redirect('user/admin/group-manager#listofgroup'); } if (false !== $data) { /** * Update new group */ $newGroup = array('name' => $data['name'], 'default' => $data['default'], 'description' => $data['description'], 'color' => $data['color'], 'enabled' => $data['enabled'], 'sorting' => $data['sorting']); if (null == $newGroup['name']) { $errors['name'] = Vi_Language::translate('Name is required'); } if (null == $newGroup['color']) { $errors['color'] = Vi_Language::translate('Color is required'); } if (null == $newGroup['sorting']) { $errors['sorting'] = Vi_Language::translate('Sorting is required'); } if (empty($errors)) { try { $objGroup->update($newGroup, array('group_id=?' => $id)); /** * Reload current login group */ $this->_redirect('user/admin/group-manager'); } catch (Exception $e) { $errors = array('main' => Vi_Language::translate('Can not update group now')); } } } else { /** * Get current group */ $data = $oldGroup; } /** * Prepare for template */ $this->view->errors = $errors; $this->view->data = $data; $this->view->headTitle(Vi_Language::translate('Edit group')); $this->view->menu = array('usergroup', 'editgroup'); }