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">
120
    <div class="rui-badge-overview-wrapper border rounded p-4 mt-0 mb-2 d-inline-flex flex-wrap align-items-start w-100">
121
        <div id="badge-image-col" class="border rounded p-3 mr-md-6 w-100 w-md-auto">
122
            <img src="{{badgeimage}}" alt="{{imagecaption}}" width="100" 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="rui-badge-overview">
141
            <h2 class="rui-badge-name">{{badgename}}</h2>
142
            <div class="rui-badge-desc mt-3 mb-4">{{{badgedescription}}}</div>
143
 
144
            {{#recipientname}}
145
            <div id="badge-awardedto" class="badge-xs badge-sq badge-info mb-2">
146
                {{#recipientnotification}}
147
                    {{> core/notification_warning}}
148
                {{/recipientnotification}}
149
                {{#str}}awardedto, core_badges, {{recipientname}}{{/str}}
150
            </div>
151
            {{/recipientname}}
152
 
153
            <div id="badge-issued-expire" class="pt-1 small">
154
                <div class="pb-2">
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
 
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="rui-hostedurl">
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="rui-coursefullname">
206
                    {{#str}}
207
                        course,
208
                        core_badges,
209
                        {{coursefullname}}
210
                    {{/str}}
211
                </div>
212
                {{/coursefullname}}
213
            </div>
214
            {{#badgetag}}
215
                <p class="rui-badgetag">
216
                    {{> core_tag/taglist}}
217
                </p>
218
            {{/badgetag}}
219
 
220
        </div>
221
    </div>
222
 
223
        <div id="badge-criteria" class="rui-badge-criteria my-4">
224
            <h5 class="d-inline-flex align-items-center w-100">
225
                <svg class="mr-2" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
226
                <path d="M10.75 13.25H6.75L13.25 4.75V10.75H17.25L10.75 19.25V13.25Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>
227
                {{#str}}bcriteria, core_badges{{/str}}
228
            </h5>
229
            <div class="ml-5">
230
            {{{criteria}}}
231
            </div>
232
        </div>
233
 
234
        {{#hasotherfields}}
235
        <div id="badge-other-fields">
236
            <a data-toggle="collapse" class="btn btn-sm btn-secondary" href="#collapseOtherDetails" role="button" aria-expanded="false" aria-controls="collapseOtherDetails">
237
                {{#str}}moredetails, core_badges{{/str}}
238
            </a>
239
            <div class="collapse mt-5 mx-0" id="collapseOtherDetails">
240
                <div class="container ml-0">
241
                    {{#version}}
242
                        <dl>
243
                            <dt>
244
                                {{#str}}version, core_badges{{/str}}
245
                            </dt>
246
                            <dd>
247
                                {{version}}
248
                            </dd>
249
                        </dl>
250
                    {{/version}}
251
 
252
                    {{#language}}
253
                        <dl>
254
                            <dt>
255
                                {{#str}}language, core_badges{{/str}}
256
                            </dt>
257
                            <dd>
258
                                {{language}}
259
                            </dd>
260
                        </dl>
261
                    {{/language}}
262
 
263
                    {{#imageauthorname}}
264
                        <dl>
265
                            <dt>
266
                                {{#str}}imageauthorname, core_badges{{/str}}
267
                            </dt>
268
                            <dd>
269
                                {{imageauthorname}}
270
                            </dd>
271
                        </dl>
272
                    {{/imageauthorname}}
273
 
274
                    {{#imageauthoremail}}
275
                        <dl>
276
                            <dt>
277
                                {{#str}}imageauthoremail, core_badges{{/str}}
278
                            </dt>
279
                            <dd>
280
                                {{{imageauthoremail}}}
281
                            </dd>
282
                        </dl>
283
                    {{/imageauthoremail}}
284
 
285
                    {{#imageauthorurl}}
286
                        <dl>
287
                            <dt>
288
                                {{#str}}imageauthorurl, core_badges{{/str}}
289
                            </dt>
290
                            <dd>
291
                                <a href="{{imageauthorurl}}" target="_blank">{{imageauthorurl}}</a>
292
                            </dd>
293
                        </dl>
294
                    {{/imageauthorurl}}
295
                    {{#imagecaption}}
296
                        <dl>
297
                            <dt>
298
                                {{#str}}imagecaption, core_badges{{/str}}
299
                            </dt>
300
                            <dd>
301
                                {{imagecaption}}
302
                            </dd>
303
                        </dl>
304
                    {{/imagecaption}}
305
                </div>
306
 
307
            {{#endorsement}}
308
                <h4>{{#str}}endorsement, core_badges{{/str}}</h4>
309
                <div class="container ml-0">
310
                    <dl>
311
                        <dt>
312
                            {{#str}}issuername, core_badges{{/str}}
313
                        </dt>
314
                        <dd>
315
                            {{issuername}}
316
                        </dd>
317
                    </dl>
318
 
319
                    <dl>
320
                        <dt>
321
                            {{#str}}issueremail, core_badges{{/str}}
322
                        </dt>
323
                        <dd>
324
                            {{{issueremail}}}
325
                        </dd>
326
                    </dl>
327
 
328
                    <dl>
329
                        <dt>
330
                            {{#str}}issuerurl, core_badges{{/str}}
331
                        </dt>
332
                        <dd>
333
                            <a href="{{issuerurl}}" target="_blank">{{issuerurl}}</a>
334
                        </dd>
335
                    </dl>
336
 
337
                    <dl>
338
                        <dt>
339
                            {{#str}}dateawarded, core_badges{{/str}}
340
                        </dt>
341
                        <dd>
342
                            {{#userdate}}{{dateissued}}, {{#str}} strftimedatetime, langconfig {{/str}}{{/userdate}}
343
                        </dd>
344
                    </dl>
345
 
346
                    <dl>
347
                        <dt>
348
                            {{#str}}claimid, core_badges{{/str}}
349
                        </dt>
350
                        <dd>
351
                            <a href="{{claimid}}" target="_blank">{{claimid}}</a>
352
                        </dd>
353
                    </dl>
354
 
355
                    <dl>
356
                        <dt>
357
                            {{#str}}claimcomment, core_badges{{/str}}
358
                        </dt>
359
                        <dd>
360
                            {{claimcomment}}
361
                        </dd>
362
                    </dl>
363
                </div>
364
            {{/endorsement}}
365
 
366
            {{#hasrelatedbadges}}
367
                <h4>{{#str}}relatedbages, core_badges{{/str}}</h4>
368
                <ul>
369
            {{/hasrelatedbadges}}
370
            {{#relatedbadges}}
371
                <li>
372
                {{#url}}<a href="{{url}}" target="_blank">{{/url}}
373
                    {{name}}
374
                {{#url}}</a>{{/url}}
375
                </li>
376
            {{/relatedbadges}}
377
            {{#hasrelatedbadges}}
378
                </ul>
379
            {{/hasrelatedbadges}}
380
 
381
            {{#hasalignments}}
382
                <h4>{{#str}}alignment, core_badges{{/str}}</h4>
383
                <ul>
384
            {{/hasalignments}}
385
            {{#alignments}}
386
                <li>
387
                    <a href="{{targeturl}}" target="_blank">{{targetname}}</a>
388
                </li>
389
            {{/alignments}}
390
            {{#hasalignments}}
391
                </ul>
392
            {{/hasalignments}}
393
            </div>
394
        </div>
395
        {{/hasotherfields}}
396
</div>