Example #1
0
 /**
  * Processes and initializes the context.
  *
  * @return void
  */
 public function process()
 {
     // Initialize the session.
     $this->session = new \Innomatic\Php\PHPSession();
     $this->session->start();
     // Set 'session.gc_maxlifetime' and 'session.cookie_lifetime' to the value
     // defined by the 'sessionLifetime' parameter in web.xml.
     $lifetime = \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getCurrentWebApp()->getInitParameter('sessionLifetime');
     if ($lifetime !== false) {
         $this->session->setLifeTime($lifetime);
     }
     // Check if the locale has been passed as parameter.
     if ($this->request->parameterExists('innomedia_setlocale')) {
         // Store the locale into the session.
         $this->session->put('innomedia_locale', $this->request->getParameter('innomedia_setlocale'));
     }
     // Retrieve the locale from the session, if set.
     if ($this->session->isValid('innomedia_locale')) {
         $this->locales[] = $this->session->get('innomedia_locale');
     }
     // Add the locales supported by the web agent.
     $this->locales = array_merge($this->locales, $this->request->getLocales());
 }