Skip to content

Commit

Permalink
Dev: added more views to the template editor
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Oct 30, 2017
1 parent 80db3dd commit 1bc1b3e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 25 deletions.
52 changes: 27 additions & 25 deletions application/controllers/admin/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
$screens['surveylist'] = gT('Survey List Page','unescaped');
$screens['error'] = gT('Error','unescaped');
$screens['assessments'] = gT('Assessments','unescaped');
$screens['register'] = gT('Registration','unescaped');
$screens['printanswers'] = gT('Participant print answers','unescaped');

Yii::app()->session['s_lang'] = Yii::app()->session['adminlang'];

Expand Down Expand Up @@ -963,26 +965,26 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
break;

case 'register':
$sLayoutFile = ""; // TODO
$myoutput[] = templatereplace(file_get_contents("$templatedir/startpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);

$aData = array(
'aReplacements' => array_merge($aGlobalReplacements,array(
'SURVEYNAME' => 'Survey name'
))
);
$myoutput = array_merge($myoutput, doreplacement($oEditedTemplate->viewPath . "/survey.pstpl", $aData, $oEditedTemplate));

$aData['aReplacements'] = array_merge($aGlobalReplacements,array(
'REGISTERERROR' => 'Example error message',
'REGISTERMESSAGE1' => 'Register message 1',
'REGISTERMESSAGE2' => 'Register message 2',
'REGISTERFORM' => $this->getController()->renderPartial('/admin/templates/templateeditor_register_view', array('alt' => true), true),
));

$myoutput = array_merge($myoutput, doreplacement($oEditedTemplate->viewPath . "/register.pstpl", $aData, $oEditedTemplate));
$myoutput[] = templatereplace(file_get_contents("$templatedir/endpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
$myoutput[] = "\n";
// $sLayoutFile = ""; // TODO
// $myoutput[] = templatereplace(file_get_contents("$templatedir/startpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);

// $aData = array(
// 'aReplacements' => array_merge($aGlobalReplacements,array(
// 'SURVEYNAME' => 'Survey name'
// ))
// );
// $myoutput = array_merge($myoutput, doreplacement($oEditedTemplate->viewPath . "/survey.pstpl", $aData, $oEditedTemplate));

// $aData['aReplacements'] = array_merge($aGlobalReplacements,array(
// 'REGISTERERROR' => 'Example error message',
// 'REGISTERMESSAGE1' => 'Register message 1',
// 'REGISTERMESSAGE2' => 'Register message 2',
// 'REGISTERFORM' => $this->getController()->renderPartial('/admin/templates/templateeditor_register_view', array('alt' => true), true),
// ));

// $myoutput = array_merge($myoutput, doreplacement($oEditedTemplate->viewPath . "/register.pstpl", $aData, $oEditedTemplate));
// $myoutput[] = templatereplace(file_get_contents("$templatedir/endpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
// $myoutput[] = "\n";
break;

case 'completed':
Expand Down Expand Up @@ -1045,12 +1047,12 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
break;

case 'printanswers':
$sLayoutFile = "TODO";
$myoutput[] = templatereplace(file_get_contents("$templatedir/startpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
$myoutput[] = templatereplace(file_get_contents("$templatedir/printanswers.pstpl"), array('ANSWERTABLE' => $printoutput), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
$myoutput[] = templatereplace(file_get_contents("$templatedir/endpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
// $sLayoutFile = "TODO";
// $myoutput[] = templatereplace(file_get_contents("$templatedir/startpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
// $myoutput[] = templatereplace(file_get_contents("$templatedir/printanswers.pstpl"), array('ANSWERTABLE' => $printoutput), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);
// $myoutput[] = templatereplace(file_get_contents("$templatedir/endpage.pstpl"), array(), $aData, 'Unspecified', false, NULL, array(), false, $oEditedTemplate);

$myoutput[] = "\n";
// $myoutput[] = "\n";
break;

case 'error':
Expand Down
18 changes: 18 additions & 0 deletions templates/default/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,24 @@
<file type="css">./css/background-image.css</file>
<file type="js">./scripts/template.js</file>
</save>

<register>
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_register.twig</file>
<file type="view" role="subview">./subviews/registration/register_head.twig</file>
<file type="view" role="subview">./subviews/registration/register_form.twig</file>
<file type="view" role="subview">./subviews/registration/register_error.twig</file>
<file type="view" role="subview">./subviews/registration/register_message.twig</file>
</register>

<printanswers>
<file type="view" role="global">layout_global.twig</file>
<file type="view" role="layout">layout_printanswers.twig</file>
<file type="view" role="subview">./subviews/printanswers/printanswers_head.twig</file>
<file type="view" role="subview">./subviews/printanswers/printanswers_foot.twig</file>
<file type="view" role="subview">./subviews/printanswers/printanswers_question.twig</file>
<file type="view" role="subview">./subviews/printanswers/printanswers_table.twig</file>
</printanswers>
</screens>

</template_editor>
Expand Down

0 comments on commit 1bc1b3e

Please sign in to comment.