diff --git a/application/controllers/admin/templates.php b/application/controllers/admin/templates.php index 98671c1e86e..7be22e2183b 100644 --- a/application/controllers/admin/templates.php +++ b/application/controllers/admin/templates.php @@ -772,33 +772,16 @@ protected function _templatesummary($templatename, $screenname, $editfile, $temp * @return string[] */ protected function getValidScreenFiles($templatename) - { - $aScreenFiles = array('assessment.pstpl', - 'clearall.pstpl', - 'completed.pstpl', - 'endgroup.pstpl', - 'endpage.pstpl', - 'groupdescription.pstpl', - 'load.pstpl', - 'navigator.pstpl', - 'printanswers.pstpl', - 'privacy.pstpl', - 'question.pstpl', - 'register.pstpl', - 'save.pstpl', - 'surveylist.pstpl', - 'startgroup.pstpl', - 'startpage.pstpl', - 'survey.pstpl', - 'welcome.pstpl', - 'print_survey.pstpl', - 'print_group.pstpl', - 'print_question.pstpl'); + { + $oEditedTemplate = Template::model()->getTemplateConfiguration($templatename); - /// TODO : use config.xml - if (is_file(Yii::app()->getConfig('usertemplaterootdir') . '/' . $templatename . '/question_start.pstpl')) - $aScreenFiles[] = 'question_start.pstpl'; + $aScreenFiles = array(); + $filesFromXML = (array) $oEditedTemplate->templateEditor->screens->xpath('//file'); + foreach( $filesFromXML as $file){ + $aScreenFiles[] = (string) $file; + } + $aScreenFiles = array_unique($aScreenFiles); return $aScreenFiles; } @@ -1243,7 +1226,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma case 'save': $aSurveyListConfig = (array) $oEditedTemplate->templateEditor->screens->save; - $files = $aSurveyListConfig['file']; + $files = $aSurveyListConfig['file']; $myoutput = Yii::app()->twigRenderer->renderTemplateFromFile("layout_save.twig", array('aSurveyInfo'=>$thissurvey), true); break;