Esempio n. 1
0
 /**
  * The main action, load the layout
  *
  * @return void
  */
 public function index()
 {
     $user = $this->userService->getCurrentUser();
     $extension = $this->getRequestParameter('ext');
     $structure = $this->getRequestParameter('structure');
     if ($this->hasRequestParameter('structure')) {
         // structured mode
         // @todo stop using session to manage uri/classUri
         $this->removeSessionAttribute('uri');
         $this->removeSessionAttribute('classUri');
         $this->removeSessionAttribute('showNodeUri');
         TaoCe::setLastVisitedUrl(_url('index', 'Main', 'tao', array('structure' => $structure, 'ext' => $extension)));
         $sections = $this->getSections($extension, $structure);
         if (count($sections) > 0) {
             $this->setData('sections', $sections);
         } else {
             common_Logger::w('no sections');
         }
     } else {
         //check if the user is a noob, otherwise redirect him to his last visited extension.
         $firstTime = TaoCe::isFirstTimeInTao();
         if ($firstTime == false) {
             $lastVisited = TaoCe::getLastVisitedUrl();
             if (!is_null($lastVisited)) {
                 $this->redirect($lastVisited);
             }
         }
     }
     $perspectiveTypes = array(Perspective::GROUP_DEFAULT, 'settings');
     foreach ($perspectiveTypes as $perspectiveType) {
         $this->setData($perspectiveType . '-menu', $this->getNavigationElementsByGroup($perspectiveType));
     }
     $this->setData('user_lang', \common_session_SessionManager::getSession()->getDataLanguage());
     $this->setData('userLabel', \common_session_SessionManager::getSession()->getUserLabel());
     // re-added to highlight selected extension in menu
     $this->setData('shownExtension', $extension);
     $this->setData('shownStructure', $structure);
     //creates the URL of the action used to configure the client side
     $clientConfigParams = array('shownExtension' => $extension, 'shownStructure' => $structure);
     $this->setData('client_config_url', $this->getClientConfigUrl($clientConfigParams));
     $this->setData('content-template', array('blocks/sections.tpl', 'tao'));
     $this->setView('layout.tpl', 'tao');
 }