Skip to content

Commit

Permalink
Dev: moved classes, id and attribute to core for warnings.twig
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Aug 18, 2017
1 parent 6e46db6 commit 2f94e9c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
12 changes: 11 additions & 1 deletion application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -113,6 +113,8 @@ public function run($surveyid,$args)
$this->setPreview();
}



$this->moveSubmitIfNeeded();
$this->setGroup();

Expand Down Expand Up @@ -907,7 +909,8 @@ private function displayFirstPageIfNeeded()
// submit page.
if ($this->sSurveyMode != 'survey' && $_SESSION[$this->LEMsessid]['step'] == 0){
$_SESSION[$this->LEMsessid]['test']=time();
display_first_page($this->thissurvey);

display_first_page($this->thissurvey, $this->aSurveyInfo);
Yii::app()->end(); // So we can still see debug messages
}
}
Expand Down Expand Up @@ -1653,6 +1656,7 @@ private function setSurveySettings( $surveyid, $args )

$this->setSurveyMode();
$this->setSurveyOptions();
$this->setClassAndIds();

$this->previewgrp = ($this->sSurveyMode == 'group' && isset($param['action']) && ($param['action'] == 'previewgroup')) ? true : false;
$this->previewquestion = ($this->sSurveyMode == 'question' && isset($param['action']) && ($param['action'] == 'previewquestion')) ? true : false;
Expand Down Expand Up @@ -1728,6 +1732,12 @@ private function setGroup()
}
}

private function setClassAndIds()
{
$this->aSurveyInfo['class']['activealert'] = ' alert alert-warning alert-dismissible fade in alert-dismissible ';
$this->aSurveyInfo['class']['errorHtml'] = ' fade in alert-dismissible ls-questions-have-errors alert alert-danger ';
}

private function fixMaxStep()
{
// NOTE: must stay after setPreview because of ()$this->sSurveyMode == 'group' && $this->previewgrp) condition touching step
Expand Down
4 changes: 3 additions & 1 deletion application/helpers/frontend_helper.php
Expand Up @@ -2059,9 +2059,11 @@ function getReferringUrl()
/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page($thissurvey) {
function display_first_page($thissurvey, $aSurveyInfo)
{
global $token, $surveyid;

$thissurvey = $aSurveyInfo;
$thissurvey['aNavigator'] = getNavigatorDatas();

LimeExpressionManager::StartProcessingPage();
Expand Down
4 changes: 2 additions & 2 deletions templates/default/views/subviews/warnings.twig
Expand Up @@ -28,15 +28,15 @@
{# Preview mode warning #}
{% if aSurveyInfo.active != 'Y' %}
<!-- Preview mode warning -->
<div class="alert alert-warning alert-dismissible fade in alert-dismissible" role="alert">
<div class="{{ aSurveyInfo.class.activealert }}" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
{{ "This survey is currently not active. You will not be able to save your responses." | t }}
</div>
{% endif %}

{# Error Html warnings #}
{% if aSurveyInfo.errorHtml.show %}
<p class=' {# Uncomment to hide when popup is on { aSurveyInfo.errorHtml.hiddenClass } #} fade in alert-dismissible ls-questions-have-errors alert alert-danger {% if (aSurveyInfo.options.animatealert == "on") %} animated {{ aSurveyInfo.options.alertanimation }} {%endif%}' role='alert'>
<p class=' {# Uncomment to hide when popup is on { aSurveyInfo.errorHtml.hiddenClass } #} {{ aSurveyInfo.class.errorHtml }} {% if (aSurveyInfo.options.animatealert == "on") %} animated {{ aSurveyInfo.options.alertanimation }} {%endif%}' role='alert'>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
{% for aMessage in aSurveyInfo.errorHtml.messages %}
<!-- Error Html warnings -->
Expand Down

0 comments on commit 2f94e9c

Please sign in to comment.