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 core_badges/issued_badge
19
 
20
    Display an issued badge.
21
 
22
    Context variables required for this template:
23
    * coursefullname - Course name (only available if it's a course badge).
24
    * sitefullname - Site name (only available if it's a site badge).
25
    * badgeimage - Badge image.
26
    * expireddate - Date (in the past) when the badge expired. If expiredate is defined, this field will be empty [optional].
27
    * expireddateformatted - Formatted expired date [optional].
28
    * expiredate - Date (in the future) when the badge will expire. If expireddate is defined, this field will be empty [optional].
29
    * badgename - Badge name.
30
    * badgedescription - Badge description.
31
    * badgeissuedon - Date where the badge was issued on by the user [optional].
32
    * recipientname - User awarded with the badge [optional].
33
    * recipientnotification.message - Message to be displayed if there is some issue with the recipient [optional].
34
    * criteria - HTML code with the criteria to display.
35
    * issuedby - Badge issuer.
36
    * issuedbyemailobfuscated - Badge issuer email link obfuscated.
37
    * hasotherfields - Wheter the badge has other fields or not.
38
    * language - Badge language [optional].
39
    * version - Badge version [optional].
40
    * imageauthorname - Badge image author name [optional].
41
    * imageauthoremail - Badge image author email [optional].
42
    * imageauthorurl - Badge image author URL [optional].
43
    * imagecaption - Badge image caption [optional].
44
    * endorsement - Badge endorsement data, with id, badgeid, issuername... [optional].
45
    * hasrelatedbadges - Whether the badge has related badges or not.
46
    * relatedbadges - Array of related badges (if hasrelatedbadges is set to true).
47
    * hasalignments - Whether the badge has alignments or not.
48
    * alignments - Array of alignments (if hasalignments is set to true).
49
    * hostedurl - The URL where the badge is hosted [optional].
50
 
51
    Example context (json):
52
    {
53
        "coursefullname": "Learn Moodle 3.11 Basics",
54
        "badgeimage": "https://moodlesite/pluginfile/badges/123.jpg",
55
        "expiredate": 1656972000,
56
        "badgename": "Lean Moodle 3.11 Basics helper",
57
        "badgedescription":"This badge is awarded to people who have provided outstanding support to other participants in the MOOC",
58
        "badgeissuedon": 1625491897,
59
        "recipientname": "Judit Cortes",
60
        "recipientnotification": {
61
            "message": "This user cannot be verified as a recipient of this badge."
62
        },
63
        "criteria": "Complete <strong>ALL</strong> of the listed requirements.<ul><li>This badge has to be awarded by a user with the following role:<ul><li>Teacher</li></ul></li><li>The following activity has to be completed:<ul><li><strong>View video</strong></li></ul></li><li>The following badge has to be earned:<ul><li><strong>Lean Moodle 3.11 Basics participant</strong></li></ul></li></ul>",
64
        "issuedby": "Moodle HQ",
65
        "issuedbyemailobfuscated": "<a href=\"mailto:xxxxx\">Moodle HQ</a>",
66
        "hasotherfields": true,
67
        "language": "English",
68
        "version": "1.0beta",
69
        "imageauthorname": "Judit Blanque",
70
        "imageauthoremail": "<a href=\"mailto:xxx\">judit@moodle.invalid</a>",
71
        "imageauthorurl": "http://juditblanque.cat",
72
        "imagecaption": "This is a nice picture from my cat",
73
        "endorsement": {
74
            "id": "2",
75
            "badgeid": "13",
76
            "issuername": "Endorsement",
77
            "issuerurl": "http://endorsement.cat",
78
            "issueremail": "<a href=\"mailto:xxxx\">endorsement@moodle.invalid</a>",
79
            "claimid": "http://claim.cat",
80
            "claimcomment": "This is an endorsement comment.",
81
            "dateissued": "1625491680"
82
        },
83
        "hasrelatedbadges": true,
84
        "relatedbadges": [
85
            {
86
                "id": "12",
87
                "name": "Lean Moodle 3.11 Basics participant",
88
                "version": "",
89
                "language": "en",
90
                "type": "2",
91
                "url": "http://xxxxx/badges/overview.php?id=12"
92
            }
93
        ],
94
        "hasalignments": true,
95
        "alignments": [
96
            {
97
                "id": "3",
98
                "badgeid": "13",
99
                "targetname": "Skill 1",
100
                "targeturl": "http://skill1.cat",
101
                "targetdescription": "This is the description for \"Skill 1\"",
102
                "targetframework": "Framework name",
103
                "targetcode": "S001"
104
            },
105
            {
106
                "id": "2",
107
                "badgeid": "13",
108
                "targetname": "Alignment1",
109
                "targeturl": "http://alignment1.cat",
110
                "targetdescription": "This is the description for alignament1",
111
                "targetframework": "Framework name",
112
                "targetcode": "A1001"
113
            }
114
        ],
115
        "hostedurl": "http://externalbackpack/badge?id=ABC"
116
    }
117
}}
118
 
