Merge from branche 2.4 : Language and improvments

This commit is contained in:
Michael RICOIS 2013-05-27 15:22:43 +00:00
parent debdd7ab0e
commit aeaa0e6a76
46 changed files with 31893 additions and 110 deletions

View File

@ -44,8 +44,26 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initTranslate()
{
$registry = Zend_Registry::getInstance();
$registry = Zend_Registry::getInstance();
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
$identity = $auth->getIdentity();
$lang = $identity->langtmp;
switch($lang) {
case 'fr':
$locale = new Zend_Locale('fr_FR');
break;
case 'en':
$locale = new Zend_Locale('en_EN');
break;
}
} else {
$locale = new Zend_Locale('fr_FR');
}
$registry->set('Zend_Locale', $locale);
$translate = new Zend_Translate(
array(
'adapter' => 'gettext',
@ -61,10 +79,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;

View File

@ -1088,7 +1088,7 @@ class SaisieController extends Zend_Controller_Action
$milDate = $milDatePre = null;
$listBilans = $ws->getListeBilans($siren);
if ( count($listBilans->result->item) > 0 ) {
foreach ($listBilans->result->item as $item) {
foreach ($listBilans->result->item as $item) {
if ($type == $item->typeBilan) {
if ($item->dateExercice == $date) {
$milDate = $item->dateExercice;
@ -1101,8 +1101,8 @@ class SaisieController extends Zend_Controller_Action
}
if ( null !== $milDate ) {
Zend_Registry::get('firebug')->info('milDate');
$response = $ws->getBilan($siren, $milDate, $type, true);
Zend_Registry::get('firebug')->info($response);
$infos = new stdClass();
$infos->siren = $response->siren;
$infos->dateCloture = $response->DATE_CLOTURE;
@ -1115,12 +1115,13 @@ class SaisieController extends Zend_Controller_Action
$postes[$item->id] = $item->val;
}
} elseif ( null === $milDate && null !== $milDatePre ) {
Zend_Registry::get('firebug')->info('milDatePre');
$response = $ws->getBilan($siren, $milDatePre, $type, true);
Zend_Registry::get('firebug')->info($response);
$infos = new stdClass();
$infos->siren = $response->siren;
$infos->dateCloturePre = $response->DATE_CLOTURE_PRE;
$infos->dureeMoisPre = $response->DUREE_MOIS_PRE;
$infos->dateCloturePre = $response->DATE_CLOTURE;
$infos->dureeMoisPre = $response->DUREE_MOIS;
$infos->unite = empty($response->MONNAIE_LIV_UNITE) ? 'U' : $response->MONNAIE_LIV_UNITE;
$postesN1 = array();
foreach ($response->POSTES->item as $item) {
@ -1377,6 +1378,8 @@ class SaisieController extends Zend_Controller_Action
// ASSURANCE
if (!isset($postes['NR4']) && isset($postesN1['AR4'])) $postes['AR4']=$postesN1['AR4'];
}
} else {
$infos = 'NEW';
}
} else {

View File

@ -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;
}
@ -59,6 +61,7 @@ class UserController extends Zend_Controller_Action
public function indexAction()
{
$user = new Scores_Utilisateur();
if (!$user->checkPerm('MONPROFIL')){
$this->_forward('perms', 'error');
}
@ -81,6 +84,10 @@ class UserController extends Zend_Controller_Action
$login = $request->getParam('login', '');
$op = $request->getParam('op');
//Récupération des informations de l'identité
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
//Save data
if ( $request->isPost() ) {
$options = $request->getParam('frmOptions', '');
@ -115,59 +122,36 @@ class UserController extends Zend_Controller_Action
$message = 'Compte mis à jour.';
}
}
//Write change in session
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
//Modification lors du changement de mot de passe
if ($options['changepwd']==1 && $updateResult) {
$identity->password = md5($login.'|'.$options['password']);
$auth->getStorage()->write($identity);
}
//Mise à jour du profil
if ($isProfilUpdated && $updateResult) {
$identity = $this->updateProfil($identity->username, $identity->password);
$auth->getStorage()->write($identity);
}
//Gestion mode edition en SESSION
if ($action=='update') {
$modeEdition = $request->getParam('modeEdition', false);
if ( $modeEdition ) {
$identity->modeEdition = true;
$auth->getStorage()->write($identity);
}
}
}
}
//Liste des catégories des accès
$reponse = $ws->getCategory();
$wscategory = $reponse->item;
$this->view->assign('wscategory', $wscategory);
//Liste de tous les droits
$listeDroits = $ws->getListeDroits();
$droitsLib = array();
foreach($listeDroits->item as $droit) {
$droitsLib[strtoupper($droit->code)] = $droit->desc;
}
$this->view->assign('droitsLib', $droitsLib);
//Liste de toutes les préférences
$listePrefs = $ws->getListePrefs();
$prefsLib = array();
foreach($listePrefs->item as $pref) {
$prefsLib[strtoupper($pref->code)] = $pref->desc;
}
$this->view->assign('prefsLib', $prefsLib);
//Récupération des informations de l'identité
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
if ($identity->idClient == $options['idClient'] && $identity->username == $login) {
//Modification lors du changement de mot de passe
if ($options['changepwd']==1 && $updateResult) {
$identity->password = md5($login.'|'.$options['password']);
$auth->getStorage()->write($identity);
}
//Mise à jour du profil
if ($isProfilUpdated && $updateResult) {
$identity = $this->updateProfil($identity->username, $identity->password);
$auth->getStorage()->write($identity);
}
//Gestion mode edition en SESSION
if ($action=='update') {
$modeEdition = $request->getParam('modeEdition', false);
if ( $modeEdition ) {
$identity->modeEdition = true;
$auth->getStorage()->write($identity);
}
}
}
if ( $isProfilUpdated || $isPasswordUpdated ) {
$this->view->assign('message', $message);
}
@ -222,6 +206,27 @@ class UserController extends Zend_Controller_Action
$this->view->assign('action', 'update');
$this->view->assign('pref', explode(' ',$identity->pref));
}
//Liste des catégories des accès
$reponse = $ws->getCategory();
$wscategory = $reponse->item;
$this->view->assign('wscategory', $wscategory);
//Liste de tous les droits
$listeDroits = $ws->getListeDroits();
$droitsLib = array();
foreach($listeDroits->item as $droit) {
$droitsLib[strtoupper($droit->code)] = $droit->desc;
}
$this->view->assign('droitsLib', $droitsLib);
//Liste de toutes les préférences
$listePrefs = $ws->getListePrefs();
$prefsLib = array();
foreach($listePrefs->item as $pref) {
$prefsLib[strtoupper($pref->code)] = $pref->desc;
}
$this->view->assign('prefsLib', $prefsLib);
}
/**
@ -480,6 +485,23 @@ class UserController extends Zend_Controller_Action
}
}
/**
* Changer la langue de l'utilisateur
*/
public function langAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$lang = $this->getRequest()->getParam('lang', null);
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$identity->langtmp = $lang;
$auth->getStorage()->write($identity);
}
/**
* Changer le theme de l'utilisateur

View File

@ -12,7 +12,7 @@ pour en savoir plus cliquez-ici</a></span>
<p>&copy; 2006-<?php echo date('Y')?> Scores &amp; D&eacute;cisions SAS -
Tous droits r&eacute;serv&eacute;s -
<a href="http://www.scores-decisions.com/mentions.php" target="_blank">
Mentions l&eacute;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>
Mentions l&eacute;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>

View File

@ -0,0 +1 @@
<div class="infoData"></div>

View File

@ -38,6 +38,11 @@ Session
WKHTMLTOPDF
-----------
- Get the static version of wkhtmltopdf
- On Ubuntu :
sudo apt-get install libxrender1 libfontconfig
- Set execution flag (chmod +x)
- Test
Configure your environment
==========================

31733
docs/extra/browscap.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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';
}
}
}

View File

@ -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

View File

@ -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;
}
/**

View File

@ -1 +0,0 @@
DEVP-2AGF-AAFD-GAEY-BF6F-829C

View File

@ -2529,7 +2529,7 @@ class XYChart extends BaseChart {
}
function addBarLayer($data = Null, $color = -1, $name = "", $depth = 0) {
if ($data != Null)
if (!is_null($data))
return new BarLayer(callmethod("XYChart.addBarLayer", $this->ptr, $data, $color, $name, $depth));
else
return $this->addBarLayer2();
@ -2541,7 +2541,7 @@ class XYChart extends BaseChart {
return new BarLayer(callmethod("XYChart.addBarLayer3", $this->ptr, $data, $colors, $names, $depth));
}
function addLineLayer($data = Null, $color = -1, $name = "", $depth = 0) {
if ($data != Null)
if (!is_null($data))
return new LineLayer(callmethod("XYChart.addLineLayer", $this->ptr, $data, $color, $name, $depth));
else
return $this->addLineLayer2();
@ -2550,7 +2550,7 @@ class XYChart extends BaseChart {
return new LineLayer(callmethod("XYChart.addLineLayer2", $this->ptr, $dataCombineMethod, $depth));
}
function addAreaLayer($data = Null, $color = -1, $name = "", $depth = 0) {
if ($data != Null)
if (!is_null($data))
return new AreaLayer(callmethod("XYChart.addAreaLayer", $this->ptr, $data, $color, $name, $depth));
else
return $this->addAreaLayer2();
@ -2559,7 +2559,7 @@ class XYChart extends BaseChart {
return new AreaLayer(callmethod("XYChart.addAreaLayer2", $this->ptr, $dataCombineMethod, $depth));
}
function addHLOCLayer($highData = Null, $lowData = Null, $openData = Null, $closeData = Null, $color = -1) {
if ($highData != Null)
if (!is_null($highData))
return $this->addHLOCLayer3($highData, $lowData, $openData, $closeData, $color, $color);
else
return $this->addHLOCLayer2();

View File

@ -1,5 +1,12 @@
$(document).ready(function(){
$('img.flag').on('click', function() {
var url = window.location.href;
$.post('user/lang', {lang: $(this).attr('id')}, function(data){
window.location.href = url;
});
});
//Auto Scroll
$(window).scroll(function(e) {
e.stopPropagation();

View File

@ -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"
@ -36,8 +35,8 @@ profil.mail.email.production = supportdev@scores-decisions.com
profil.path.cache = APPLICATION_PATH "/../data/cache"
profil.path.files = APPLICATION_PATH "/../data/files"
profil.path.pages = APPLICATION_PATH "/../data/pages"
profil.path.data = "/mnt/data/vhosts/data/extranet"
profil.wkhtmltopdf.path = "/sites/data/wkhtml/linux/wkhtmltopdf-amd64"
profil.path.data = "/home/vhosts/data/extranet"
profil.wkhtmltopdf.path = "/home/vhosts/data/wkhtml/wkhtmltopdf-amd64"
profil.db.sdv1.adapter=mysqli
profil.db.sdv1.params.host=localhost
profil.db.sdv1.params.username=extranet

View File

@ -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"

View File

@ -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"

View File

@ -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"