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/attempts
19
 
20
    This template will render the report link inside a H5P activity.
21
 
22
    Variables required for this template:
23
    * attempts - Full attempts list with:
24
      * timemodified - Attempt timemodified
25
      * attempt - Attempt number
26
      * rawscore - Attempt rawscore
27
      * maxscore - Attempt maxscore
28
      * duration - Attempt duration
29
      * completionicon - Completion icon HTML
30
      * successicon - Success icon HTML
31
      * reporturl - Attempt report URL
32
 
33
    Variables optional for this template:
34
    * title - optional selected attempt name
35
    * scored - The scored attempt
36
 
37
    Example context (json):
38
    {
39
        "attempts": [
40
            {
41
                "id": 7,
42
                "h5pactivityid": 1,
43
                "userid": 5,
44
                "timecreated": 1587654916,
45
                "timemodified": 1587654916,
46
                "attempt": 1,
47
                "rawscore": 6,
48
                "maxscore": 6,
49
                "duration": "14 seconds",
50
                "durationcompact": "14''",
51
                "completion": 1,
52
                "completionicon": "<i class=\"icon fa fa-check-circle fa-fw \"><\/i>",
53
                "success": 1,
54
                "successicon": "<i class=\"icon fa fa-check-circle fa-fw \"><\/i>",
55
                "scaled": 1,
56
                "reporturl": {},
57
                "score": "6 out of 6"
58
            },
59
            {
60
                "id": 8,
61
                "h5pactivityid": 1,
62
                "userid": 5,
63
                "timecreated": 1587654927,
64
                "timemodified": 1587654927,
65
                "attempt": 2,
66
                "rawscore": 1,
67
                "maxscore": 6,
68
                "duration": "25 seconds",
69
                "durationcompact": "25''",
70
                "completion": 1,
71
                "completionicon": "<i class=\"icon fa fa-check-circle fa-fw \"><\/i>",
72
                "success": 0,
73
                "successicon": "<i class=\"icon fa fa-circle-o fa-fw \"><\/i>",
74
                "scaled": 0,
75
                "reporturl": {},
76
                "score": "1 out of 6"
77
            },
78
            {
79
                "id": 9,
80
                "h5pactivityid": 1,
81
                "userid": 5,
82
                "timecreated": 1587654942,
83
                "timemodified": 1587654942,
84
                "attempt": 3,
85
                "rawscore": 3,
86
                "maxscore": 6,
87
                "duration": "40 seconds",
88
                "durationcompact": "40''",
89
                "completion": 1,
90
                "completionicon": "<i class=\"icon fa fa-check-circle fa-fw \"><\/i>",
91
                "success": 0,
92
                "successicon": "<i class=\"icon fa fa-circle-o fa-fw \"><\/i>",
93
                "scaled": 0,
94
                "reporturl": {},
95
                "score": "3 out of 6"
96
            }
97
        ]
98
    }
99
 
100
}}
101
<table class="table">
102
  <thead>
103
    <tr>
104
      <th scope="col">#</th>
105
      <th scope="col">{{#str}} date {{/str}}</th>
106
      <th scope="col">{{#str}} score, mod_h5pactivity {{/str}}</th>
107
      <th scope="col" class="d-none d-md-table-cell">{{#str}} maxscore, mod_h5pactivity {{/str}}</th>
108
      <th scope="col" class="d-none d-sm-table-cell">{{#str}} duration, mod_h5pactivity {{/str}}</th>
109
      <th scope="col" class="d-none d-sm-table-cell" class="text-center">{{#str}} completion, mod_h5pactivity {{/str}}</th>
110
      <th scope="col" class="text-center">{{#str}} success {{/str}}</th>
111
      <th scope="col">{{#str}} report {{/str}}</th>
112
    </tr>
113
  </thead>
114
  <tbody>
115
    {{#attempts}}
116
    <tr>
117
      <th scope="row">{{attempt}}</th>
118
      <td>
119
        <span class="d-none d-lg-inline">
120
          {{#userdate}} {{timemodified}}, {{#str}} strftimedatetime, core_langconfig {{/str}} {{/userdate}}
121
        </span>
122
        <span class="d-inline d-lg-none">
123
          {{#userdate}} {{timemodified}}, {{#str}} strftimedatetimeshort, core_langconfig {{/str}} {{/userdate}}
124
        </span>
125
      </td>
126
      <td>{{rawscore}}<span class="d-inline d-md-none"> / {{maxscore}}</span></td>
127
      <td class="d-none d-md-table-cell">{{maxscore}}</td>
128
      <td class="d-none d-sm-table-cell">
129
        <span class="d-none d-md-inline">{{duration}}</span>
130
        <span class="d-inline d-md-none">{{durationcompact}}</span>
131
      </td>
132
      <td class="text-center d-none d-sm-table-cell">{{{completionicon}}}</td>
133
      <td class="text-center">{{{successicon}}}</td>
134
      <td>
135
        <span class="d-none d-md-inline">
136
          <a href="{{{reporturl}}}">{{#str}} view_report, mod_h5pactivity {{/str}}</a>
137
        </span>
138
        <span class="d-inline d-md-none">
139
          <a href="{{{reporturl}}}">{{#str}} view {{/str}}</a>
140
        </span>
141
      </td>
142
    </tr>
143
    {{/attempts}}
144
  </tbody>
145
</table>