Issue #0001547: Using $langtmp value for interface
This commit is contained in:
parent
1da5ca8da8
commit
3bc0973056
@ -61,10 +61,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
'locale' => 'en',
|
||||
'scan' => Zend_Translate::LOCALE_DIRECTORY
|
||||
)
|
||||
);
|
||||
|
||||
//Always fallback to 'fr'
|
||||
$translate->setLocale('fr');
|
||||
);
|
||||
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
return $registry;
|
||||
|
@ -40,8 +40,10 @@ 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->langtmp = $lang;
|
||||
$identity->browser = $utilisateur->getBrowserInfo();
|
||||
return $identity;
|
||||
}
|
||||
@ -141,7 +143,7 @@ class UserController extends Zend_Controller_Action
|
||||
//Récupération des informations de l'identité
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
|
||||
if (isset($options['idClient']) && $identity->idClient == $options['idClient'] && $identity->username == $login) {
|
||||
//Modification lors du changement de mot de passe
|
||||
if ($options['changepwd']==1 && $updateResult) {
|
||||
|
||||
|
@ -13,6 +13,6 @@ pour en savoir plus cliquez-ici</a></span>
|
||||
Tous droits réservés -
|
||||
<a href="http://www.scores-decisions.com/mentions.php" target="_blank">
|
||||
Mentions légales</a> -
|
||||
<a href=<?=$this->url(array('lang' => 'fr'));?>><img src="/themes/default/images/drapeaux/fr.png"/></a>
|
||||
<a href=<?=$this->url(array('lang' => 'en'));?>><img src="/themes/default/images/drapeaux/en.png"/></a>
|
||||
<a href=<?=$this->url(array('langtmp' => 'fr'));?>><img src="/themes/default/images/drapeaux/fr.png"/></a>
|
||||
<a href=<?=$this->url(array('langtmp' => 'en'));?>><img src="/themes/default/images/drapeaux/en.png"/></a>
|
||||
</p>
|
@ -1,31 +1,24 @@
|
||||
<?php
|
||||
class Application_Controller_Plugin_Language extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
public function preDispatch(Zend_Controller_Request_Abstract $request)
|
||||
public function postDispatch(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$registry = Zend_Registry::getInstance();
|
||||
$translate = $registry->get('Zend_Translate');
|
||||
$currLocale = $translate->getLocale();
|
||||
$user = new Scores_Utilisateur();
|
||||
if ( $user->isLog() ) {
|
||||
switch ($user->getLang()) {
|
||||
case "en":
|
||||
$langLocale = 'en';
|
||||
break;
|
||||
case "fr":
|
||||
default:
|
||||
$langLocale = 'fr';
|
||||
}
|
||||
} else {
|
||||
$langLocale = 'fr';
|
||||
}
|
||||
|
||||
$newLocale = new Zend_Locale();
|
||||
$newLocale->setLocale($langLocale);
|
||||
$registry->set('Zend_Locale', $newLocale);
|
||||
|
||||
$translate->setLocale($langLocale);
|
||||
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
$registry = Zend_Registry::getInstance();
|
||||
$translate = $registry->get('Zend_Translate');
|
||||
$currLocale = $translate->getLocale();
|
||||
$user = new Scores_Utilisateur();
|
||||
if ( $user->isLog() ) {
|
||||
$langtmp = $request->getParam('langtmp', '');
|
||||
if (!$langtmp)
|
||||
$langtmp = $user->getLangTmp() ? $user->getLangTmp() : $user->getLang();
|
||||
$newLocale = new Zend_Locale();
|
||||
$newLocale->setLocale($langtmp);
|
||||
$registry->set('Zend_Locale', $newLocale);
|
||||
$translate->setLocale($langtmp);
|
||||
$user->setLangTmp($langtmp);
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
} else {
|
||||
$langtmp = 'fr';
|
||||
}
|
||||
}
|
||||
}
|
@ -55,8 +55,9 @@ class Scores_AuthAdapter implements Zend_Auth_Adapter_Interface
|
||||
|
||||
$identity->time = time() + $timeout;
|
||||
|
||||
$lang = in_array($InfosLogin->result->lang,array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$lang = in_array($InfosLogin->result->lang, array('fr','en')) ? $InfosLogin->result->lang : 'fr';
|
||||
$identity->lang = $lang;
|
||||
$identity->langtmp = $lang;
|
||||
|
||||
/*
|
||||
* Adresse Ip interdites
|
||||
|
@ -218,14 +218,22 @@ class Scores_Utilisateur
|
||||
{
|
||||
return $this->identity->lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets language new value
|
||||
* @param $lang
|
||||
*/
|
||||
public function setLang($lang)
|
||||
|
||||
/**
|
||||
* Retourne la langue de l'interface du client
|
||||
*/
|
||||
public function getLangTmp()
|
||||
{
|
||||
$this->identity->lang = $lang;
|
||||
return $this->identity->langtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets interface's language new value
|
||||
* @param $langtmp
|
||||
*/
|
||||
public function setLangTmp($langtmp)
|
||||
{
|
||||
$this->identity->langtmp = $langtmp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user