From c5bac972719a5d3542ea32feafa2f7dee4a9b10a Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Fri, 1 Dec 2017 16:08:26 +0100 Subject: [PATCH] Dev: Fix PHP echo in JS --- application/models/TemplateConfig.php | 2 + .../survey/subview/_create_survey_text.php | 46 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/application/models/TemplateConfig.php b/application/models/TemplateConfig.php index 463d336a7d0..9118b6079b3 100644 --- a/application/models/TemplateConfig.php +++ b/application/models/TemplateConfig.php @@ -899,6 +899,8 @@ public static function formatToJsonArray($oFiled) $jFiled = json_encode($oFiled); } + var_dump($jFiled); + return $jFiled; } diff --git a/application/views/admin/survey/subview/_create_survey_text.php b/application/views/admin/survey/subview/_create_survey_text.php index 99424209001..9467b385bee 100644 --- a/application/views/admin/survey/subview/_create_survey_text.php +++ b/application/views/admin/survey/subview/_create_survey_text.php @@ -1,27 +1,39 @@ + */ + +$standardthemerooturl = Yii::app()->getConfig('standardthemerooturl'); +$templaterooturl = Yii::app()->getConfig('userthemerooturl'); +$sAdminEmailAddressNeeded = gT("If you are using token functions or notifications emails you need to set an administrator email address."); -getClientScript()->registerScript("createSurveyText-variables", " - var standardthemerooturl = 'getConfig('standardthemerooturl');?>'; - var templaterooturl = 'getConfig('userthemerooturl');?>'; - var jsonUrl = ''; - var sAction = ''; - var sParameter = ''; - var sTargetQuestion = ''; - var sNoParametersDefined = ''; - var sAdminEmailAddressNeeded = '".gT("If you are using token functions or notifications emails you need to set an administrator email address.")."' - var sURLParameters = ''; - var sAddParam = ''; -", LSYii_ClientScript::POS_BEGIN); +App()->getClientScript()->registerScript( + "createSurveyText-variables", + sprintf( + "var standardthemerooturl = '%s'; + var templaterooturl = '%s'; + var jsonUrl = ''; + var sAction = ''; + var sParameter = ''; + var sTargetQuestion = ''; + var sNoParametersDefined = ''; + var sAdminEmailAddressNeeded = '%s' + var sURLParameters = ''; + var sAddParam = '';", + $standardthemerooturl, + $templaterooturl, + $sAdminEmailAddressNeeded + ), + LSYii_ClientScript::POS_BEGIN +); $count = 0; -if(isset($scripts)) -echo $scripts; +if (isset($scripts)) { + echo $scripts; +} $aSurveyLanguageSettings = $aTabContents['aSurveyLanguageSettings']; $surveyid = $aTabContents['surveyid'];