Skip to content

Commit

Permalink
Dev: added a configuration option to force XML or DB settings for sur…
Browse files Browse the repository at this point in the history
…vey rendering

Dev: for easy developpement, a little bit like asset manager on or off
  • Loading branch information
LouisGac committed Jul 13, 2017
1 parent fd8c1a4 commit 695453c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions application/config/config-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -688,5 +688,8 @@
// Hide update key
$config['hide_update_key']=false;

$config['force_xmlsettings_for_survey_rendering']=false;
$config['force_dbsettings_for_survey_rendering']=false;

return $config;
//settings deleted
8 changes: 8 additions & 0 deletions application/models/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ public static function isStandardTemplate($sTemplateName)
*/
public static function getInstance($sTemplateName='', $iSurveyId='', $bForceXML=false)
{

// Template developper could prefer to work with XML rather than DB as a first step, for quick and easy changes
if (App()->getConfig('force_xmlsettings_for_survey_rendering') && YII_DEBUG){
$bForceXML=true;
}elseif(App()->getConfig('force_xmlsettings_for_survey_rendering' && YII_DEBUG)){
$bForceXML=false;
}

if (empty(self::$instance)) {
self::$instance = self::getTemplateConfiguration($sTemplateName, $iSurveyId, $bForceXML);
}
Expand Down

0 comments on commit 695453c

Please sign in to comment.