Example #1
0
 /**
  * This action renders the template used by the splash screen popup
  */
 public function splash()
 {
     //the list of extensions the splash provides an explanation for.
     $defaultExtIds = array('items', 'tests', 'TestTaker', 'groups', 'delivery', 'results');
     //check if the user is a noob
     $this->setData('firstTime', TaoCe::isFirstTimeInTao());
     //load the extension data
     $defaultExtensions = array();
     $additionalExtensions = array();
     foreach (MenuService::getPerspectivesByGroup(Perspective::GROUP_DEFAULT) as $i => $perspective) {
         if (in_array((string) $perspective->getId(), $defaultExtIds)) {
             $defaultExtensions[strval($perspective->getId())] = array('id' => $perspective->getId(), 'name' => $perspective->getName(), 'extension' => $perspective->getExtension(), 'description' => $perspective->getDescription());
         } else {
             $additionalExtensions[$i] = array('id' => $perspective->getId(), 'name' => $perspective->getName(), 'extension' => $perspective->getExtension());
         }
         //Test if access
         $access = false;
         foreach ($perspective->getChildren() as $section) {
             if (tao_models_classes_accessControl_AclProxy::hasAccess($section->getAction(), $section->getController(), $section->getExtensionId())) {
                 $access = true;
                 break;
             }
         }
         if (in_array((string) $perspective->getId(), $defaultExtIds)) {
             $defaultExtensions[strval($perspective->getId())]['enabled'] = $access;
         } else {
             $additionalExtensions[$i]['enabled'] = $access;
         }
     }
     $this->setData('extensions', array_merge($defaultExtensions, $additionalExtensions));
     $this->setData('defaultExtensions', $defaultExtensions);
     $this->setData('additionalExtensions', $additionalExtensions);
     $this->setView('splash.tpl');
 }
Example #2
0
 /**
  * Wrapper to the main action: update the first time property and redirect
  * @return void
  */
 public function index()
 {
     //redirect to the usual tao/Main/index
     if ($this->hasRequestParameter('ext') || $this->hasRequestParameter('structure')) {
         //but before update the first time property
         $user = $this->userService->getCurrentUser();
         if ($this->hasRequestParameter('nosplash')) {
             TaoCe::becomeVeteran();
         }
         //@todo use forward on cross-extension forward is supported
         $this->redirect(_url('index', 'Main', 'tao', array('ext' => $this->getRequestParameter('ext'), 'structure' => $this->getRequestParameter('structure'))));
     } else {
         //render the index but with the taoCe URL used by client side routes
         parent::index();
     }
 }
Example #3
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');
 }