119
<div id="badge" class="container-fluid">
120
<div class="row">
121
    <div id="badge-image-col" class="col col-auto">
122
        <img src="{{badgeimage}}" alt="{{imagecaption}}" width="300" class="mx-auto d-block"/>
123
        {{#expireddateformatted}}
124
            <span class="expireimage">
125
                {{# pix }} i/expired, core, {{# str }} expireddate, badges, {{expireddateformatted}} {{/ str }}{{/ pix }}
126
            </span>
127
        {{/expireddateformatted}}
128
        {{#downloadurl}}
129
            <form action="{{downloadurl}}" method="post" id="downloadbadgeform">
130
                <button type="submit" class="btn btn-secondary m-1 w-100">{{#str}}download{{/str}}</button>
131
            </form>
132
        {{/downloadurl}}
133
        {{#addtobackpackurl}}
134
            <form action="{{addtobackpackurl}}" method="post" id="addtobackpackform">
135
                <button type="submit" class="btn btn-secondary m-1 w-100">{{#str}}addtobackpack, badges{{/str}}</button>
136
            </form>
137
        {{/addtobackpackurl}}
138
    </div>
139
 
140
    <div id="badge-details-col" class="col">
141
        <h2>{{badgename}}</h2>
142
 
143
        {{#recipientname}}
144
        <div id="badge-awardedto" class="pt-1 pb-2">
145
            {{#recipientnotification}}
146
                {{> core/notification_warning}}
147
            {{/recipientnotification}}
148
            {{#str}}awardedto, core_badges, {{recipientname}}{{/str}}
149
        </div>
150
        {{/recipientname}}
151
 
152
        <div id="badge-issued-expire" class="pt-1 pb-2">
153
            <div class="pb-3">
154
            <small>
155
            {{#badgeissuedon}}
156
                {{#str}}
157
                    issuedon,
158
                    core_badges,
159
                    {{#userdate}}{{badgeissuedon}}, {{#str}} strftimedatetime, langconfig {{/str}}{{/userdate}}
160
                {{/str}}
161
                <br/>
162
            {{/badgeissuedon}}
163
            {{#expiredate}}
164
                {{#str}}
165
                    expiresin,
166
                    core_badges,
167
                    {{#userdate}}{{expiredate}}, {{#str}} strftimedatetime, langconfig {{/str}}{{/userdate}}
168
                {{/str}}
169
                <br/>
170
            {{/expiredate}}
171
            {{#expireddate}}
172
                {{#str}}
173
                    expiredin,
174
                    core_badges,
175
                    {{#userdate}}{{expireddate}}, {{#str}} strftimedatetime, langconfig {{/str}}{{/userdate}}
176
                {{/str}}
177
            {{/expireddate}}
178
            </small>
179
            </div>
180
 
181
            {{#issuedby}}
182
            <div class="pb-2">
183
                {{#str}}
184
                    issuedby,
185
                    core_badges,
186
                    {{#issuedbyemailobfuscated}}
187
                        {{{issuedbyemailobfuscated}}}
188
                    {{/issuedbyemailobfuscated}}
189
                    {{^issuedbyemailobfuscated}}
190
                        {{issuedby}}
191
                    {{/issuedbyemailobfuscated}}
192
                {{/str}}
193
            </div>
194
            {{/issuedby}}
195
 
196
            {{#hostedurl}}
197
            <div class="pb-2">
198
                <a href="{{.}}" target="_blank" aria-label="{{#str}}hostedurldescription, core_badges{{/str}}">
199
                    {{#str}}hostedurl, core_badges{{/str}}
200
                </a>
201
            </div>
202
            {{/hostedurl}}
203
 
204
            {{#coursefullname}}
205
            <div class="pb-2">
206
                {{#str}}
207
                    course,
208
                    core_badges,
209
                    {{coursefullname}}
210
                {{/str}}
211
            </div>
212
            {{/coursefullname}}
213
        </div>
214
        {{#badgetag}}
215
            <p class="pb-2">
216
                {{> core_tag/taglist}}
217
            </p>
218
        {{/badgetag}}
219
 
220
        <p class="pb-4">{{{badgedescription}}}</p>
221
 
222
        <div id="badge-criteria">
223
            <h3>{{#str}}bcriteria, core_badges{{/str}}</h3>
224
            {{{criteria}}}
225
        </div>
226
 
227
        {{#hasotherfields}}
228
        <div id="badge-other-fields">
229
            <a data-toggle="collapse" href="#collapseOtherDetails" role="button" aria-expanded="false" aria-controls="collapseOtherDetails">
230
                {{#str}}moredetails, core_badges{{/str}}
231
            </a>
232
            <div class="collapse" id="collapseOtherDetails">
233
                <div class="container ml-0">
234
                    {{#version}}
235
                        <dl>
236
                            <dt>
237
                                {{#str}}version, core_badges{{/str}}
238
                            </dt>
239
                            <dd>
240
                                {{version}}
241
                            </dd>
242
                        </dl>
243
                    {{/version}}
244
 
245
                    {{#language}}
246
                        <dl>
247
                            <dt>
248
                                {{#str}}language, core_badges{{/str}}
249
                            </dt>
250
                            <dd>
251
                                {{language}}
252
                            </dd>
253
                        </dl>
254
                    {{/language}}
255
 
256
                    {{#imageauthorname}}
257
                        <dl>
258
                            <dt>
259
                                {{#str}}imageauthorname, core_badges{{/str}}
260
                            </dt>
261
                            <dd>
262
                                {{imageauthorname}}
263
                            </dd>
264
                        </dl>
265
                    {{/imageauthorname}}
266
 
267
                    {{#imageauthoremail}}
268
                        <dl>
269
                            <dt>
270
                                {{#str}}imageauthoremail, core_badges{{/str}}
271
                            </dt>
272
                            <dd>
273
                                {{{imageauthoremail}}}
274
                            </dd>
275
                        </dl>
276
                    {{/imageauthoremail}}
277
 
278
                    {{#imageauthorurl}}
279
                        <dl>
280
                            <dt>
281
                                {{#str}}imageauthorurl, core_badges{{/str}}
282
                            </dt>
283
                            <dd>
284
                                <a href="{{imageauthorurl}}" target="_blank">{{imageauthorurl}}</a>
285
                            </dd>
286
                        </dl>
287
                    {{/imageauthorurl}}
288
                    {{#imagecaption}}
289
                        <dl>
290
                            <dt>
291
                                {{#str}}imagecaption, core_badges{{/str}}
292
                            </dt>
293
                            <dd>
294
                                {{imagecaption}}
295
                            </dd>
296
                        </dl>
297
                    {{/imagecaption}}
298
                </div>
299
 
300
            {{#endorsement}}
301
                <h4>{{#str}}endorsement, core_badges{{/str}}</h4>
302
                <div class="container ml-0">
303
                    <dl>
304
                        <dt>
305
                            {{#str}}issuername, core_badges{{/str}}
306
                        </dt>
307
                        <dd>
308
                            {{issuername}}
309
                        </dd>
310
                    </dl>
311
 
312
                    <dl>
313
                        <dt>
314
                            {{#str}}issueremail, core_badges{{/str}}
315
                        </dt>
316
                        <dd>
317
                            {{{issueremail}}}
318
                        </dd>
319
                    </dl>
320
 
321
                    <dl>
322
                        <dt>
323
                            {{#str}}issuerurl, core_badges{{/str}}
324
                        </dt>
325
                        <dd>
326
                            <a href="{{issuerurl}}" target="_blank">{{issuerurl}}</a>
327
                        </dd>
328
                    </dl>
329
 
330
                    <dl>
331
                        <dt>
332
                            {{#str}}dateawarded, core_badges{{/str}}
333
                        </dt>
334
                        <dd>
335
                            {{#userdate}}{{dateissued}}, {{#str}} strftimedatetime, langconfig {{/str}}{{/userdate}}
336
                        </dd>
337
                    </dl>
338
 
339
                    <dl>
340
                        <dt>
341
                            {{#str}}claimid, core_badges{{/str}}
342
                        </dt>
343
                        <dd>
344
                            <a href="{{claimid}}" target="_blank">{{claimid}}</a>
345
                        </dd>
346
                    </dl>
347
 
348
                    <dl>
349
                        <dt>
350
                            {{#str}}claimcomment, core_badges{{/str}}
351
                        </dt>
352
                        <dd>
353
                            {{claimcomment}}
354
                        </dd>
355
                    </dl>
356
                </div>
357
            {{/endorsement}}
358
 
359
            {{#hasrelatedbadges}}
360
                <h4>{{#str}}relatedbages, core_badges{{/str}}</h4>
361
                <ul>
362
            {{/hasrelatedbadges}}
363
            {{#relatedbadges}}
364
                <li>
365
                {{#url}}<a href="{{url}}" target="_blank">{{/url}}
366
                    {{name}}
367
                {{#url}}</a>{{/url}}
368
                </li>
369
            {{/relatedbadges}}
370
            {{#hasrelatedbadges}}
371
                </ul>
372
            {{/hasrelatedbadges}}
373
 
374
            {{#hasalignments}}
375
                <h4>{{#str}}alignment, core_badges{{/str}}</h4>
376
                <ul>
377
            {{/hasalignments}}
378
            {{#alignments}}
379
                <li>
380
                    <a href="{{targeturl}}" target="_blank">{{targetname}}</a>
381
                </li>
382
            {{/alignments}}
383
            {{#hasalignments}}
384
                </ul>
385
            {{/hasalignments}}
386
            </div>
387
        </div>
388
        {{/hasotherfields}}
389
    </div>
390
</div>
391
</div>