From a53ba3c6bf044dd0fde6e1d567b5bd8214ce47d6 Mon Sep 17 00:00:00 2001 From: LouisGac Date: Mon, 7 Mar 2016 15:43:46 +0100 Subject: [PATCH] Fixed issue #10646: No error msg when validating registration form --- application/controllers/RegisterController.php | 10 +++++----- application/models/TemplateConfiguration.php | 4 ++-- application/views/register/display.php | 3 ++- templates/default/views/register.pstpl | 2 +- templates/news_paper/views/register.pstpl | 2 +- templates/ubuntu_orange/views/register.pstpl | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index 8e5db6f9619..df9448ad657 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -154,10 +154,9 @@ public function getRegisterErrors($iSurveyId){ } } - public function getRegisterForm($iSurveyId){ - + public function getRegisterForm($iSurveyId) + { $aSurveyInfo=getSurveyInfo($iSurveyId,App()->language); - $sTemplate=getTemplatePath($aSurveyInfo['template']); // Event to replace register form $event = new PluginEvent('beforeRegisterForm'); @@ -197,8 +196,9 @@ public function getRegisterForm($iSurveyId){ $aData['thissurvey'] = $aSurveyInfo; Yii::app()->setConfig('surveyID',$iSurveyId);//Needed for languagechanger $aData['languagechanger'] = makeLanguageChangerSurvey(App()->language); - - $oTemplate = Template::model()->getInstance($sTemplate); + global $oTemplate; + $oTemplate = new TemplateConfiguration; + $oTemplate->setTemplateConfiguration('',$iSurveyId); return templatereplace(file_get_contents($oTemplate->viewPath . "/register.pstpl"),$aReplacement,$aData); } diff --git a/application/models/TemplateConfiguration.php b/application/models/TemplateConfiguration.php index f51b1f618f7..cdc2b1daab7 100644 --- a/application/models/TemplateConfiguration.php +++ b/application/models/TemplateConfiguration.php @@ -99,7 +99,7 @@ public function setTemplateConfiguration($sTemplateName='', $iSurveyId='') else { $this->path = Yii::app()->getConfig("standardtemplaterootdir").DIRECTORY_SEPARATOR.$this->sTemplateName; - $this->xmlFile = $this->path.'config.xml'; + $this->xmlFile = $this->path.DIRECTORY_SEPARATOR.'config.xml'; } } @@ -107,7 +107,7 @@ public function setTemplateConfiguration($sTemplateName='', $iSurveyId='') { $this->xmlFile = $this->path.DIRECTORY_SEPARATOR.'config.xml'; } - + //var_dump(realpath ($this->xmlFile)); die(); $this->config = simplexml_load_file(realpath ($this->xmlFile)); // The template configuration. diff --git a/application/views/register/display.php b/application/views/register/display.php index 9f1c96c9800..c9cf3452228 100644 --- a/application/views/register/display.php +++ b/application/views/register/display.php @@ -1,5 +1,6 @@ getInstance($sTemplate); + global $oTemplate; + echo templatereplace(file_get_contents($oTemplate->viewPath."startpage.pstpl"),array(),$aData); echo templatereplace(file_get_contents($oTemplate->viewPath."survey.pstpl"),array(),$aData); echo $content; diff --git a/templates/default/views/register.pstpl b/templates/default/views/register.pstpl index 96730230d91..f829e142542 100644 --- a/templates/default/views/register.pstpl +++ b/templates/default/views/register.pstpl @@ -1,4 +1,4 @@ -{REGISTERERROR} +

{REGISTERMESSAGE1}

{REGISTERMESSAGE2}

{REGISTERFORM}
diff --git a/templates/news_paper/views/register.pstpl b/templates/news_paper/views/register.pstpl index 96730230d91..f829e142542 100644 --- a/templates/news_paper/views/register.pstpl +++ b/templates/news_paper/views/register.pstpl @@ -1,4 +1,4 @@ -{REGISTERERROR} +

{REGISTERMESSAGE1}

{REGISTERMESSAGE2}

{REGISTERFORM}
diff --git a/templates/ubuntu_orange/views/register.pstpl b/templates/ubuntu_orange/views/register.pstpl index 96730230d91..f829e142542 100644 --- a/templates/ubuntu_orange/views/register.pstpl +++ b/templates/ubuntu_orange/views/register.pstpl @@ -1,4 +1,4 @@ -{REGISTERERROR} +

{REGISTERMESSAGE1}

{REGISTERMESSAGE2}

{REGISTERFORM}