From 8045be8bb1dc95b9418e5932fbfa2e1fd2fe05f3 Mon Sep 17 00:00:00 2001 From: Gabriel Jenik Date: Wed, 30 Dec 2020 06:54:58 -0300 Subject: [PATCH] Fixed issue #15611: No HTML wrapper in public stats (#1696) Created new twig views for statistics for using as frame (based on print view) --- .../controllers/Statistics_userController.php | 7 ++-- themes/survey/bootswatch/config.xml | 10 ++++++ themes/survey/vanilla/config.xml | 10 ++++++ .../vanilla/views/layout_statistics_user.twig | 33 +++++++++++++++++++ .../subviews/content/statistics_user.twig | 21 ++++++++++++ .../views/subviews/statistics_user/index.html | 12 +++++++ .../statistics_user_content.twig | 5 +++ .../statistics_user/statistics_user_foot.twig | 5 +++ .../statistics_user/statistics_user_head.twig | 29 ++++++++++++++++ 9 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 themes/survey/vanilla/views/layout_statistics_user.twig create mode 100644 themes/survey/vanilla/views/subviews/content/statistics_user.twig create mode 100644 themes/survey/vanilla/views/subviews/statistics_user/index.html create mode 100644 themes/survey/vanilla/views/subviews/statistics_user/statistics_user_content.twig create mode 100644 themes/survey/vanilla/views/subviews/statistics_user/statistics_user_foot.twig create mode 100644 themes/survey/vanilla/views/subviews/statistics_user/statistics_user_head.twig diff --git a/application/controllers/Statistics_userController.php b/application/controllers/Statistics_userController.php index 573f95b8b38..3abad8d27f6 100644 --- a/application/controllers/Statistics_userController.php +++ b/application/controllers/Statistics_userController.php @@ -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; diff --git a/themes/survey/bootswatch/config.xml b/themes/survey/bootswatch/config.xml index 579b28dd563..c22bf85cc15 100644 --- a/themes/survey/bootswatch/config.xml +++ b/themes/survey/bootswatch/config.xml @@ -255,6 +255,16 @@ ./subviews/printanswers/printanswers_foot.twig + + + layout_statistics_user.twig + ./subviews/content/outerframe.twig + ./subviews/content/statistics_user.twig + ./subviews/statistics_user/statistics_user_head.twig + ./subviews/statistics_user/statistics_user_content.twig + ./subviews/statistics_user/statistics_user_foot.twig + + layout_print.twig diff --git a/themes/survey/vanilla/config.xml b/themes/survey/vanilla/config.xml index 0fd4869a74a..d3c39f50112 100755 --- a/themes/survey/vanilla/config.xml +++ b/themes/survey/vanilla/config.xml @@ -273,6 +273,16 @@ ./subviews/printanswers/printanswers_foot.twig + + + layout_statistics_user.twig + ./subviews/content/outerframe.twig + ./subviews/content/statistics_user.twig + ./subviews/statistics_user/statistics_user_head.twig + ./subviews/statistics_user/statistics_user_content.twig + ./subviews/statistics_user/statistics_user_foot.twig + + layout_print.twig diff --git a/themes/survey/vanilla/views/layout_statistics_user.twig b/themes/survey/vanilla/views/layout_statistics_user.twig new file mode 100644 index 00000000000..156f2007f99 --- /dev/null +++ b/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 %} diff --git a/themes/survey/vanilla/views/subviews/content/statistics_user.twig b/themes/survey/vanilla/views/subviews/content/statistics_user.twig new file mode 100644 index 00000000000..be060eb1bc6 --- /dev/null +++ b/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 +#}
+ {{ include('./subviews/statistics_user/statistics_user_head.twig') }} + {{ include('./subviews/statistics_user/statistics_user_content.twig') }} + {{ include('./subviews/statistics_user/statistics_user_foot.twig') }} +
diff --git a/themes/survey/vanilla/views/subviews/statistics_user/index.html b/themes/survey/vanilla/views/subviews/statistics_user/index.html new file mode 100644 index 00000000000..aa4602772ae --- /dev/null +++ b/themes/survey/vanilla/views/subviews/statistics_user/index.html @@ -0,0 +1,12 @@ + + + + +LimeSurvey + + + + + + + diff --git a/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_content.twig b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_content.twig new file mode 100644 index 00000000000..c9a7df89ce3 --- /dev/null +++ b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_content.twig @@ -0,0 +1,5 @@ +
+ {% if statisticsoutput %} + {{ statisticsoutput }} + {% endif %} +
diff --git a/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_foot.twig b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_foot.twig new file mode 100644 index 00000000000..7a905bacd8f --- /dev/null +++ b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_foot.twig @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_head.twig b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_head.twig new file mode 100644 index 00000000000..9cb8eaeb25b --- /dev/null +++ b/themes/survey/vanilla/views/subviews/statistics_user/statistics_user_head.twig @@ -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. + +#} + +
+
+
+
+
+

{{ aSurveyInfo.surveyls_title }}

+
{{ gT("Total records in survey") }} : {{ totalrecords }}
+
+ + +