Skip to content

Commit

Permalink
Dev: cleaned the rendering process
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Nov 20, 2017
1 parent 235a382 commit 793c1aa
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 436 deletions.
9 changes: 5 additions & 4 deletions application/controllers/PrintanswersController.php
Expand Up @@ -97,11 +97,11 @@ function actionView($surveyid,$printableexport=FALSE)
/* Set the data for templatereplace */
$aReplacementData['title']='session-timeout';
$aReplacementData['message']=$error."<br/>".$message;

$aData = array();
$aData['aSurveyInfo']=getSurveyInfo($iSurveyID);
$aData['aError'] = $aReplacementData;

Yii::app()->twigRenderer->renderTemplateFromFile('layout_errors.twig',$aData, false);
// $content=templatereplace(file_get_contents($oTemplate->pstplPath."message.pstpl"),$aReplacementData,$this->aGlobalData);
// $this->render("/survey/system/display",array('content'=>$content));
Expand Down Expand Up @@ -131,7 +131,7 @@ function actionView($surveyid,$printableexport=FALSE)
$aData['aSurveyInfo']['groupArray'] = $groupArray;
$aData['aSurveyInfo']['printAnswersHeadFormUrl'] = Yii::App()->getController()->createUrl('printanswers/view/',array('surveyid'=>$iSurveyID, 'printableexport'=>'pdf'));
$aData['aSurveyInfo']['printAnswersHeadFormQueXMLUrl'] = Yii::App()->getController()->createUrl('printanswers/view/',array('surveyid'=>$iSurveyID, 'printableexport'=>'quexmlpdf'));

if (empty($sExportType))
{
Yii::app()->twigRenderer->renderTemplateFromFile('layout_printanswers.twig',$aData, false);
Expand All @@ -155,6 +155,7 @@ function actionView($surveyid,$printableexport=FALSE)
LimeExpressionManager::StartProcessingGroup(1,($aSurveyInfo['anonymized']!="N"),$iSurveyID);
$aData['aSurveyInfo']['printPdf'] = 1;
$html = Yii::app()->twigRenderer->renderTemplateFromFile('layout_printanswers.twig',$aData, true);
Yii::app()->clientScript->registerPackage($oTemplate->sPackageName);
$oPDF->writeHTML($html, true, false, true, false, '');

header("Pragma: public");
Expand Down Expand Up @@ -184,6 +185,6 @@ function actionView($surveyid,$printableexport=FALSE)

$sExportFileName = sanitize_filename($sSurveyName);
$quexmlpdf->Output($sExportFileName."-".$iSurveyID."-queXML.pdf",'D');
}
}
}
}

0 comments on commit 793c1aa

Please sign in to comment.