1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template mod_questionnaire/results_choice
|
|
|
19 |
|
|
|
20 |
Template which defines a results display for responses with defined choices. This template uses a simple level of HTML,
|
|
|
21 |
suitable for being translated into a PDF file by the TCPDF library.
|
|
|
22 |
|
|
|
23 |
Classes required for JS:
|
|
|
24 |
* /mod/questionnaire/module.js
|
|
|
25 |
|
|
|
26 |
Data attributes required for JS:
|
|
|
27 |
* none
|
|
|
28 |
|
|
|
29 |
Context variables required for this template:
|
|
|
30 |
|
|
|
31 |
Example context (json):
|
|
|
32 |
{
|
|
|
33 |
"responses": [
|
|
|
34 |
{
|
|
|
35 |
"response": {
|
|
|
36 |
"text": "choice 1",
|
|
|
37 |
"alt1": "alt1",
|
|
|
38 |
"image1": "http://localhost/mod/questionnaire/images/hbar_1.gif",
|
|
|
39 |
"alt2": "alt2",
|
|
|
40 |
"width2": "28",
|
|
|
41 |
"image2": "http://localhost/mod/questionnaire/images/hbar.gif",
|
|
|
42 |
"alt3": "alt3",
|
|
|
43 |
"image3": "http://localhost/mod/questionnaire/images/hbar_r.gif",
|
|
|
44 |
"percent": "20%",
|
|
|
45 |
"total": 2
|
|
|
46 |
}
|
|
|
47 |
},
|
|
|
48 |
{
|
|
|
49 |
"response": {
|
|
|
50 |
"text": "choice 2",
|
|
|
51 |
"alt1": "alt1",
|
|
|
52 |
"image1": "http://localhost/mod/questionnaire/images/hbar_1.gif",
|
|
|
53 |
"alt2": "alt2",
|
|
|
54 |
"width2": "28",
|
|
|
55 |
"image2": "http://localhost/mod/questionnaire/images/hbar.gif",
|
|
|
56 |
"alt3": "alt3",
|
|
|
57 |
"image3": "http://localhost/mod/questionnaire/images/hbar_r.gif",
|
|
|
58 |
"percent": "20%",
|
|
|
59 |
"total": 2
|
|
|
60 |
}
|
|
|
61 |
}
|
|
|
62 |
],
|
|
|
63 |
"total": {
|
|
|
64 |
"alt1": "alt1",
|
|
|
65 |
"image1": "http://localhost/mod/questionnaire/images/hbar_1.gif",
|
|
|
66 |
"alt2": "alt2",
|
|
|
67 |
"width2": "28",
|
|
|
68 |
"image2": "http://localhost/mod/questionnaire/images/hbar.gif",
|
|
|
69 |
"alt3": "alt3",
|
|
|
70 |
"image3": "http://localhost/mod/questionnaire/images/hbar_r.gif",
|
|
|
71 |
"percent": "20%",
|
|
|
72 |
"total": "8/10"
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
}}
|
|
|
76 |
<!-- Begin HTML generated from results_choice template. -->
|
|
|
77 |
{{#responses.0}}
|
|
|
78 |
<table class="generaltable">
|
|
|
79 |
<thead>
|
|
|
80 |
<tr>
|
|
|
81 |
<th class="header c0" style="text-align:left;width:50%;" scope="col">{{#str}} response, mod_questionnaire {{/str}}</th>
|
|
|
82 |
<th class="header c1" style="text-align:left;width:40%;" scope="col">{{#str}} average, mod_questionnaire {{/str}}</th>
|
|
|
83 |
<th class="header c2 lastcol" style="text-align:right;width:10%;" scope="col">{{#str}} total, mod_questionnaire {{/str}}</th>
|
|
|
84 |
</tr>
|
|
|
85 |
</thead>
|
|
|
86 |
<tbody>
|
|
|
87 |
{{/responses.0}}
|
|
|
88 |
{{#responses}}
|
|
|
89 |
{{#response}}
|
|
|
90 |
<tr class=""{{^response.evencolor}} style="background-color: #E5E5E6"{{/response.evencolor}}>
|
|
|
91 |
<td class="cell c0" style="text-align:left;width:50%;">{{response.text}}</td>
|
|
|
92 |
<td class="cell c1" style="text-align:left;width:40%;white-space:nowrap;">
|
|
|
93 |
<img style="height:9px; width:4px;" alt="{{response.alt1}}" src="{{response.image1}}" /><img style="height:9px; width:{{response.width2}}px;" alt="{{response.alt2}}" src="{{response.image2}}" /><img style="height:9px; width:4px;" alt="{{response.alt3}}" src="{{response.image3}}" />
|
|
|
94 |
{{{response.percent}}}
|
|
|
95 |
</td>
|
|
|
96 |
<td class="cell c2 lastcol" style="text-align:right;width:10%;">{{response.total}}</td>
|
|
|
97 |
</tr>
|
|
|
98 |
{{/response}}
|
|
|
99 |
{{/responses}}
|
|
|
100 |
{{#total}}
|
|
|
101 |
<tr{{#total.evencolor}} style="background-color: #E5E5E6"{{/total.evencolor}}>
|
|
|
102 |
<td colspan="3"><div class="tabledivider"> </div></td>
|
|
|
103 |
</tr>
|
|
|
104 |
<tr class="lastrow"{{^total.evencolor}} style="background-color: #E5E5E6"{{/total.evencolor}}>
|
|
|
105 |
<td class="cell c0" style="text-align:left;width:50%;">{{#str}} totalresponses, mod_questionnaire{{/str}}</td>
|
|
|
106 |
<td class="cell c1" style="text-align:left;width:40%;white-space:nowrap;">
|
|
|
107 |
<img style="height:9px; width:4px;" alt="{{alt1}}" src="{{image1}}" /><img style="height:9px; width:{{width2}}px;" alt="{{alt2}}" src="{{image2}}" /><img style="height:9px; width:4px;" alt="{{alt3}}" src="{{image3}}" />
|
|
|
108 |
{{{percent}}}
|
|
|
109 |
</td>
|
|
|
110 |
<td class="cell c2 lastcol" style="text-align:right;width:10%;">{{total}}</td>
|
|
|
111 |
</tr>
|
|
|
112 |
{{/total}}
|
|
|
113 |
{{#responses.0}}
|
|
|
114 |
</tbody>
|
|
|
115 |
</table>
|
|
|
116 |
{{/responses.0}}
|
|
|
117 |
{{^responses}}
|
|
|
118 |
<p class="generaltable"> {{#str}} noresponsedata, questionnaire{{/str}}</p>
|
|
|
119 |
{{/responses}}
|
|
|
120 |
<!-- End HTML generated from results_choice template. -->
|