Beispiel #1
0
 public function getEntryPoints()
 {
     $entryPoints = array();
     foreach (MenuService::getEntryPoints() as $entry) {
         $entryPoints[$entry->getId()] = $entry;
     }
     foreach ($this->getMap() as $entry) {
         $entryPoints[$entry->getId()] = $entry;
     }
     return $entryPoints;
 }
 /**
  * First page, when arriving on a system
  * to choose front or back office
  */
 public function entry()
 {
     $entries = array();
     foreach (MenuService::getEntryPoints() as $entry) {
         if ($entry->hasAccess()) {
             $entries[] = $entry;
         }
     }
     if (empty($entries)) {
         // no access -> error
         if (common_session_SessionManager::isAnonymous()) {
             return $this->redirect(_url('login'));
         } else {
             common_session_SessionManager::endSession();
             return $this->returnError(__('You currently have no access to the platform'));
         }
     } elseif (count($entries) == 1 && !common_session_SessionManager::isAnonymous()) {
         // single entrypoint -> redirect
         $entry = current($entries);
         return $this->redirect($entry->getUrl());
     } else {
         // multiple entries -> choice
         if (!common_session_SessionManager::isAnonymous()) {
             $this->setData('user', common_session_SessionManager::getSession()->getUserLabel());
         }
         $this->setData('entries', $entries);
         $naviElements = $this->getNavigationElementsByGroup('settings');
         foreach ($naviElements as $key => $naviElement) {
             if ($naviElement['perspective']->getId() !== 'user_settings') {
                 unset($naviElements[$key]);
                 continue;
             }
         }
         $this->setData('userLabel', \common_session_SessionManager::getSession()->getUserLabel());
         $this->setData('settings-menu', $naviElements);
         $this->setData('content-template', array('blocks/entry-points.tpl', 'tao'));
         $this->setView('layout.tpl', 'tao');
     }
 }