/** * Common handler utility to initialize tokens from parameters * * @return boolean True if there is a real token specified in the request */ protected function _initToken() { if ($this->tracker) { return $this->token && $this->token->exists; } $this->tracker = $this->loader->getTracker(); $this->tokenId = $this->tracker->filterToken($this->_getParam(\MUtil_Model::REQUEST_ID)); if (!$this->tokenId) { return false; } $this->token = $this->tracker->getToken($this->tokenId); if (!$this->token->exists) { return false; } if (!($this->currentUser->isActive() || $this->token->getSurvey()->isTakenByStaff())) { $tokenLang = strtolower($this->token->getRespondentLanguage()); // \MUtil_Echo::track($tokenLang, $this->locale->getLanguage()); if ($tokenLang != $this->locale->getLanguage()) { $this->locale->setLocale($tokenLang); $this->translateAdapter->setLocale($this->locale); $this->currentUser->setLocale($tokenLang); \Gems_Cookies::setLocale($tokenLang, $this->basepath->getBasePath()); } $currentOrg = $this->loader->getOrganization(); $tokenOrgId = $this->token->getOrganizationId(); if ($tokenOrgId != $currentOrg->getId()) { $this->loader->getOrganization($tokenOrgId)->setAsCurrentOrganization(); } } return true; }