From 5de3d34fc6c705e2ada74e4da22403337053ef5c Mon Sep 17 00:00:00 2001 From: Denis Chenu Date: Fri, 20 Jun 2014 09:02:22 +0200 Subject: [PATCH] Dev: some other fix with language changer Dev: Again some no js issue : only the {LAGUAGECHANGER} can set the language Dev: Maybe remove/hide language question without JS (set it to read only and remove readonly in js) --- application/helpers/qanda_helper.php | 19 ++++++++++--------- scripts/survey_runtime.js | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/application/helpers/qanda_helper.php b/application/helpers/qanda_helper.php index 7a46164c05e..867482ffb5c 100644 --- a/application/helpers/qanda_helper.php +++ b/application/helpers/qanda_helper.php @@ -1371,17 +1371,19 @@ function do_language($ia) $answerlangs = Survey::model()->findByPk(Yii::app()->getConfig('surveyID'))->additionalLanguages; $answerlangs [] = Survey::model()->findByPk(Yii::app()->getConfig('surveyID'))->language; + // Get actual answer + $sLang=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')]['s_lang']; + if(!in_array($sLang,$answerlangs)) + { + $sLang=Survey::model()->findByPk(Yii::app()->getConfig('surveyID'))->language; + } $answer = "\n\t

\n" ."" ."\n"; - $answer .= "getConfig('surveyID')][$ia[1]]."\" />\n"; + $answer .= "\n"; $inputnames[]=$ia[1]; - - $answer .= "\n\n\t

\n"; + $answer .= "\n"; diff --git a/scripts/survey_runtime.js b/scripts/survey_runtime.js index 0054297b39f..4c371e6f5e1 100644 --- a/scripts/survey_runtime.js +++ b/scripts/survey_runtime.js @@ -259,6 +259,7 @@ function activateLanguageChanger(){ }).appendTo(document.body).submit(); } }else{ + $("form#limesurvey [name='lang']").not($(this)).remove();// Remove other lang $('#changelangbtn').click(); } });