Issue #0001547: language value using Session, not Webservice
This commit is contained in:
parent
35edbae09c
commit
992afee9f8
@ -753,10 +753,6 @@ class DashboardController extends Zend_Controller_Action
|
||||
|
||||
require_once 'Scores/WsScores.php';
|
||||
$ws = new WsScores();
|
||||
|
||||
//récupération la valeur de la langue de la bdd
|
||||
$reponse = $ws->getInfosLogin($login, $_SERVER['REMOTE_ADDR']);
|
||||
$this->view->assign('lang', $reponse->result->lang);
|
||||
|
||||
//Liste des catégories d'accès
|
||||
$reponse = $ws->getCategory();
|
||||
|
@ -40,8 +40,9 @@ class UserController extends Zend_Controller_Action
|
||||
$InfosLogin->result->timeout : 1800;
|
||||
$identity->time = time() + $identity->timeout;
|
||||
$identity->modeEdition = false;
|
||||
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
|
||||
$identity->lang = $utilisateur->getLang();
|
||||
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
|
||||
$lang = in_array($InfosLogin->result->lang,array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$identity->lang = $lang;
|
||||
$identity->browser = $utilisateur->getBrowserInfo();
|
||||
return $identity;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ $lngOpts = array('fr' => 'Français', 'en' => 'English');
|
||||
foreach($lngOpts as $lngKey => $lngVal)
|
||||
{
|
||||
$selected = '';
|
||||
if($lngKey == $this->lang) $selected = 'selected';
|
||||
if($lngKey == $this->options['lang']) $selected = 'selected';
|
||||
?><option value="<?=$lngKey?>" <?=$selected?>><?=$lngVal?></option><?php
|
||||
}
|
||||
?>
|
||||
|
@ -4,6 +4,7 @@ class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abst
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$registry = Zend_Registry::getInstance();
|
||||
$session = new Zend_Session_Namespace('Zend_Auth');
|
||||
$translate = $registry->get('Zend_Translate');
|
||||
$currLocale = $translate->getLocale();
|
||||
|
||||
@ -25,25 +26,12 @@ class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abst
|
||||
$newLocale = new Zend_Locale();
|
||||
$newLocale->setLocale($langLocale);
|
||||
$registry->set('Zend_Locale', $newLocale);
|
||||
|
||||
|
||||
|
||||
$session->lang = $langLocale;
|
||||
|
||||
$translate->setLocale($langLocale);
|
||||
$this->setSessionLang($langLocale);
|
||||
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save new lang value into session
|
||||
* @param string $lang
|
||||
*/
|
||||
protected function setSessionLang($lang)
|
||||
{
|
||||
$authStorage = Zend_Auth::getInstance()->getStorage();
|
||||
$authData = $authStorage->read();
|
||||
if($authData)
|
||||
{
|
||||
$authData->lang = $lang;
|
||||
$authStorage->write($authData);
|
||||
}
|
||||
}
|
||||
}
|
@ -49,11 +49,13 @@ class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
$identity->acceptationCGU = $InfosLogin->result->acceptationCGU;
|
||||
$identity->ip = $adressIp;
|
||||
$identity->modeEdition = false;
|
||||
$identity->lang = (!empty($InfosLogin->result->lang)) ? $InfosLogin->result->lang : 'fr';
|
||||
$timeout = (!empty($InfosLogin->result->timeout)) ? $InfosLogin->result->timeout : $this->_timeout;
|
||||
$identity->timeout = $timeout;
|
||||
|
||||
$identity->time = time() + $timeout;
|
||||
|
||||
$lang = in_array($InfosLogin->result->lang,array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$identity->lang = $lang;
|
||||
|
||||
/*
|
||||
* Adresse Ip interdites
|
||||
|
Loading…
Reference in New Issue
Block a user