Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
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_h5pactivity/local/result/options
19
 
20
    This template will render a choices table inside a H5P activity results report.
21
 
22
    Variables required for this template:
23
    * options - An array of options
24
    * optionslabel - The right label for options column
25
    * correctlabel - The right label for correct answer column
26
    * answerlabel - The right label for the attempt answer column
27
 
28
    Example context (json):
29
    {
30
        "optionslabel": "Choice",
31
        "correctlabel": "Correct answer",
32
        "answerlabel": "Attempt answer",
33
        "options": [
34
            {
35
                "description": "Choice 1 text",
36
                "id": 0,
37
                "useranswer": {
38
                    "answer": "Correct answer",
39
                    "pass": true
40
                },
41
                "correctanswer": {
42
                    "answer": "Answer checked",
43
                    "checked": true
44
                }
45
            },
46
            {
47
                "description": "Choice 2 text",
48
                "id": 1,
49
                "useranswer": {
50
                    "answer": "Wrong answer",
51
                    "fail": true
52
                },
53
                "correctanswer": {
54
                    "answer": "Answer checked",
55
                    "unchecked": true
56
                }
57
            },
58
            {
59
                "description": "Choice 3 text",
60
                "id": 2,
61
                "useranswer": {
62
                    "answer": "This was the correct text",
63
                    "correct": true
64
                },
65
                "correctanswer": {
66
                    "answer": "This was the correct text",
67
                    "text": true
68
                }
69
            },
70
            {
71
                "description": "Choice 4 text",
72
                "id": 3,
73
                "correctanswer": {
74
                    "answer": "Some text",
75
                    "text": true
76
                }
77
            },
78
            {
79
                "description": "Choice 4 text",
80
                "id": 3,
81
                "useranswer": {
82
                    "answer": "Some wrong text",
83
                    "incorrect": true
84
                }
85
            }
86
        ]
87
    }
88
 
89
}}
90
<table class="table table-striped">
91
  <thead>
92
    <tr>
93
        <th scope="col">{{optionslabel}}</th>
94
        <th scope="col">{{correctlabel}}</th>
95
        <th scope="col">{{answerlabel}}</th>
96
    </tr>
97
  </thead>
98
  <tbody>
99
    {{#options}}
100
    <tr>
101
        <td>{{description}}</td>
102
        <td>{{#correctanswer}}{{>mod_h5pactivity/local/result/answer}}{{/correctanswer}}</td>
103
        <td>{{#useranswer}}{{>mod_h5pactivity/local/result/answer}}{{/useranswer}}</td>
104
    </tr>
105
    {{/options}}
106
    {{#score}}
107
    <tr class="table-light">
108
        <td colspan="2" class="d-none d-sm-table-cell border-top-3 border-dark"></td>
109
        <td class="d-none d-sm-table-cell border-top border-dark">
110
            <strong>{{#str}}score, mod_h5pactivity{{/str}}: {{score}}</strong>
111
        </td>
112
        <td class="d-table-cell d-sm-none text-right border-top border-dark" colspan="3">
113
            <strong>{{#str}}score, mod_h5pactivity{{/str}}: {{score}}</strong>
114
        </td>
115
    </tr>
116
    {{/score}}
117
  </tbody>
118
</table>