Exemple #1
0
 /**
  * Shows a table with all groups.
  */
 public function indexAction()
 {
     $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('menuAccess'), array('action' => 'index'));
     $postData = $this->getRequest()->getPost();
     $groupMapper = new GroupMapper();
     $groups = $groupMapper->getGroupList();
     $this->getView()->set('activeGroupId', 0);
     $this->getView()->set('activeGroup', null);
     foreach ($groups as $key => $group) {
         if ($group->getId() == 1) {
             unset($groups[$key]);
         }
     }
     $this->getView()->set('groups', $groups);
     if (isset($postData['groupId'])) {
         $groupId = (int) $postData['groupId'];
         $_SESSION['user']['accessGroup'] = $groupId;
     } elseif (isset($_SESSION['user']['accessGroup'])) {
         $groupId = (int) $_SESSION['user']['accessGroup'];
     } else {
         $groupId = 0;
     }
     if ($groupId) {
         $groupAccessList = $groupMapper->getGroupAccessList($groupId);
         $activeGroup = $groupMapper->getGroupById($groupId);
         $this->getView()->set('groupAccessList', $groupAccessList);
         $this->getView()->set('activeGroupId', $groupId);
         $this->getView()->set('activeGroup', $activeGroup);
     }
     $moduleMapper = new ModuleMapper();
     $modules = $moduleMapper->getModules();
     $pageMapper = new PageMapper();
     $pages = $pageMapper->getPageList();
     $articleMapper = new ArticleMapper();
     $articles = $articleMapper->getArticles();
     $boxMapper = new BoxMapper();
     $boxes = $boxMapper->getBoxList($this->getTranslator()->getLocale());
     $accessTypes = array('module' => $modules, 'page' => $pages, 'article' => $articles, 'box' => $boxes);
     $this->getView()->set('accessTypes', $accessTypes);
 }
Exemple #2
0
 public function indexAction()
 {
     $this->getLayout()->getAdminHmenu()->add($this->getTranslator()->trans('boxes'), array('action' => 'index'));
     $boxMapper = new BoxMapper();
     if ($this->getRequest()->getPost('action') == 'delete' && $this->getRequest()->getPost('check_boxes')) {
         foreach ($this->getRequest()->getPost('check_boxes') as $boxId) {
             $boxMapper->delete($boxId);
         }
     }
     $boxes = $boxMapper->getBoxList('');
     /*
      * Filtering boxes out which are not allowed for the user.
      */
     $user = \Ilch\Registry::get('user');
     foreach ($boxes as $key => $box) {
         if (!$user->hasAccess('box_' . $box->getId())) {
             unset($boxes[$key]);
         }
     }
     $this->getView()->set('boxMapper', $boxMapper);
     $this->getView()->set('boxes', $boxes);
     $this->getView()->set('multilingual', (bool) $this->getConfig()->get('multilingual_acp'));
     $this->getView()->set('contentLanguage', $this->getConfig()->get('content_language'));
 }