Skip to content

Commit

Permalink
Fixed issue #15612: Public stats didn't have any theme part, graphic …
Browse files Browse the repository at this point in the history
…is broken (#1717)
  • Loading branch information
gabrieljenik committed Jan 19, 2021
1 parent 952582a commit d755f2b
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 2 deletions.
9 changes: 7 additions & 2 deletions application/controllers/Statistics_userController.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,14 @@ 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);
//$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
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,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
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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>



Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="public-stats__content">
{% if statisticsoutput %}
{{ statisticsoutput }}
{% endif %}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
</div>
<input type='hidden' class='hidemenubutton'/>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -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 d755f2b

Please sign in to comment.