Skip to content

Commit

Permalink
Dev: Twig renderer can break without Yii::app()->session['survey_'.$a…
Browse files Browse the repository at this point in the history
…Datas['aSurveyInfo']['sid']]['s_lang']

Dev: since Yii:app()->language is set at start of survey model : take it
Dev: even without survey : current lang can be another than default (survey listing)
Dev: just control if it's in current survey
  • Loading branch information
Shnoulle committed Sep 12, 2018
1 parent 050b4d8 commit 0ffc127
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions application/core/LSETwigViewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,9 @@ private function getAdditionalInfos($aDatas, $oTemplate)
// We retreive the definition of the core class and attributes (in the future, should be template dependant done via XML file)
$aDatas["aSurveyInfo"] = array_merge($aDatas["aSurveyInfo"], $oTemplate->getClassAndAttributes());

$languagecode = Yii::app()->getConfig('defaultlang');
if (!empty($aDatas['aSurveyInfo']['sid'])) {
if (Yii::app()->session['survey_'.$aDatas['aSurveyInfo']['sid']]['s_lang']) {
$languagecode = Yii::app()->session['survey_'.$aDatas['aSurveyInfo']['sid']]['s_lang'];
} elseif ($aDatas['aSurveyInfo']['sid'] && Survey::model()->findByPk($aDatas['aSurveyInfo']['sid'])) {
$languagecode = Yii::app()->getLanguage();
if (!empty($aDatas['aSurveyInfo']['sid']) && Survey::model()->findByPk($aDatas['aSurveyInfo']['sid']) ) {
if(!in_array($languagecode,Survey::model()->findByPk($aDatas['aSurveyInfo']['sid'])->getAllLanguages())) {
$languagecode = Survey::model()->findByPk($aDatas['aSurveyInfo']['sid'])->language;
}
}
Expand Down

0 comments on commit 0ffc127

Please sign in to comment.