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/result
19
 
20
    This template will render a result choices inside a H5P activity results report.
21
 
22
    Variables required for this template:
23
    * description - Result description text
24
    * score - Score string (for example: 2 out of 4)
25
 
26
    Variables optional for this template:
27
    * hasoptions - If an option table must be present
28
    * optionslabel - The right label for available options on this result type
29
    * options - An array of mod_h5pactivity/local/result/options compatible array
30
    * content - Extra content in HTML
31
    * track - Indicate if the result has displayable tracking
32
 
33
    Example context (json):
34
    {
35
        "timecreated": "1587655101",
36
        "interactiontype": "choice",
37
        "description": "Example of some results",
38
        "rawscore": "4",
39
        "maxscore": "4",
40
        "duration": "130",
41
        "completion": "1",
42
        "success": "1",
43
        "hasoptions": true,
44
        "optionslabel": "Choice",
45
        "options": [
46
            {
47
                "description": "Choice 1 text",
48
                "id": 0,
49
                "useranswer": {
50
                    "answer": "Correct answer",
51
                    "pass": true
52
                },
53
                "correctanswer": {
54
                    "answer": "Answer checked",
55
                    "checked": true
56
                }
57
            },
58
            {
59
                "description": "Choice 2 text",
60
                "id": 1,
61
                "useranswer": {
62
                    "answer": "Wrong answer",
63
                    "fail": true
64
                },
65
                "correctanswer": {
66
                    "answer": "Answer checked",
67
                    "unchecked": true
68
                }
69
            },
70
            {
71
                "description": "Choice 3 text",
72
                "id": 2,
73
                "useranswer": {
74
                    "answer": "This was the correct text",
75
                    "correct": true
76
                },
77
                "correctanswer": {
78
                    "answer": "This was the correct text",
79
                    "text": true
80
                }
81
            },
82
            {
83
                "description": "Choice 4 text",
84
                "id": 3,
85
                "correctanswer": {
86
                    "answer": "Some text",
87
                    "text": true
88
                }
89
            },
90
            {
91
                "description": "Choice 4 text",
92
                "id": 3,
93
                "useranswer": {
94
                    "answer": "Some wrong text",
95
                    "incorrect": true
96
                }
97
            }
98
        ],
99
        "score": "4 out of 4",
100
        "content": "<p>This is an optional extra content in <b>HTML</b>.</p>",
101
        "track": true
102
    }
103
 
104
}}
105
 
106
<div class="container-fluid w-100 my-0 p-0">
107
    <div class="row w-100 py-3 px-1 m-0 p-md-3">
108
        {{>mod_h5pactivity/local/result/header}}
109
        {{{content}}}
110
        {{#hasoptions}}
111
            {{>mod_h5pactivity/local/result/options}}
112
        {{/hasoptions}}
113
        {{^track}}
114
            <div class="alert alert-warning w-100" role="alert">
115
              {{#str}}no_compatible_track, mod_h5pactivity, {{interactiontype}}{{/str}}
116
            </div>
117
        {{/track}}
118
    </div>
119
</div>