Skip to content

Commit

Permalink
Dev: use template manifest to get the list of valid screen files
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jun 13, 2017
1 parent 08dc7af commit 0eb922e
Showing 1 changed file with 9 additions and 26 deletions.
35 changes: 9 additions & 26 deletions application/controllers/admin/templates.php
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 0eb922e

Please sign in to comment.