First commit

This commit is contained in:
Tammo ter Hark 2026-06-17 10:06:07 +02:00
commit b7fcf64bbf
5 changed files with 2180 additions and 0 deletions

View file

@ -0,0 +1,223 @@
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Survey List Layout ·._.·´¯)·._.·´¯)
This file renders the list of publicly listed surveys in your LimeSurvey home page.
NOTE: see layout_main.twig for more infos
#}
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Global Layout ·._.·´¯)·._.·´¯)
This is the global layout that will be used to displayed most pages (less the error page)
If you're creating your own template, remember there is no obligation to respect the current file flow of this template.
This is different from the old LimeSurvey template engine, where you had to provide every one of the pstpl files.
Here, you must have a file called main_layout.twig (called from SurveyRuntimeHelper::run() ).
Other than that, you're free to organize your files and inclusions as you want.
(¯`·._.·(¯`·._.· Bootstrap ·._.·´¯)·._.·´¯)
LimeSurvey uses Bootstrap.
See: https://getbootstrap.com
This template is an instance of Bootswatch Theme Flatly.
See: https://bootswatch.com/
(¯`·._.·(¯`·._.· Twig Engine ·._.·´¯)·._.·´¯)
The template engine uses Twig.
See: http://twig.sensiolabs.org/
The main variable is aSurveyInfo. It's an array containing the main information about the survey.
aSurveyInfo also contains other needed arrays, such as aNavigator, or aQuestionGroups (which contain aQuestions), etc.
If you want to see what is availabe in aSurveyInfo, turn debug mode on in application/config.php, and copy the following line to the end of the <body> element below:
{{ dump(aSurveyInfo) }}
To echo a variable, just insert : {{ variable }}
To translate a string, just insert : {{gT( string )}}
NOTE: aSurveyInfo should be cleaned to remove the unnecessary data.
(¯`·._.·(¯`·._.· Twig Engine: advanced ·._.·´¯)·._.·´¯)
For security reason, Twig is in a sandBox.
About sandBox, see: http://twig.sensiolabs.org/doc/2.x/api.html#sandbox-extension
Available functions/Object Methods are defined in internal.php: components => twigRenderer
Eg:
Functions : 'include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'getAllQuestionClasses', 'getShowqnumcode', 'intval'
Methods :
- CHtml::textfield() (and: form, link, emailField, beginForm, endForm, dropDownList,htmlButton)
- Survey::getAllLanguages()
- LSHttpRequest::getParam()
If you need to add simple functions or static methods, just add them to internal.php.
If you need to add complex process, use application/core/LS_Twig_Extension.php (more help/comments there)
NOTE: Feel free to ask for functions, variables, etc, that you feel are missing - https://bugs.limesurvey.org/my_view_page.php
#}
<!DOCTYPE html>
<html lang="{{ aSurveyInfo.languagecode }}" dir="{{ aSurveyInfo.dir }}"
class="{{ aSurveyInfo.languagecode }} dir-{{ aSurveyInfo.dir }} {{ aSurveyInfo.class.html }}" {{ aSurveyInfo.attr.html }}>
{# Headers, metadata, etc #}
{{ include('./subviews/header/head.twig') }}
<body
class=" {{ aSurveyInfo.class.body }} font-{{ aSurveyInfo.options.font }} lang-{{ aSurveyInfo.languagecode }} {{ aSurveyInfo.surveyformat }} {% if( aSurveyInfo.options.brandlogo == "on") %}brand-logo{% endif %}" {{ aSurveyInfo.attr.body }} >
{# This used for the pjax system #}
<div id="beginScripts">
<###begin###>
</div>
{# Ajaxify cannot handle an element that is a direct child of body, so => create simple wrapper section #}
<article>
<div id="{{ aSurveyInfo.id.dynamicreload }}">
{% block body %}
{# Bootstrap Navigation Bar: the top menu #}
{% block nav_bar %}
{{ include('./subviews/header/nav_bar.twig') }}
{% endblock %}
{# Replace the content block #}
{% block content %}
<div class="container-fluid">
{{ registerTemplateCssFile('./css/survey-list.css') }}
<div class="{{ aSurveyInfo.class.surveylistrow }} row"
id="{{ aSurveyInfo.id.surveylistrow }}" {{ aSurveyInfo.attr.surveylistrow }}>
<div class="col-12">
{# include the alert for no JavaScript #}
{{ include('./subviews/messages/no_js_alert.twig') }}
{# <div class="row justify-content-center">
<div
id="{{ aSurveyInfo.id.surveylistrowjumbotron }}" {{ aSurveyInfo.attr.surveylistrowjumbotron }}>
{{ image('./files/survey_list_header.png', aSurveyInfo.name, {"class": "img-fluid mx-auto d-block"}) }}
<span class="text-center">{{ aSurveyInfo.sSiteName }}</span>
</div>
</div> #}
<div class="row">
<div class="col-4"></div>
<div class="col">
<div id="surveylist-language-changer" class="ls-js-hidden">
{{ include('./subviews/navigation/language_changer_form.twig') }}
</div>
</div>
</div>
{# <div class="row">
<div class="{{ aSurveyInfo.class.surveylistrowdiva }} col-12" {{ aSurveyInfo.attr.surveylistrowdiva }}>
<div class='{{ aSurveyInfo.class.surveylistrowdivadiv }} h3' {{ aSurveyInfo.attr.surveylistrowdivadiv }}>
{{ gT("The following surveys are available:") }}
</div>
</div> #}
</div>
<div class="row">
<div
class="{{ aSurveyInfo.class.surveylistrowdivb }} col-12" {{ aSurveyInfo.attr.surveylistrowdivb }}>
<div
class='{{ aSurveyInfo.class.surveylistrowdivbdiv }}' {{ aSurveyInfo.attr.surveylistrowdivbdiv }}>
<ul class='{{ aSurveyInfo.class.surveylistrowdivbdivul }} list-unstyled ' {{ aSurveyInfo.attr.surveylistrowdivbdivul }}>
{% for key, oSurvey in aSurveyInfo.publicSurveys %}
<li class="{{ aSurveyInfo.class.surveylistrowdivbdivulli }} btn-group col-12 col-md-6" {{ aSurveyInfo.attr.surveylistrowdivbdivulli }}>
<a
href="{{ oSurvey.sSurveyUrl }}"
title="{{ gT("Start survey") }}"
lang="{{ oSurvey.language }}"
class="{{ aSurveyInfo.class.surveylistrowdivbdivullia }} btn btn-primary col-12">
{{ oSurvey.localizedTitle }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
</div>
<div class="row">
<div
class="{{ aSurveyInfo.class.surveylistrowdivc }} col-12 " {{ aSurveyInfo.attr.surveylistrowdivc }}>
{{ sprintf( gT("Please contact %s ( %s ) for further assistance."), aSurveyInfo.sSiteAdminName, aSurveyInfo.sSiteAdminEmail ) }}
</div>
</div>
</div>
</div>
{#
<div id="{{ aSurveyInfo.id.surveylistfooter }}"
class="{{ aSurveyInfo.class.surveylistfooter }}" {{ aSurveyInfo.attr.surveylistfooter }}>
<div
class="{{ aSurveyInfo.class.surveylistfootercont }} container" {{ aSurveyInfo.attr.surveylistfootercont }}>
<div {{ aSurveyInfo.attr.surveylistfootercontp }} class="row">
<div class="col-6 col-md-12">
<a {{ aSurveyInfo.attr.surveylistfootercontpaa }}>
{{ image("./files/poweredby.png", "LimeSurvey Survey Software", {class: 'img-fluid'}) }}
</a>
</div>
<div class="col-12 d-block d-sm-none d-md-block text-center">
<a {{ aSurveyInfo.attr.surveylistfootercontpab }}>
The Online Survey Tool
</a>
- Free & Open Source
</div>
<div class="col-6 d-none d-sm-block d-md-none text-center">
<a {{ aSurveyInfo.attr.surveylistfootercontpab }}>
Online Surveytool
</a>
</div>
</div>
</div>
</div> #}
</div>
{% endblock %}
{# Basic ThemeScript options #}
{{ registerScript("BasicThemeScripts", " if(window.basicThemeScripts === undefined){ window.basicThemeScripts = new ThemeScripts(); } basicThemeScripts.initGlobal(); ", "POS_END") }}
{% endblock %}
</div>
</article>
{% block footer %}
{{ include('./subviews/footer/footer.twig') }}
{% endblock %}
<div id="bottomScripts">
<###end###>
</div>
{% block themescripts %}
<script>
window.basicThemeScripts.init();
</script>
{% endblock %}
</body>
</html>

View file

@ -0,0 +1,205 @@
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Custom Header ·._.·´¯)·._.·´¯)
If you extend a template, and want to add custom headers (js, css, scripts, meta etc), you'd rather do it here.
#}
{# Custom logo option #}
{# Custom backgroud option #}
<style>
html, body {
font-size: {{ aSurveyInfo.options.fontsize }} !important;
}
{% if (aSurveyInfo.options.backgroundimage == "on" and imageSrc(aSurveyInfo.options.backgroundimagefile )) %}
body {
background-image: url({{ imageSrc(aSurveyInfo.options.backgroundimagefile ) }});
background-attachment: {{ aSurveyInfo.options.backgroundimagefixed }};
background-size: {{ aSurveyInfo.options.backgroundimagedisplay }};
}
body .top-container {
background-color: rgba(236, 240, 241, 0.2);
}
{% endif %}
body {
padding-bottom: 10px;
/*padding-top: 60px;!* now is redefine in JS to fit any title length *!*/
background-color:{{ aSurveyInfo.options.bodybackgroundcolor }} ;
color: {{ aSurveyInfo.options.fontcolor }};
}
.table {
color: {{ aSurveyInfo.options.fontcolor }};
}
.question-title-container {
font-size: {{ aSurveyInfo.options.questiontitlefontsize }};
font-weight: {{ aSurveyInfo.options.questiontitlefontweight }};
background: {{ aSurveyInfo.options.questiontitlebackgroundcolor }};
color: {{ aSurveyInfo.options.questiontitlefontcolor }};
}
.group-title {
font-size: {{ aSurveyInfo.options.grouptitlefontsize }};
font-weight: {{ aSurveyInfo.options.grouptitlefontweight }};
}
.group-description {
font-size: {{ aSurveyInfo.options.groupdescriptionfontsize }};
font-weight: {{ aSurveyInfo.options.groupdescriptionfontweight }};
}
.privacy-block, .privacy .form-check {
background-color: {{ aSurveyInfo.options.privacybackgroundcolor }};
}
{% if ( aSurveyInfo.options.brandlogo == "on" ) %}
body .top-container {
margin-top: 0;
}
{% endif %}
{% if (aSurveyInfo.options.questionborder == "box" ) %}
.question-container,
#welcome-container,
.save-form,
#surveys-list-container,
.privacy {
border: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ aSurveyInfo.options.questionbordercolor }};
}
{% endif %}
{% if (aSurveyInfo.options.questionborder == "top" ) %}
.question-container,
#welcome-container,
.save-form,
#surveys-list-container,
.privacy {
border-top: 1px {{ aSurveyInfo.options.questionborderstyle }} {{ aSurveyInfo.options.questionbordercolor }};
}
{% endif %}
{% if (aSurveyInfo.options.questionborder == "none" ) %}
.question-container,
#welcome-container,
.save-form,
#surveys-list-container,
.privacy {
border: none;
}
{% endif %}
.question-container,
#welcome-container,
.save-form,
#surveys-list-container,
.privacy {
border-radius: {{ aSurveyInfo.options.questionborderradiusTL }}px {{ aSurveyInfo.options.questionborderradiusTR }}px {{ aSurveyInfo.options.questionborderradiusBR }}px {{ aSurveyInfo.options.questionborderradiusBL }}px;
}
.question-title-container{
border-radius: {{ aSurveyInfo.options.questionborderradiusTL }}px {{ aSurveyInfo.options.questionborderradiusTR }}px 0 0;
}
{% if (aSurveyInfo.options.questiondropdown == "on" ) %}
.question-container,
#welcome-container,
.privacy-block,
.save-form,
#surveys-list-container {
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4);
}
.privacy{
margin-top:30px;
}
{% endif %}
{% if (aSurveyInfo.options.questiondropdown == "hover" ) %}
.question-container:hover,
#welcome-container:hover,
.save-form:hover,
#surveys-list-container:hover,
.privacy:hover {
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.4);
}
.privacy{
margin-top:30px;
}
{% endif %}
.navbar-light{
background-color: {{ aSurveyInfo.options.headerbackgroundcolor }};
}
.navbar-default .navbar-nav > li > a:hover {
color: {{ aSurveyInfo.options.fontcolor }};
}
.progress {
background: {{ aSurveyInfo.options.progressbarbackgroundcolor }};
}
label::after,
.radio-item label::after{
background-color: {{ aSurveyInfo.options.checkboxcolor }};
}
.progress-bar {
background: {{ aSurveyInfo.options.progressbarcolor }};
color: {{ aSurveyInfo.options.progressbarfontcolor }};
}
.question-container, #welcome-container {
background: {{ aSurveyInfo.options.questionbackgroundcolor }};
}
.question-help-container, .question-valid-container {
background: {{ aSurveyInfo.options.questionhelpbackgroundcolor }};
}
.slider-handle {
background: {{ aSurveyInfo.options.sliderhandlecolor }};
}
.btn-primary {
background: {{ aSurveyInfo.options.primarycolor }};
}
.bg-primary{
background-color: {{ aSurveyInfo.options.questiontitlebackgroundcolor }};
color: {{ aSurveyInfo.options.questiontitlefontcolor }};
}
.btn-primary:hover, .btn-primary:focus {
background: {{ aSurveyInfo.options.primarycolor }};
}
.btn-check:active+.btn-primary,
.btn-check:checked+.btn-primary,
.btn-primary.active,
.btn-primary:active,
.show>.btn-primary.dropdown-toggle,
.show > .btn-primary.dropdown-toggle,
.btn-primary:focus {
background: {{ aSurveyInfo.options.primarycolor }};
}
{% set checkicon = '"\\' ~ aSurveyInfo.options.checkicon ~ '"' %}
.checkbox-item input[type="checkbox"]:checked + label::after, .checkbox-item input[type="radio"]:checked + label::after {
content: {{ checkicon }};
}
</style>

View file

@ -0,0 +1,67 @@
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Bootstrap Navigation Bar ·._.·´¯)·._.·´¯)
This file renders a typical bootstrap navigation bar.
See: https://getbootstrap.com/components/#navbar
For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
#}
{% if not aSurveyInfo.popupPreview %}
{% set navClass = "navbar-light bg-light" %}
{% if( aSurveyInfo.template == "bootswatch") %}
{% set navClass = "navbar-default bg-primary" %}
{% endif %}
<!-- Bootstrap Navigation Bar -->
{# ShowMenu used for navbar-toggler and navbar-collapse #}
{% set ShowMenu = (aSurveyInfo.aNavigator.load.show == "Y" or aSurveyInfo.aNavigator.save.show == "Y")
or ((aSurveyInfo.bShowClearAll == true or aSurveyInfo.bShowClearAll == null) and aSurveyInfo.options.showclearall == 'on')
or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A')
or (aSurveyInfo.alanguageChanger.show)
%}
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md fixed-top border-bottom pt-0 pb-0">
<div class="container-fluid">
{% if ShowMenu %}
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar"
aria-controls="small-screens-menus" aria-expanded="false">
<span class="visually-hidden-focusable">{{ gT("Tools") }}</span>
<span class="navbar-toggler-icon" aria-hidden="true"></span>
</button>
{% endif %}
{# Logo option #}
{% if( aSurveyInfo.options.brandlogo == "on") %}
<div class="navbar-brand logo-container d-none d-md-block">
{{ image(aSurveyInfo.options.brandlogofile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% else %}
<div class="navbar-brand">
{{ aSurveyInfo.name }}
</div>
{% endif %}
{% if( aSurveyInfo.options.secondlogo == "on") %}
<div class="navbar-brand logo-container d-none d-md-block">
{{ image(aSurveyInfo.options.secondlogofile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
</div>
{% endif %}
{% if ShowMenu %}
<div id="navbar" class="collapse navbar-collapse navbar-nav-scroll pt-2">
<ul class="nav navbar-nav navbar-action-link navbar-right ms-auto">
{{ include('./subviews/navigation/save_links.twig') }}
{{ include('./subviews/navigation/clearall_links.twig') }}
{{ include('./subviews/navigation/question_index_menu.twig') }}
{{ include('./subviews/navigation/language_changer_top_menu.twig') }}
</ul>
</div>
{% endif %}
</div>
</div>
{% endif %}

View file

@ -0,0 +1,30 @@
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Group Name ·._.·´¯)·._.·´¯)
Presentation of the group description
NOTE: see views/subviews/survey/group.twig comments for more infos
#}
{% if aGroup.showgroupinfo == 'D' or aGroup.showgroupinfo == 'B' %}
{% if aGroup.description != '' %}
<!-- Group description -->
<div class="{{ aSurveyInfo.class.groupdesc }} " {{ aSurveyInfo.attr.groupdesc }}>
<div>
{{ processString(aGroup.description) }}
</div>
</div>
{% endif %}
{% endif %}

View file

@ -0,0 +1,55 @@
{#
LimeSurvey
Copyright (C) 2007-2017 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.
(¯`·._.·(¯`·._.· Question Layout ·._.·´¯)·._.·´¯)
This file is one of the most important of the rendering progress.
It will render a question. It's included in the for loop in group.twig
Here, you have access to the array aQuestion that contains the data of the current question.
To see what's inside aQuestion, turn debug mode on, and copy the following line to the end of this file:
{{ dump(aQuestion) }}
All content of aQuestion itself is generated from qanda_helper.
To modify it, you must create a question theme and apply it to the question in its display settings
(here, you're inside the survey theme, applied to the survey in its settings).
#}
{# Showing question code/number is a survey level setting, so it's inside the array aSurveyInfo #}
{% set aShow = aSurveyInfo.aShow %}
<!-- Question {{ aQuestion.code }} -->
{# Question Text #}
{{ include('./subviews/survey/question_subviews/question_text_container.twig') }}
{# Survey question Help - top position #}
{% if aSurveyInfo.options.questionhelptextposition == 'top' %}
{{ include('./subviews/survey/question_subviews/survey_question_help.twig') }}
{# Valide message and help #}
{{ include('./subviews/survey/question_subviews/valid_message_and_help.twig') }}
{% endif %}
{# Answers #}
{{ include('./subviews/survey/question_subviews/answers.twig') }}
{# Survey question Help - bottom position #}
{% if aSurveyInfo.options.questionhelptextposition == 'bottom' %}
{{ include('./subviews/survey/question_subviews/survey_question_help.twig') }}
{# Valide message and help #}
{{ include('./subviews/survey/question_subviews/valid_message_and_help.twig') }}
{% endif %}
<!-- End of question {{ aQuestion.code }} -->