/**
  * Go directly to url
  */
 public function toSurveyAction()
 {
     if (!$this->_initToken()) {
         // Default option
         $this->_forward('index');
         return;
     }
     $language = $this->locale->getLanguage();
     try {
         $url = $this->token->getUrl($language, $this->currentUser->getUserId() ? $this->currentUser->getUserId() : $this->token->getRespondentId());
         /************************
          * Optional user logout *
          ************************/
         if ($this->currentUser->isLogoutOnSurvey()) {
             $this->currentUser->unsetAsCurrentUser();
         }
         // Redirect at once
         header('Location: ' . $url);
         exit;
     } catch (\Gems_Tracker_Source_SurveyNotFoundException $e) {
         $this->addMessage(sprintf($this->_('The survey for token %s is no longer active.'), strtoupper($this->tokenId)));
         // Default option
         $this->_forward('index');
     }
 }
 /**
  * Default logoff action
  */
 public function logoffAction()
 {
     $this->addMessage(sprintf($this->_('Good bye: %s.'), $this->currentUser->getFullName()));
     $this->accesslog->logChange($this->getRequest());
     $this->currentUser->unsetAsCurrentUser();
     \Zend_Session::destroy();
     $this->_reroute(array('action' => 'index'), true);
 }
 /**
  * Removes the current user
  *
  * @return \Gems_User_UserLoader (continuation pattern)
  */
 public function unsetCurrentUser()
 {
     // Remove if the currentUser still sees itself as the current user.
     if (self::$currentUser instanceof \Gems_User_User && self::$currentUser->isCurrentUser()) {
         self::$currentUser->unsetAsCurrentUser(false);
     }
     self::$currentUser = null;
     return $this;
 }