Skip to content

Commit

Permalink
Fixed issue #15611: No HTML wrapper in public stats (#1696)
Browse files Browse the repository at this point in the history
Created new twig views for statistics for using as frame (based on print view)
  • Loading branch information
gabrieljenik committed Dec 30, 2020
1 parent 40f4b4c commit 8045be8
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 2 deletions.
7 changes: 5 additions & 2 deletions application/controllers/Statistics_userController.php
Expand Up @@ -247,9 +247,12 @@ public function actionAction($surveyid, $language = null)
//~ $prb->hide();
}

$data['aSurveyInfo'] = getSurveyInfo($iSurveyID);
$data['graphUrl'] = Yii::app()->getController()->createUrl("admin/statistics/sa/graph");

Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . 'statistics_user.js');
$this->layout = "public";
$this->render('/statistics_user_view', $data);
$data['aSurveyInfo']['include_content'] = 'statistics_user';
Yii::app()->twigRenderer->renderTemplateFromFile('layout_statistics_user.twig', $data, false);

//Delete all Session Data
Yii::app()->session['finished'] = true;
Expand Down
10 changes: 10 additions & 0 deletions themes/survey/bootswatch/config.xml
Expand Up @@ -255,6 +255,16 @@
<file type="view" role="subview">./subviews/printanswers/printanswers_foot.twig</file>
</printanswers>

<statistics_user>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('Public statistics')}} ]]></screen_title>
<file type="view" role="layout">layout_statistics_user.twig</file>
<file type="view" role="subview">./subviews/content/outerframe.twig</file>
<file type="view" role="content">./subviews/content/statistics_user.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_head.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_content.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_foot.twig</file>
</statistics_user>

<pdf>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('PDF')}} ]]></screen_title>
<file type="view" role="layout">layout_print.twig</file>
Expand Down
10 changes: 10 additions & 0 deletions themes/survey/vanilla/config.xml
Expand Up @@ -273,6 +273,16 @@
<file type="view" role="subview">./subviews/printanswers/printanswers_foot.twig</file>
</printanswers>

<statistics_user>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('Public statistics')}} ]]></screen_title>
<file type="view" role="layout">layout_statistics_user.twig</file>
<file type="view" role="subview">./subviews/content/outerframe.twig</file>
<file type="view" role="content">./subviews/content/statistics_user.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_head.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_content.twig</file>
<file type="view" role="subview">./subviews/statistics_user/statistics_user_foot.twig</file>
</statistics_user>

<pdf>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('PDF')}} ]]></screen_title>
<file type="view" role="layout">layout_print.twig</file>
Expand Down
33 changes: 33 additions & 0 deletions themes/survey/vanilla/views/layout_statistics_user.twig
@@ -0,0 +1,33 @@
{#
LimeSurvey
Copyright (C) 2007-2020 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Public Statistics Layout ·._.·´¯)·._.·´¯)
This is the layout that will be used to show the public statistics.
#}
{% extends 'layout_global.twig' %}
{% block ajaxindicator %}{% endblock %}
{% block pjaxbegin %}{% endblock %}
{% block body %}
{% block nav_bar %}
{{ parent() }}
{% endblock %}
{{ registerScript("StatisticsUserBaseScripts", "var graphUrl = " ~ graphUrl ~ ";", "POS_BEGIN") }}
{% block content %}
{% set sViewContent = './subviews/content/' ~ aSurveyInfo.include_content ~ '.twig' %}
{% include './subviews/content/outerframe.twig' with {'include_content': sViewContent } %}
{% endblock %}
{% endblock %}
{% block footer %}
{{ parent() }}
{% endblock %}
{% block pjaxend %}{% endblock %}
21 changes: 21 additions & 0 deletions themes/survey/vanilla/views/subviews/content/statistics_user.twig
@@ -0,0 +1,21 @@
{#
LimeSurvey
Copyright (C) 2007-2020 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Public Statistics Layout ·._.·´¯)·._.·´¯)
This file displays the page shown to user when viewing the statistics after taking a survey.
NOTE: see layout_main.twig for more infos
#}<section>
{{ include('./subviews/statistics_user/statistics_user_head.twig') }}
{{ include('./subviews/statistics_user/statistics_user_content.twig') }}
{{ include('./subviews/statistics_user/statistics_user_foot.twig') }}
</section>
12 changes: 12 additions & 0 deletions themes/survey/vanilla/views/subviews/statistics_user/index.html
@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>LimeSurvey</title>
</head>
<body>
</body>
</html>



@@ -0,0 +1,5 @@
<div class="public-stats__content">
{% if statisticsoutput %}
{{ statisticsoutput }}
{% endif %}
</div>
@@ -0,0 +1,5 @@
</div>
<input type='hidden' class='hidemenubutton'/>
</div>
</div>
</div>
@@ -0,0 +1,29 @@

{#
LimeSurvey
Copyright (C) 2007-2020 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Public Statistics Header ._.·´¯)·._.·´¯)
This is the head for the public statistics page.
#}

<div class="container public-stats">
<div class="row">
<div class="col-sm-12">
<div id='statsContainer'>
<div id='statsHeader'>
<h2 class='statsSurveyTitle public-stats__title'>{{ aSurveyInfo.surveyls_title }}</h2>
<div class='statsNumRecords public-stats__num-records'>{{ gT("Total records in survey") }} : {{ totalrecords }}</div>
</div>



0 comments on commit 8045be8

Please sign in to comment.