Issue #0001547: interface language via langAction(), not Language plugin
This commit is contained in:
parent
7c412abe18
commit
9a1804d744
@ -44,8 +44,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
|
||||
protected function _initTranslate()
|
||||
{
|
||||
$registry = Zend_Registry::getInstance();
|
||||
|
||||
$registry = Zend_Registry::getInstance();
|
||||
$locale = new Zend_Locale('fr_FR');
|
||||
$translate = new Zend_Translate(
|
||||
array(
|
||||
'adapter' => 'gettext',
|
||||
@ -62,7 +62,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||
'scan' => Zend_Translate::LOCALE_DIRECTORY
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$registry->set('Zend_Locale', $locale);
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
return $registry;
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ class UserController extends Zend_Controller_Action
|
||||
public function indexAction()
|
||||
{
|
||||
$user = new Scores_Utilisateur();
|
||||
|
||||
if (!$user->checkPerm('MONPROFIL')){
|
||||
$this->_forward('perms', 'error');
|
||||
}
|
||||
@ -484,6 +485,31 @@ class UserController extends Zend_Controller_Action
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changer la langue de l'utilisateur
|
||||
*/
|
||||
public function langAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$user = new Scores_Utilisateur();
|
||||
$locale = new Zend_Locale();
|
||||
|
||||
$url = $this->getRequest()->getParam('last_url', null);
|
||||
$langtmp = $this->getRequest()->getParam('langtmp', null);
|
||||
|
||||
$registry = Zend_Registry::getInstance();
|
||||
$translate = $registry->get('Zend_Translate');
|
||||
|
||||
$locale->setLocale($langtmp);
|
||||
$registry->set('Zend_Locale', $locale);
|
||||
$translate->setLocale($langtmp);
|
||||
$user->setLangTmp($langtmp);
|
||||
$registry->set('Zend_Translate', $translate);
|
||||
|
||||
$this->_redirect($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changer le theme de l'utilisateur
|
||||
|
@ -12,7 +12,7 @@ pour en savoir plus cliquez-ici</a></span>
|
||||
<p>© 2006-<?php echo date('Y')?> Scores & Décisions SAS -
|
||||
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('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>
|
||||
Mentions légales</a> -
|
||||
<img class='flag' id='fr' src="/themes/default/images/drapeaux/fr.png"/>
|
||||
<img class='flag' id='en' src="/themes/default/images/drapeaux/en.png"/>
|
||||
</p>
|
1
application/views/default/scripts/user/lang.phtml
Normal file
1
application/views/default/scripts/user/lang.phtml
Normal file
@ -0,0 +1 @@
|
||||
<div class="infoData"></div>
|
@ -1,5 +1,17 @@
|
||||
$(document).ready(function(){
|
||||
|
||||
$('img.flag').on('click', function() {
|
||||
var cur_url = window.location.pathname;
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '/user/lang',
|
||||
data: { langtmp: $(this).attr('id'), last_url: cur_url },
|
||||
success: function(result) {
|
||||
window.location.pathname = cur_url;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//Auto Scroll
|
||||
$(window).scroll(function(e) {
|
||||
e.stopPropagation();
|
||||
|
@ -16,7 +16,6 @@ resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
|
||||
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
|
||||
resources.frontController.plugins.Xml = "Application_Controller_Plugin_Xml"
|
||||
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
|
||||
resources.frontController.plugins.Language = "Application_Controller_Plugin_Language"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
|
@ -16,7 +16,6 @@ resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
|
||||
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
|
||||
resources.frontController.plugins.Xml = "Application_Controller_Plugin_Xml"
|
||||
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
|
||||
resources.frontController.plugins.Language = "Application_Controller_Plugin_Language"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
|
@ -16,7 +16,6 @@ resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
|
||||
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
|
||||
resources.frontController.plugins.Xml = "Application_Controller_Plugin_Xml"
|
||||
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
|
||||
resources.frontController.plugins.Language = "Application_Controller_Plugin_Language"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
|
@ -16,7 +16,6 @@ resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
|
||||
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
|
||||
resources.frontController.plugins.Xml = "Application_Controller_Plugin_Xml"
|
||||
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
|
||||
resources.frontController.plugins.Language = "Application_Controller_Plugin_Language"
|
||||
resources.frontController.params.displayExceptions = 0
|
||||
resources.layout.layout = "main"
|
||||
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
|
||||
|
Loading…
Reference in New Issue
Block a user