Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 12... Línea 12...
12
// GNU General Public License for more details.
12
// GNU General Public License for more details.
13
//
13
//
14
// You should have received a copy of the GNU General Public License
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/>.
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
Línea -... Línea 16...
-
 
16
 
-
 
17
/**
-
 
18
 *
-
 
19
 * @package   theme_universe
-
 
20
 * @copyright 2025 onwards, Marcin Czaja (https://rosea.io)
-
 
21
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-
 
22
 *
-
 
23
 */
16
 
24
 
Línea 17... Línea -...
17
defined('MOODLE_INTERNAL') || die();
-
 
18
 
25
defined('MOODLE_INTERNAL') || die();
-
 
26
 
-
 
27
require_once($CFG->dirroot . "/badges/renderer.php");
-
 
28
 
-
 
29
/**
-
 
30
 * Customization - Badge Renderer
-
 
31
 * @package   theme_universe
-
 
32
 * @copyright 2025 onwards, Marcin Czaja (https://rosea.io)
-
 
33
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
19
// Badges.
34
 *
Línea -... Línea 35...
-
 
35
 */
20
require_once($CFG->dirroot . "/badges/renderer.php");
36
class theme_universe_core_badges_renderer extends core_badges_renderer {
-
 
37
 
-
 
38
    /**
21
class theme_universe_core_badges_renderer extends core_badges_renderer {
39
     * Print Badges List
22
 
40
     *
23
    // Outputs badges list.
41
     */
24
    public function print_badges_list($badges, $userid, $profile = false, $external = false) {
42
    public function print_badges_list($badges, $userid, $profile = false, $external = false) {
25
        global $USER, $CFG;
43
        global $USER, $CFG;
Línea 59... Línea 77...
59
                if (isset($badge->imageUrl)) {
77
                if (isset($badge->imageUrl)) {
60
                    $imageurl = $badge->imageUrl;
78
                    $imageurl = $badge->imageUrl;
61
                }
79
                }
62
            }
80
            }
Línea 63... Línea 81...
63
 
81
 
Línea 64... Línea 82...
64
            $name = html_writer::tag('span', $bname, array('class' => 'badge-name'));
82
            $name = html_writer::tag('span', $bname, ['class' => 'badge-name']);
65
 
83
 
66
            $image = html_writer::empty_tag('img', array('src' => $imageurl, 'class' => 'badge-image'));
84
            $image = html_writer::empty_tag('img', ['src' => $imageurl, 'class' => 'badge-image']);
67
            if (!empty($badge->dateexpire) && $badge->dateexpire < time()) {
85
            if (!empty($badge->dateexpire) && $badge->dateexpire < time()) {
68
                $image .= $this->output->pix_icon(
86
                $image .= $this->output->pix_icon(
69
                    'i/expired',
87
                    'i/expired',
70
                    get_string('expireddate', 'badges', userdate($badge->dateexpire)),
88
                    get_string('expireddate', 'badges', userdate($badge->dateexpire)),
71
                    'moodle',
89
                    'moodle',
72
                    array('class' => 'expireimage')
90
                    ['class' => 'expireimage']
73
                );
91
                );
Línea 74... Línea 92...
74
                $name .= '(' . get_string('expired', 'badges') . ')';
92
                $name .= '(' . get_string('expired', 'badges') . ')';
75
            }
93
            }
76
 
94
 
77
            $download = $status = $push = '';
95
            $download = $status = $push = '';
78
            if (($userid == $USER->id) && !$profile) {
96
            if (($userid == $USER->id) && !$profile) {
79
                $params = array(
97
                $params = [
80
                    'download' => $badge->id,
98
                    'download' => $badge->id,
81
                    'hash' => $badge->uniquehash,
99
                    'hash' => $badge->uniquehash,
82
                    'sesskey' => sesskey()
100
                    'sesskey' => sesskey(),
83
                );
101
                ];
84
                $url = new moodle_url(
102
                $url = new moodle_url(
85
                    'mybadges.php',
103
                    'mybadges.php',
86
                    $params
104
                    $params
87
                );
105
                );
88
                $notexpiredbadge = (empty($badge->dateexpire) || $badge->dateexpire > time());
106
                $notexpiredbadge = (empty($badge->dateexpire) || $badge->dateexpire > time());
89
                $userbackpack = badges_get_user_backpack();
107
                $userbackpack = badges_get_user_backpack();
90
                if (!empty($CFG->badges_allowexternalbackpack) && $notexpiredbadge && $userbackpack) {
108
                if (!empty($CFG->badges_allowexternalbackpack) && $notexpiredbadge && $userbackpack) {
91
                    $assertion = new moodle_url('/badges/assertion.php', array('b' => $badge->uniquehash));
109
                    $assertion = new moodle_url('/badges/assertion.php', ['b' => $badge->uniquehash]);
92
                    $icon = new pix_icon('t/backpack', get_string('addtobackpack', 'badges'));
110
                    $icon = new pix_icon('t/backpack', get_string('addtobackpack', 'badges'));
93
                    if (badges_open_badges_backpack_api($userbackpack->id) == OPEN_BADGES_V2) {
111
                    if (badges_open_badges_backpack_api($userbackpack->id) == OPEN_BADGES_V2) {
94
                        $addurl = new moodle_url('/badges/backpack-add.php', array('hash' => $badge->uniquehash));
112
                        $addurl = new moodle_url('/badges/backpack-add.php', ['hash' => $badge->uniquehash]);
95
                        $push = $this->output->action_icon($addurl, $icon);
113
                        $push = $this->output->action_icon($addurl, $icon);
96
                    } else if (badges_open_badges_backpack_api($userbackpack->id) == OPEN_BADGES_V2P1) {
114
                    } else if (badges_open_badges_backpack_api($userbackpack->id) == OPEN_BADGES_V2P1) {
97
                        $addurl = new moodle_url('/badges/backpack-export.php', array('hash' => $badge->uniquehash));
115
                        $addurl = new moodle_url('/badges/backpack-export.php', ['hash' => $badge->uniquehash]);
Línea 98... Línea 116...
98
                        $push = $this->output->action_icon($addurl, $icon);
116
                        $push = $this->output->action_icon($addurl, $icon);
99
                    }
117
                    }
100
                }
118
                }
101
 
119
 
102
                $downloadicon = '<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
120
                $downloadicon = '<svg width="22" height="22" fill="none" viewBox="0 0 24 24">
103
                <path stroke="currentColor"
121
                <path stroke="currentColor"
Línea 118... Línea 136...
118
                        d="M8.75 10.75L12 14.25L15.25 10.75">
136
                        d="M8.75 10.75L12 14.25L15.25 10.75">
119
                    </path>
137
                    </path>
120
                </svg>';
138
                </svg>';
121
                $download = '<a class="btn btn-icon btn-secondary" href="' . $url . '">' . $downloadicon . '</a>';
139
                $download = '<a class="btn btn-icon btn-secondary" href="' . $url . '">' . $downloadicon . '</a>';
122
                if ($badge->visible) {
140
                if ($badge->visible) {
123
                    $url = new moodle_url('mybadges.php', array('hide' => $badge->issuedid, 'sesskey' => sesskey()));
141
                    $url = new moodle_url('mybadges.php', ['hide' => $badge->issuedid, 'sesskey' => sesskey()]);
124
                    $hideicon = '<svg width="24" height="24" fill="none" viewBox="0 0 24 24">
142
                    $hideicon = '<svg width="22" height="22" fill="none" viewBox="0 0 24 24">
125
                    <path stroke="currentColor"
143
                    <path stroke="currentColor"
126
                        stroke-linecap="round"
144
                        stroke-linecap="round"
127
                        stroke-linejoin="round"
145
                        stroke-linejoin="round"
128
                        stroke-width="1.5"
146
                        stroke-width="1.5"
129
                        d="M18.6247 10C19.0646 10.8986 19.25 11.6745 19.25 12C19.25 13 17.5 18.25 12 18.25C11.2686
147
                        d="M18.6247 10C19.0646 10.8986 19.25 11.6745 19.25 12C19.25 13 17.5 18.25 12 18.25C11.2686
Línea 144... Línea 162...
144
                    $status = '<a class="btn btn-icon btn-danger" href="' . $url . '" title="' .
162
                    $status = '<a class="btn btn-icon btn-danger" href="' . $url . '" title="' .
145
                        get_string('makeprivate', 'badges') . '">' .
163
                        get_string('makeprivate', 'badges') . '">' .
146
                        $hideicon .
164
                        $hideicon .
147
                        '</a>';
165
                        '</a>';
148
                } else {
166
                } else {
149
                    $url = new moodle_url('mybadges.php', array('show' => $badge->issuedid, 'sesskey' => sesskey()));
167
                    $url = new moodle_url('mybadges.php', ['show' => $badge->issuedid, 'sesskey' => sesskey()]);
150
                    $showicon = '<svg width="24" height="24"
168
                    $showicon = '<svg width="22" height="22"
151
                        fill="none"
169
                        fill="none"
152
                        viewBox="0 0 24 24"><path stroke="currentColor"
170
                        viewBox="0 0 24 24"><path stroke="currentColor"
153
                        stroke-linecap="round"
171
                        stroke-linecap="round"
154
                        stroke-linejoin="round"
172
                        stroke-linejoin="round"
155
                        stroke-width="1.5"
173
                        stroke-width="1.5"
Línea 167... Línea 185...
167
                        '</a>';
185
                        '</a>';
168
                }
186
                }
169
            }
187
            }
Línea 170... Línea 188...
170
 
188
 
171
            if (!$profile) {
189
            if (!$profile) {
172
                $url = new moodle_url('badge.php', array('hash' => $badge->uniquehash));
190
                $url = new moodle_url('badge.php', ['hash' => $badge->uniquehash]);
173
            } else {
191
            } else {
174
                if (!$external) {
192
                if (!$external) {
175
                    $url = new moodle_url('/badges/badge.php', array('hash' => $badge->uniquehash));
193
                    $url = new moodle_url('/badges/badge.php', ['hash' => $badge->uniquehash]);
176
                } else {
194
                } else {
177
                    $hash = hash('md5', $badge->hostedUrl);
195
                    $hash = hash('md5', $badge->hostedUrl);
178
                    $url = new moodle_url('/badges/external.php', array('hash' => $hash, 'user' => $userid));
196
                    $url = new moodle_url('/badges/external.php', ['hash' => $hash, 'user' => $userid]);
179
                }
197
                }
180
            }
198
            }
181
            $actions = html_writer::tag('div', $push . $download . $status, array('class' => 'rui-badge-actions'));
199
            $actions = html_writer::tag('div', $push . $download . $status, ['class' => 'rui-badge-actions']);
182
            $items[] = html_writer::link($url, $image . $name . $actions, array('title' => $bname));
-
 
183
        }
-
 
184
 
-
 
185
        return html_writer::alist($items, array('class' => 'badges rui-list-group'));
-
 
186
    }
-
 
187
 
-
 
188
    // Prints action icons for the badge.
-
 
189
    public function print_badge_table_actions($badge, $context) {
-
 
190
        $actions = "";
-
 
191
 
-
 
192
        if (has_capability('moodle/badges:configuredetails', $context) && $badge->has_criteria()) {
-
 
193
            // Activate/deactivate badge.
-
 
194
            if ($badge->status == BADGE_STATUS_INACTIVE || $badge->status == BADGE_STATUS_INACTIVE_LOCKED) {
-
 
195
                // Activate will go to another page and ask for confirmation.
-
 
196
                $url = new moodle_url('/badges/action.php');
-
 
197
                $url->param('id', $badge->id);
-
 
198
                $url->param('activate', true);
-
 
199
                $url->param('sesskey', sesskey());
-
 
200
                $return = new moodle_url(qualified_me());
-
 
201
                $url->param('return', $return->out_as_local_url(false));
-
 
202
                $actions .= '<a class="btn btn-icon btn-outline-secondary mr-1" href="' .
-
 
203
                    $url .
-
 
204
                    '" title="' .
-
 
205
                    get_string('activate', 'badges') .
-
 
206
                    '">
-
 
207
                <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
-
 
208
                <path stroke="currentColor"
-
 
209
                    stroke-linecap="round"
-
 
210
                    stroke-linejoin="round"
-
 
211
                    stroke-width="1.5"
-
 
212
                    d="M19.25 12C19.25 13 17.5 18.25 12 18.25C6.5 18.25 4.75
-
 
213
                    13 4.75 12C4.75 11 6.5 5.75 12 5.75C17.5 5.75 19.25 11
-
 
214
                    19.25 12Z"></path>
-
 
215
                <circle cx="12" cy="12" r="2.25"
-
 
216
                    stroke="currentColor"
-
 
217
                    stroke-linecap="round"
-
 
218
                    stroke-linejoin="round"
-
 
219
                    stroke-width="1.5"></circle>
-
 
220
                </svg>
-
 
221
                </a>';
-
 
222
            } else {
-
 
223
                $url = new moodle_url(qualified_me());
-
 
224
                $url->param('lock', $badge->id);
-
 
225
                $url->param('sesskey', sesskey());
-
 
226
                $actions .= '<a class="btn btn-icon btn-outline-secondary mr-1" href="' .
-
 
227
                    $url .
-
 
228
                    '" title="' .
-
 
229
                    get_string('deactivate', 'badges') .
-
 
230
                    '">
-
 
231
                <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
-
 
232
                <path stroke="currentColor"
-
 
233
                    stroke-linecap="round"
-
 
234
                    stroke-linejoin="round"
-
 
235
                    stroke-width="1.5"
-
 
236
                    d="M18.6247 10C19.0646 10.8986 19.25 11.6745 19.25 12C19.25
-
 
237
                    13 17.5 18.25 12 18.25C11.2686 18.25 10.6035 18.1572 10
-
 
238
                    17.9938M7 16.2686C5.36209 14.6693 4.75
-
 
239
                    12.5914 4.75 12C4.75 11 6.5 5.75 12 5.75C13.7947 5.75
-
 
240
                    15.1901 6.30902 16.2558 7.09698"></path>
-
 
241
                <path stroke="currentColor"
-
 
242
                    stroke-linecap="round"
-
 
243
                    stroke-linejoin="round"
-
 
244
                    stroke-width="1.5"
-
 
245
                    d="M19.25 4.75L4.75 19.25"></path>
-
 
246
                <path stroke="currentColor"
-
 
247
                    stroke-linecap="round"
-
 
248
                    stroke-linejoin="round"
-
 
249
                    stroke-width="1.5"
-
 
250
                    d="M10.409 13.591C9.53033 12.7123 9.53033 11.2877 10.409
-
 
251
                    10.409C11.2877 9.5303 12.7123 9.5303 13.591 10.409"></path>
-
 
252
                </svg>
-
 
253
                </a>';
-
 
254
            }
-
 
255
        }
-
 
256
 
-
 
257
        // Award badge manually.
-
 
258
        if (
-
 
259
            $badge->has_manual_award_criteria() &&
-
 
260
            has_capability('moodle/badges:awardbadge', $context) &&
-
 
261
            $badge->is_active()
-
 
262
        ) {
-
 
263
            $url = new moodle_url('/badges/award.php', array('id' => $badge->id));
-
 
264
            $actions .= '<a class="btn btn-icon btn-outline-secondary mr-1" href="' .
-
 
265
                $url .
-
 
266
                '" title="' .
-
 
267
                get_string('award', 'badges') .
-
 
268
                '">
-
 
269
            <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
-
 
270
            <path d="M17.25 10C17.25 12.8995 14.8995 15.25 12 15.25C9.10051
-
 
271
            15.25 6.75 12.8995 6.75 10C6.75 7.10051 9.10051
-
 
272
            4.75 12 4.75C14.8995 4.75 17.25 7.10051 17.25 10Z"
-
 
273
                stroke="currentColor"
-
 
274
                stroke-width="1.5"
-
 
275
                stroke-linecap="round"
-
 
276
                stroke-linejoin="round"></path>
-
 
277
            <path d="M8.75 14.75L7.75 19.25L12 17.75L16.25 19.25L15.25 14.75"
-
 
278
                stroke="currentColor"
-
 
279
                stroke-width="1.5"
-
 
280
                stroke-linecap="round" stroke-linejoin="round"></path>
-
 
281
            </svg>
-
 
282
            </a>';
-
 
283
        }
-
 
284
 
-
 
285
        // Edit badge.
-
 
286
        if (has_capability('moodle/badges:configuredetails', $context)) {
-
 
287
            $url = new moodle_url('/badges/edit.php', array('id' => $badge->id, 'action' => 'badge'));
-
 
288
            $actions .= '<a class="btn btn-icon btn-outline-secondary mr-1" href="' .
-
 
289
                $url .
-
 
290
                '" title="' .
-
 
291
                get_string('edit') .
-
 
292
                '">
-
 
293
            <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
-
 
294
            <path stroke="currentColor"
-
 
295
                stroke-linecap="round"
-
 
296
                stroke-linejoin="round"
-
 
297
                stroke-width="1.5"
-
 
298
                d="M4.75 19.25L9 18.25L18.2929 8.95711C18.6834 8.56658 18.6834
-
 
299
                7.93342 18.2929 7.54289L16.4571
-
 
300
                5.70711C16.0666 5.31658 15.4334 5.31658 15.0429 5.70711L5.75
-
 
301
                15L4.75 19.25Z"></path>
-
 
302
            <path stroke="currentColor"
-
 
303
                stroke-linecap="round"
-
 
304
                stroke-linejoin="round"
-
 
305
                stroke-width="1.5"
-
 
306
                d="M19.25 19.25H13.75"></path>
-
 
307
            </svg>
-
 
308
            </a>';
-
 
309
        }
-
 
310
 
-
 
311
        // Duplicate badge.
-
 
312
        if (has_capability('moodle/badges:createbadge', $context)) {
-
 
313
            $url = new moodle_url('/badges/action.php',
-
 
314
                array('copy' => '1', 'id' => $badge->id, 'sesskey' => sesskey()));
-
 
315
            $actions .= '<a class="btn btn-icon btn-outline-secondary mr-1" href="' .
-
 
316
                $url .
-
 
317
                '" title="' . get_string('copy') . '">
-
 
318
            <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
-
 
319
            <path stroke="currentColor"
-
 
320
                stroke-linecap="round"
-
 
321
                stroke-linejoin="round"
-
 
322
                stroke-width="1.5"
-
 
323
                d="M6.5 15.25V15.25C5.5335 15.25 4.75 14.4665 4.75 13.5V6.75C4.75 5.64543 5.64543 4.75
-
 
324
                6.75 4.75H13.5C14.4665 4.75 15.25 5.5335 15.25 6.5V6.5"></path>
-
 
325
            <rect width="10.5"
-
 
326
                height="10.5"
-
 
327
                x="8.75"
-
 
328
                y="8.75"
-
 
329
                stroke="currentColor"
-
 
330
                stroke-linecap="round"
-
 
331
                stroke-linejoin="round"
-
 
332
                stroke-width="1.5"
-
 
333
                rx="1.5"></rect>
-
 
334
            </svg>
-
 
335
            </a>';
-
 
336
        }
-
 
337
 
-
 
338
        // Delete badge.
-
 
339
        if (has_capability('moodle/badges:deletebadge', $context)) {
-
 
340
            $url = new moodle_url(qualified_me());
-
 
341
            $url->param('delete', $badge->id);
-
 
342
            $actions .= '<a class="btn btn-icon btn-outline-danger mr-1" href="' . $url . '"
-
 
343
            title="' . get_string('delete') . '">
-
 
344
            <svg width="18" height="18" fill="none" viewBox="0 0 24 24">
-
 
345
            <path stroke="currentColor"
-
 
346
                stroke-linecap="round"
-
 
347
                stroke-linejoin="round"
-
 
348
                stroke-width="1.5"
-
 
349
                d="M6.75 7.75L7.59115 17.4233C7.68102 18.4568 8.54622 19.25 9.58363
-
 
350
                19.25H14.4164C15.4538 19.25 16.319 18.4568 16.4088 17.4233L17.25 7.75"></path>
-
 
351
            <path stroke="currentColor"
-
 
352
                stroke-linecap="round"
-
 
353
                stroke-linejoin="round"
-
 
354
                stroke-width="1.5"
-
 
355
                d="M9.75 7.5V6.75C9.75 5.64543 10.6454 4.75 11.75 4.75H12.25C13.3546
-
 
356
                4.75 14.25 5.64543 14.25 6.75V7.5"></path>
-
 
357
            <path stroke="currentColor"
-
 
358
                stroke-linecap="round"
-
 
359
                stroke-linejoin="round"
-
 
360
                stroke-width="1.5"
-
 
361
                d="M5 7.75H19"></path>
-
 
362
            </svg></a>';
200
            $items[] = html_writer::link($url, $image . $name . $actions, ['title' => $bname]);
Línea 363... Línea 201...
363
        }
201
        }
364
 
202
 
Línea 365... Línea 203...
365
        return $actions;
203
        return html_writer::alist($items, ['class' => 'badges rui-list-group']);
366
    }
204
    }
367
 
205
 
Línea 387... Línea 225...
387
        // Search box.
225
        // Search box.
388
        $searchform = $this->output->container($this->helper_search_form($badges->search));
226
        $searchform = $this->output->container($this->helper_search_form($badges->search));
Línea 389... Línea 227...
389
 
227
 
390
        // Download all button.
228
        // Download all button.
391
        $actionhtml = $this->output->single_button(
229
        $actionhtml = $this->output->single_button(
392
            new moodle_url('/badges/mybadges.php', array('downloadall' => true, 'sesskey' => sesskey())),
230
            new moodle_url('/badges/mybadges.php', ['downloadall' => true, 'sesskey' => sesskey()]),
393
            get_string('downloadall'),
231
            get_string('downloadall'),
394
            'POST',
232
            'POST',
395
            array('class' => 'activatebadge ml-auto')
233
            ['class' => 'activatebadge ml-auto']
Línea 396... Línea 234...
396
        );
234
        );
397
 
235
 
Línea 398... Línea 236...
398
        $downloadall = $this->output->container($actionhtml, 'rui-downloadall text-right');
236
        $downloadall = $this->output->container($actionhtml, 'rui-downloadall text-right');
399
        $downloadall = $this->output->container($downloadall, 'rui-downloadall-wrapper mt-3');
237
        $downloadall = $this->output->container($downloadall, 'rui-downloadall-wrapper mt-3');
-
 
238
 
400
 
239
        // Local badges.
-
 
240
        $localhtml = html_writer::start_tag(
401
        // Local badges.
241
            'div',
402
        $localhtml = html_writer::start_tag('div',
242
            ['id' => 'issued-badge-table', 'class' => 'wrapper-fw mb-5']
403
            array('id' => 'issued-badge-table', 'class' => 'wrapper-fw mb-5'));
243
        );
404
        $sitename = format_string($SITE->fullname, true, array('context' => context_system::instance()));
244
        $sitename = format_string($SITE->fullname, true, ['context' => context_system::instance()]);
405
        $heading = get_string('localbadges', 'badges', $sitename);
245
        $heading = get_string('localbadges', 'badges', $sitename);
406
        $localhtml .= $this->output->heading_with_help($heading, 'localbadgesh', 'badges', '', '', 2, $classnames = 'mb-3');
246
        $localhtml .= $this->output->heading_with_help($heading, 'localbadgesh', 'badges', '', '', 2, $classnames = 'mb-3');
407
        if ($badges->badges) {
247
        if ($badges->badges) {
408
            $countmessage = '<hr /><svg class="mr-2"
248
            $countmessage = '<hr /><svg class="me-2"
409
                width="24"
249
                width="22"
410
                height="24"
250
                height="22"
411
                fill="none"
251
                fill="none"
412
                viewBox="0 0 24 24">
252
                viewBox="0 0 24 24">
Línea 417... Línea 257...
417
                    d="M14.25 8.75L18.25 4.75H5.75L9.75 8.75"></path><circle cx="12" cy="14" r="5.25"
257
                    d="M14.25 8.75L18.25 4.75H5.75L9.75 8.75"></path><circle cx="12" cy="14" r="5.25"
418
                stroke="currentColor"
258
                stroke="currentColor"
419
                stroke-linecap="round"
259
                stroke-linecap="round"
420
                stroke-linejoin="round"
260
                stroke-linejoin="round"
421
                stroke-width="2"></circle></svg>' .
261
                stroke-width="2"></circle></svg>' .
422
                    get_string('badgesearned', 'badges', $badges->totalcount) . '<hr />';
262
                get_string('badgesearned', 'badges', $badges->totalcount) . '<hr />';
Línea 423... Línea 263...
423
 
263
 
424
            $htmllist = $this->print_badges_list($badges->badges, $USER->id);
264
            $htmllist = $this->print_badges_list($badges->badges, $USER->id);
425
            $localhtml .= $backpackconnect . $countmessage . $searchform;
265
            $localhtml .= $backpackconnect . $countmessage . $searchform;
426
            $localhtml .= $htmlpagingbar . $htmllist . $htmlpagingbar . $downloadall;
266
            $localhtml .= $htmlpagingbar . $htmllist . $htmlpagingbar . $downloadall;
Línea 430... Línea 270...
430
        $localhtml .= html_writer::end_tag('div');
270
        $localhtml .= html_writer::end_tag('div');
Línea 431... Línea 271...
431
 
271
 
432
        // External badges.
272
        // External badges.
433
        $externalhtml = "";
273
        $externalhtml = "";
434
        if (!empty($CFG->badges_allowexternalbackpack)) {
274
        if (!empty($CFG->badges_allowexternalbackpack)) {
435
            $externalhtml .= html_writer::start_tag('div', array('class' => 'wrapper-fw mt-4'));
275
            $externalhtml .= html_writer::start_tag('div', ['class' => 'wrapper-fw mt-4']);
436
            $externalhtml .= $this->output->heading_with_help(get_string('externalbadges', 'badges'),
276
            $externalhtml .= $this->output->heading_with_help(
-
 
277
                get_string('externalbadges', 'badges'),
-
 
278
                'externalbadges',
-
 
279
                'badges',
-
 
280
                '',
-
 
281
                '',
-
 
282
                5,
-
 
283
                'mb-3'
437
                'externalbadges', 'badges', '', '', 5, 'mb-3');
284
            );
438
            if (!is_null($backpack)) {
285
            if (!is_null($backpack)) {
439
                if ($backpack->totalcollections == 0) {
286
                if ($backpack->totalcollections == 0) {
440
                    $externalhtml .= get_string('nobackpackcollectionssummary', 'badges', $backpack);
287
                    $externalhtml .= get_string('nobackpackcollectionssummary', 'badges', $backpack);
441
                } else {
288
                } else {
442
                    if ($backpack->totalbadges == 0) {
289
                    if ($backpack->totalbadges == 0) {
443
                        $externalhtml .= get_string('nobackpackbadgessummary', 'badges', $backpack);
290
                        $externalhtml .= get_string('nobackpackbadgessummary', 'badges', $backpack);
444
                    } else {
291
                    } else {
445
                        $externalhtml .= get_string('backpackbadgessummary', 'badges', $backpack);
292
                        $externalhtml .= get_string('backpackbadgessummary', 'badges', $backpack);
-
 
293
                        $externalhtml .= '<br/><br/>' . $this->print_badges_list(
446
                        $externalhtml .= '<br/><br/>' . $this->print_badges_list($backpack->badges,
294
                            $backpack->badges,
-
 
295
                            $USER->id,
-
 
296
                            true,
-
 
297
                            true
447
                            $USER->id, true, true);
298
                        );
448
                    }
299
                    }
449
                }
300
                }
450
            } else {
301
            } else {
451
                $externalhtml .= get_string('externalconnectto', 'badges', $mybackpack->out());
302
                $externalhtml .= get_string('externalconnectto', 'badges', $mybackpack->out());
Línea 475... Línea 326...
475
            $badgeimage = print_badge_image($badge, $this->page->context, 'large');
326
            $badgeimage = print_badge_image($badge, $this->page->context, 'large');
476
            $name = $badge->name;
327
            $name = $badge->name;
477
            $description = $badge->description;
328
            $description = $badge->description;
478
            $criteria = self::print_badge_criteria($badge);
329
            $criteria = self::print_badge_criteria($badge);
479
            if ($badge->dateissued) {
330
            if ($badge->dateissued) {
480
                $iconcheck = '<svg class="mr-2"
331
                $iconcheck = '<svg class="me-2"
481
                    width="24"
332
                    width="22"
482
                    height="24"
333
                    height="22"
483
                    fill="none"
334
                    fill="none"
484
                    viewBox="0 0 24 24">
335
                    viewBox="0 0 24 24">
485
                    <path stroke="currentColor"
336
                    <path stroke="currentColor"
486
                    stroke-linecap="round"
337
                    stroke-linecap="round"
487
                    stroke-linejoin="round"
338
                    stroke-linejoin="round"
Línea 494... Línea 345...
494
                        stroke-linecap="round"
345
                        stroke-linecap="round"
495
                        stroke-linejoin="round"
346
                        stroke-linejoin="round"
496
                        stroke-width="2"
347
                        stroke-width="2"
497
                        d="M9.75 12.75L10.1837 13.6744C10.5275 14.407 11.5536
348
                        d="M9.75 12.75L10.1837 13.6744C10.5275 14.407 11.5536
498
                        14.4492 11.9564 13.7473L14.25 9.75"></path></svg>';
349
                        14.4492 11.9564 13.7473L14.25 9.75"></path></svg>';
499
                $criteriatxt = $iconcheck . get_string('dateearned', 'badges', userdate($badge->dateissued,
350
                $criteriatxt = $iconcheck . get_string('dateearned', 'badges', userdate(
-
 
351
                    $badge->dateissued,
500
                    get_string('strftimedatefullshort', 'core_langconfig')));
352
                    get_string('strftimedatefullshort', 'core_langconfig')
-
 
353
                ));
501
                $badgeurl = new moodle_url('/badges/badge.php', array('hash' => $badge->uniquehash));
354
                $badgeurl = new moodle_url('/badges/badge.php', ['hash' => $badge->uniquehash]);
502
                $awarded = '<a class="d-inline-flex align-items-center" href="' . $badgeurl . '">' . $criteriatxt . '</a>';
355
                $awarded = '<a class="d-inline-flex align-items-center" href="' . $badgeurl . '">' . $criteriatxt . '</a>';
503
            } else {
356
            } else {
504
                $awarded = "";
357
                $awarded = "";
505
            }
358
            }
Línea 506... Línea 359...
506
 
359
 
507
            $output .= '<div class="m-0">';
360
            $output .= '<div class="m-0">';
508
            $output .= '<div class="rui-badge-overview-wrapper
361
            $output .= '<div class="rui-badge-overview-wrapper
509
                border rounded w-100 p-4 mt-2 mb-2 d-inline-flex align-items-start">';
362
                border rounded w-100 p-4 mt-2 mb-2 d-inline-flex align-items-start">';
510
            $output .= '<div class="border rounded p-4 mr-6">' . $badgeimage . '</div>';
363
            $output .= '<div class="border rounded p-4 me-6">' . $badgeimage . '</div>';
511
            $output .= html_writer::start_tag('div', array('class' => 'rui-badge-overview'));
364
            $output .= html_writer::start_tag('div', ['class' => 'rui-badge-overview']);
512
            $output .= html_writer::start_tag('h4', array('class' => 'rui-badge-name mt-2'));
365
            $output .= html_writer::start_tag('h4', ['class' => 'rui-badge-name mt-2']);
513
            $output .= $name;
366
            $output .= $name;
514
            $output .= html_writer::end_tag('h4');
367
            $output .= html_writer::end_tag('h4');
-
 
368
            $output .= html_writer::start_tag(
515
            $output .= html_writer::start_tag('div',
369
                'div',
-
 
370
                ['class' => 'rui-badge-desc mt-3']
516
                array('class' => 'rui-badge-desc mt-3'));
371
            );
-
 
372
            $output .= html_writer::start_tag(
517
            $output .= html_writer::start_tag('h5',
373
                'h5',
-
 
374
                ['class' => 'd-inline-flex align-items-center w-100']
518
                array('class' => 'd-inline-flex align-items-center w-100'));
375
            );
519
            $output .= get_string('description', 'badges');
376
            $output .= get_string('description', 'badges');
520
            $output .= html_writer::end_tag('h5');
377
            $output .= html_writer::end_tag('h5');
Línea 521... Línea 378...
521
            $output .= $description;
378
            $output .= $description;
-
 
379
 
522
 
380
            $output .= html_writer::start_tag(
-
 
381
                'h5',
523
            $output .= html_writer::start_tag('h5',
382
                ['class' => 'd-inline-flex align-items-center w-100 mt-4']
524
                array('class' => 'd-inline-flex align-items-center w-100 mt-4'));
383
            );
525
            $output .= '<svg class="mr-2" width="24"
384
            $output .= '<svg class="me-2" width="22"
526
                height="24"
385
                height="22"
527
                viewBox="0 0 24 24"
386
                viewBox="0 0 24 24"
528
                fill="none"
387
                fill="none"
529
                xmlns="http://www.w3.org/2000/svg">
388
                xmlns="http://www.w3.org/2000/svg">
530
                <path d="M10.75 13.25H6.75L13.25 4.75V10.75H17.25L10.75 19.25V13.25Z"
389
                <path d="M10.75 13.25H6.75L13.25 4.75V10.75H17.25L10.75 19.25V13.25Z"
531
                    stroke="currentColor"
390
                    stroke="currentColor"
532
                    stroke-width="1.5"
391
                    stroke-width="1.5"
533
                    stroke-linecap="round" stroke-linejoin="round"></path></svg>' .
392
                    stroke-linecap="round" stroke-linejoin="round"></path></svg>' .
534
                get_string('bcriteria', 'badges');
393
                get_string('bcriteria', 'badges');
Línea 535... Línea 394...
535
            $output .= html_writer::end_tag('h5');
394
            $output .= html_writer::end_tag('h5');
536
            $output .= '<div class="ml-4">' . $criteria . '</div>';
395
            $output .= '<div class="ms-4">' . $criteria . '</div>';
537
 
396
 
538
            if (!empty($awarded)) {
397
            if (!empty($awarded)) {
539
                $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100 mt-4'));
398
                $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100 mt-4']);
540
                $output .= '<svg class="mr-2"
399
                $output .= '<svg class="me-2"
541
                    width="24"
400
                    width="22"
542
                    height="24"
401
                    height="22"
543
                    viewBox="0 0 24 24"
402
                    viewBox="0 0 24 24"
544
                    fill="none"
403
                    fill="none"
Línea 553... Línea 412...
553
                        stroke="currentColor"
412
                        stroke="currentColor"
554
                        stroke-width="1.5"
413
                        stroke-width="1.5"
555
                        stroke-linecap="round" stroke-linejoin="round"></path></svg>' .
414
                        stroke-linecap="round" stroke-linejoin="round"></path></svg>' .
556
                    get_string('awardedtoyou', 'badges');
415
                    get_string('awardedtoyou', 'badges');
557
                $output .= html_writer::end_tag('h5');
416
                $output .= html_writer::end_tag('h5');
558
                $output .= '<div class="ml-4">' . $awarded . '</div>';
417
                $output .= '<div class="ms-4">' . $awarded . '</div>';
559
            }
418
            }
Línea 560... Línea 419...
560
 
419
 
561
            $output .= html_writer::end_tag('div');
420
            $output .= html_writer::end_tag('div');
562
            $output .= html_writer::end_tag('div');
421
            $output .= html_writer::end_tag('div');
Línea 566... Línea 425...
566
 
425
 
567
        return $output;
426
        return $output;
Línea 568... Línea 427...
568
    }
427
    }
569
 
-
 
570
    /**
-
 
571
     * Render a table of badges.
-
 
572
     *
-
 
573
     * @param \core_badges\output\badge_management $badges
-
 
574
     * @return string
-
 
575
     */
-
 
576
    protected function render_badge_management(\core_badges\output\badge_management $badges) {
-
 
577
        // New badge button.
-
 
578
        $htmlnew = '';
-
 
579
        if (has_capability('moodle/badges:createbadge', $this->page->context)) {
-
 
580
            $n['type'] = $this->page->url->get_param('type');
-
 
581
            $n['id'] = $this->page->url->get_param('id');
-
 
582
            $btn = $this->output->single_button(new moodle_url('newbadge.php', $n), get_string('newbadge', 'badges'));
-
 
583
            $htmlnew = $this->output->box($btn);
-
 
584
        }
-
 
585
 
-
 
586
        $output = '';
-
 
587
 
-
 
588
        $output .= '<div class="rui-badge-wrapper">';
-
 
589
        foreach ($badges->badges as $b) {
-
 
590
            $style = !$b->is_active() ? 'rui-badge-not-available' : '';
-
 
591
            $badgeimage = print_badge_image($b, $this->page->context, 'large');
-
 
592
            $forlink = html_writer::start_tag('span') . $b->name . html_writer::end_tag('span');
-
 
593
            $name = html_writer::link(new moodle_url('/badges/overview.php', array('id' => $b->id)), $forlink);
-
 
594
 
-
 
595
            if (!$b->is_active()) {
-
 
596
                $status = '<span class="badge badge-danger">' . $b->statstring . '</span>';
-
 
597
            } else {
-
 
598
                $status = '<span class="badge badge-success">' . $b->statstring . '</span>';
-
 
599
            }
-
 
600
 
-
 
601
            $criteria = self::print_badge_criteria($b, 'short');
-
 
602
 
-
 
603
            $output .= '<div class="rui-badge-box w-100 ' . $style . '">';
-
 
604
            $output .= '<div class="rui-badge-overview-actions d-flex justify-content-between"><div>' .
-
 
605
                self::print_badge_table_actions($b, $this->page->context) . '</div>' .
-
 
606
                $status .
-
 
607
                '</div>';
-
 
608
 
-
 
609
            $output .= '<div class="d-inline-flex align-items-start w-100">';
-
 
610
            $output .= '<div class="border rounded p-5 mr-6">' . $badgeimage . '</div>';
-
 
611
            $output .= html_writer::start_tag('div', array('class' => 'rui-badge-overview'));
-
 
612
 
-
 
613
            $output .= html_writer::start_tag('h4', array('class' => 'rui-badge-name mt-2'));
-
 
614
            $output .= $name;
-
 
615
            $output .= html_writer::end_tag('h4');
-
 
616
            $output .= html_writer::start_tag('div', array('class' => 'rui-badge-desc'));
-
 
617
 
-
 
618
            $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100 mt-2'));
-
 
619
            $output .= '<svg class="mr-2"
-
 
620
                width="24"
-
 
621
                height="24"
-
 
622
                viewBox="0 0 24 24"
-
 
623
                fill="none"
-
 
624
                xmlns="http://www.w3.org/2000/svg">
-
 
625
                <path d="M10.75 13.25H6.75L13.25 4.75V10.75H17.25L10.75 19.25V13.25Z"
-
 
626
                    stroke="currentColor"
-
 
627
                    stroke-width="1.5"
-
 
628
                    stroke-linecap="round"
-
 
629
                    stroke-linejoin="round"></path></svg>' . get_string('bcriteria', 'badges');
-
 
630
            $output .= html_writer::end_tag('h5');
-
 
631
            $output .= '<div class="ml-4">' . $criteria . '</div>';
-
 
632
 
-
 
633
            if (has_capability('moodle/badges:viewawarded', $this->page->context)) {
-
 
634
                $awards = html_writer::link(new moodle_url('/badges/recipients.php', array('id' => $b->id)), $b->awards);
-
 
635
                $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100 mt-4'));
-
 
636
                $output .= '<svg class="mr-2"
-
 
637
                    width="24"
-
 
638
                    height="24"
-
 
639
                    viewBox="0 0 24 24"
-
 
640
                    fill="none"
-
 
641
                    xmlns="http://www.w3.org/2000/svg">
-
 
642
                    <path d="M17.25 10C17.25 12.8995 14.8995 15.25 12 15.25C9.10051 15.25 6.75
-
 
643
                    12.8995 6.75 10C6.75 7.10051 9.10051 4.75 12 4.75C14.8995 4.75 17.25
-
 
644
                    7.10051 17.25 10Z"
-
 
645
                        stroke="currentColor"
-
 
646
                        stroke-width="1.5"
-
 
647
                        stroke-linecap="round"
-
 
648
                        stroke-linejoin="round"></path>
-
 
649
                    <path d="M8.75 14.75L7.75 19.25L12 17.75L16.25 19.25L15.25 14.75"
-
 
650
                        stroke="currentColor"
-
 
651
                        stroke-width="1.5"
-
 
652
                        stroke-linecap="round" stroke-linejoin="round"></path></svg>' . get_string('awards', 'badges');
-
 
653
                $output .= html_writer::end_tag('h5');
-
 
654
                $output .= '<div class="ml-4">' . $awards . '</div>';
-
 
655
            } else {
-
 
656
                $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100 mt-4'));
-
 
657
                $output .= '<svg class="mr-2"
-
 
658
                    width="24"
-
 
659
                    height="24"
-
 
660
                    viewBox="0 0 24 24"
-
 
661
                    fill="none"
-
 
662
                    xmlns="http://www.w3.org/2000/svg">
-
 
663
                    <path d="M17.25 10C17.25 12.8995 14.8995 15.25 12 15.25C9.10051 15.25 6.75 12.8995 6.75
-
 
664
                    10C6.75 7.10051 9.10051 4.75 12 4.75C14.8995 4.75 17.25 7.10051 17.25 10Z"
-
 
665
                        stroke="currentColor"
-
 
666
                        stroke-width="1.5"
-
 
667
                        stroke-linecap="round"
-
 
668
                        stroke-linejoin="round"></path>
-
 
669
                    <path d="M8.75 14.75L7.75 19.25L12 17.75L16.25 19.25L15.25 14.75"
-
 
670
                        stroke="currentColor"
-
 
671
                        stroke-width="1.5"
-
 
672
                        stroke-linecap="round" stroke-linejoin="round"></path></svg>' .
-
 
673
                    get_string('awards', 'badges');
-
 
674
                $output .= html_writer::end_tag('h5');
-
 
675
                $output .= '<div class="ml-4">' . $b->awards . '</div>';
-
 
676
            }
-
 
677
 
-
 
678
            $output .= html_writer::end_tag('div'); // .rui-badge-desc.
-
 
679
            $output .= html_writer::end_tag('div'); // .rui-badge-overview.
-
 
680
            $output .= '</div>';
-
 
681
            $output .= '</div>';
-
 
682
        }
-
 
683
        $output .= '</div>';
-
 
684
        return $output;
-
 
685
    }
-
 
686
 
-
 
687
    /**
-
 
688
     * Prints badge status box.
-
 
689
     *
-
 
690
     * @param badge $badge
-
 
691
     * @return Either the status box html as a string or null
-
 
692
     */
-
 
693
    public function print_badge_status_box(badge $badge) {
-
 
694
        if (has_capability('moodle/badges:configurecriteria', $badge->get_context())) {
-
 
695
 
-
 
696
            if (!$badge->has_criteria()) {
-
 
697
                $criteriaurl = new moodle_url('/badges/criteria.php', array('id' => $badge->id));
-
 
698
                $status = get_string('nocriteria', 'badges');
-
 
699
                if ($this->page->url != $criteriaurl) {
-
 
700
                    $action = $this->output->single_button(
-
 
701
                        $criteriaurl,
-
 
702
                        get_string('addcriteria', 'badges'),
-
 
703
                        'POST',
-
 
704
                        array('class' => 'activatebadge ml-auto')
-
 
705
                    );
-
 
706
                } else {
-
 
707
                    $action = '';
-
 
708
                }
-
 
709
 
-
 
710
                $message = '<p class="m-0">' . $status . $action . '</p>';
-
 
711
            } else {
-
 
712
                $status = get_string('statusmessage_' . $badge->status, 'badges');
-
 
713
                if ($badge->is_active()) {
-
 
714
                    $action = $this->output->single_button(
-
 
715
                        new moodle_url(
-
 
716
                            '/badges/action.php',
-
 
717
                            array(
-
 
718
                                'id' => $badge->id,
-
 
719
                                'lock' => 1,
-
 
720
                                'sesskey' => sesskey(),
-
 
721
                                'return' => $this->page->url->out_as_local_url(false)
-
 
722
                            )
-
 
723
                        ),
-
 
724
                        get_string('deactivate', 'badges'),
-
 
725
                        'POST',
-
 
726
                        array('class' => 'activatebadge ml-auto')
-
 
727
                    );
-
 
728
                } else {
-
 
729
                    $action = $this->output->single_button(
-
 
730
                        new moodle_url(
-
 
731
                            '/badges/action.php',
-
 
732
                            array(
-
 
733
                                'id' => $badge->id,
-
 
734
                                'activate' => 1,
-
 
735
                                'sesskey' => sesskey(),
-
 
736
                                'return' => $this->page->url->out_as_local_url(false)
-
 
737
                            )
-
 
738
                        ),
-
 
739
                        get_string('activate', 'badges'),
-
 
740
                        'POST',
-
 
741
                        array('class' => 'activatebadge ml-auto')
-
 
742
                    );
-
 
743
                }
-
 
744
 
-
 
745
                $message = '<p class="py-3 m-0">' . $status . $this->output->help_icon('status', 'badges') . $action . '</p>';
-
 
746
            }
-
 
747
 
-
 
748
            $style = $badge->is_active() ?
-
 
749
                'wrapper-fw d-flex align-items-center justify-content-between
-
 
750
                alert alert-info rui-statusbox active pr-2' :
-
 
751
                'wrapper-fw d-flex align-items-center justify-content-between
-
 
752
                alert alert-warning rui-statusbox inactive pr-2';
-
 
753
            return $this->output->container($message, $style);
-
 
754
        }
-
 
755
 
-
 
756
        return null;
-
 
757
    }
-
 
758
 
428
 
759
    /**
429
    /**
760
     * Outputs list en badges.
430
     * Outputs list en badges.
761
     *
431
     *
762
     * @param badge $badge Badge object.
432
     * @param badge $badge Badge object.
763
     * @return string $output content endorsement to output.
433
     * @return string $output content endorsement to output.
764
     */
434
     */
765
    protected function print_badge_endorsement(badge $badge) {
435
    protected function print_badge_endorsement(badge $badge) {
766
        $output = '';
436
        $output = '';
Línea 767... Línea 437...
767
        $endorsement = $badge->get_endorsement();
437
        $endorsement = $badge->get_endorsement();
768
        $dl = array();
438
        $dl = [];
769
 
439
 
770
        $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100'));
440
        $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100']);
771
        $output .= '<svg class="mr-2"
441
        $output .= '<svg class="me-2"
772
            width="24"
442
            width="22"
773
            height="24"
443
            height="22"
774
            fill="none"
444
            fill="none"
775
            viewBox="0 0 24 24"><path stroke="currentColor"
445
            viewBox="0 0 24 24"><path stroke="currentColor"
Línea 787... Línea 457...
787
            stroke-linejoin="round"
457
            stroke-linejoin="round"
788
            stroke-width="1.5"></circle></svg>' . get_string('endorsement', 'badges');
458
            stroke-width="1.5"></circle></svg>' . get_string('endorsement', 'badges');
789
        $output .= html_writer::end_tag('h5');
459
        $output .= html_writer::end_tag('h5');
Línea 790... Línea 460...
790
 
460
 
791
        if (!empty($endorsement)) {
461
        if (!empty($endorsement)) {
Línea 792... Línea 462...
792
            $output .= html_writer::start_tag('div', array('class' => 'ml-4'));
462
            $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
793
 
463
 
794
            if (!empty(userdate($endorsement->dateissued))) {
464
            if (!empty(userdate($endorsement->dateissued))) {
795
                $output .= html_writer::start_tag('span', array('class' => 'badge badge-light'));
465
                $output .= html_writer::start_tag('span', ['class' => 'badge badge-light']);
796
                $output .= '<span class="mr-1 font-weight-bold">' .
466
                $output .= '<span class="me-1 font-weight-bold">' .
797
                    get_string('dateawarded', 'badges') .
467
                    get_string('dateawarded', 'badges') .
798
                    ': </span>' .
468
                    ': </span>' .
799
                    userdate($endorsement->dateissued);
469
                    userdate($endorsement->dateissued);
Línea 800... Línea 470...
800
                $output .= html_writer::end_tag('span');
470
                $output .= html_writer::end_tag('span');
-
 
471
            }
801
            }
472
 
-
 
473
            $output .= html_writer::start_tag(
802
 
474
                'div',
803
            $output .= html_writer::start_tag('div',
475
                ['class' => 'rui-badge-comment w-100 rounded p-4 my-2']
-
 
476
            );
804
                array('class' => 'rui-badge-comment w-100 rounded p-4 my-2'));
477
            $output .= '<label>' . get_string('claimcomment', 'badges') . '</label>';
-
 
478
            $output .= html_writer::start_tag(
805
            $output .= '<label>' . get_string('claimcomment', 'badges') . '</label>';
479
                'p',
806
            $output .= html_writer::start_tag('p',
480
                ['class' => 'd-inline-flex align-items-center w-100 mb-0']
807
                array('class' => 'd-inline-flex align-items-center w-100 mb-0'));
481
            );
Línea 808... Línea 482...
808
            $output .= $endorsement->claimcomment;
482
            $output .= $endorsement->claimcomment;
809
            $output .= html_writer::end_tag('p');
483
            $output .= html_writer::end_tag('p');
810
            $output .= html_writer::end_tag('div');
484
            $output .= html_writer::end_tag('div');
-
 
485
 
-
 
486
            if (!empty($endorsement->issuername) || !empty($endorsement->issueremail)) {
811
 
487
                $output .= html_writer::start_tag('span', ['class' => 'alert alert-secondary d-block']);
812
            if (!empty($endorsement->issuername) || !empty($endorsement->issueremail)) {
488
                $output .= $endorsement->issuername .
813
                $output .= html_writer::start_tag('span', array('class' => 'alert alert-secondary d-block'));
489
                    html_writer::tag(
-
 
490
                        'a',
-
 
491
                        $endorsement->issueremail,
814
                $output .= $endorsement->issuername .
492
                        ['class' => 'ms-3'],
815
                    html_writer::tag('a', $endorsement->issueremail,
493
                        ['href' => "mailto:{$endorsement->issueremail}"]
816
                        array('class' => 'ml-3'),
494
                    )
817
                        array('href' => 'mailto:' . $endorsement->issueremail))
495
                    . html_writer::link(
-
 
496
                        $endorsement->issuerurl,
818
                    . html_writer::link($endorsement->issuerurl,
497
                        $endorsement->issuerurl,
819
                        $endorsement->issuerurl,
498
                        ['class' => 'ms-3'],
Línea 820... Línea 499...
820
                            array('class' => 'ml-3'),
499
                        ['target' => '_blank']
821
                            array('target' => '_blank'));
500
                    );
822
                $output .= html_writer::end_tag('span');
501
                $output .= html_writer::end_tag('span');
823
            }
502
            }
824
 
503
 
825
            $output .= html_writer::end_tag('div');
504
            $output .= html_writer::end_tag('div');
826
        } else {
505
        } else {
827
            $output .= html_writer::start_tag('div', array('class' => 'ml-4'));
506
            $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
Línea 838... Línea 517...
838
     * @return string $output List related badges to output.
517
     * @return string $output List related badges to output.
839
     */
518
     */
840
    protected function print_badge_related(badge $badge) {
519
    protected function print_badge_related(badge $badge) {
841
        $output = '';
520
        $output = '';
842
        $relatedbadges = $badge->get_related_badges();
521
        $relatedbadges = $badge->get_related_badges();
843
        $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100'));
522
        $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100']);
844
        $output .= '<svg class="mr-2"
523
        $output .= '<svg class="me-2"
845
            width="24"
524
            width="22"
846
            height="24"
525
            height="22"
847
            viewBox="0 0 24 24"
526
            viewBox="0 0 24 24"
848
            fill="none"
527
            fill="none"
849
            xmlns="http://www.w3.org/2000/svg"><path d="M17.25 10C17.25 12.8995
528
            xmlns="http://www.w3.org/2000/svg"><path d="M17.25 10C17.25 12.8995
850
            14.8995 15.25 12 15.25C9.10051 15.25 6.75 12.8995 6.75 10C6.75
529
            14.8995 15.25 12 15.25C9.10051 15.25 6.75 12.8995 6.75 10C6.75
851
            7.10051 9.10051 4.75 12 4.75C14.8995 4.75 17.25 7.10051 17.25 10Z"
530
            7.10051 9.10051 4.75 12 4.75C14.8995 4.75 17.25 7.10051 17.25 10Z"
Línea 858... Línea 537...
858
            stroke-width="1.5"
537
            stroke-width="1.5"
859
            stroke-linecap="round"
538
            stroke-linecap="round"
860
            stroke-linejoin="round"></path></svg>' . get_string('relatedbages', 'badges');
539
            stroke-linejoin="round"></path></svg>' . get_string('relatedbages', 'badges');
861
        $output .= html_writer::end_tag('h5');
540
        $output .= html_writer::end_tag('h5');
862
        if (!empty($relatedbadges)) {
541
        if (!empty($relatedbadges)) {
863
            $items = array();
542
            $items = [];
864
            foreach ($relatedbadges as $related) {
543
            foreach ($relatedbadges as $related) {
865
                $relatedurl = new moodle_url('/badges/overview.php', array('id' => $related->id));
544
                $relatedurl = new moodle_url('/badges/overview.php', ['id' => $related->id]);
866
                $items[] = html_writer::link($relatedurl->out(), $related->name, array('target' => '_blank'));
545
                $items[] = html_writer::link($relatedurl->out(), $related->name, ['target' => '_blank']);
867
            }
546
            }
868
            $output .= html_writer::alist($items, array(), 'ul');
547
            $output .= html_writer::alist($items, [], 'ul');
869
        } else {
548
        } else {
870
            $output .= html_writer::start_tag('div', array('class' => 'ml-4'));
549
            $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
871
            $output .= get_string('norelated', 'badges');
550
            $output .= get_string('norelated', 'badges');
872
            $output .= html_writer::end_tag('div');
551
            $output .= html_writer::end_tag('div');
873
        }
552
        }
874
        return $output;
553
        return $output;
875
    }
554
    }
Línea 881... Línea 560...
881
     * @return string $output List alignments to output.
560
     * @return string $output List alignments to output.
882
     */
561
     */
883
    protected function print_badge_alignments(badge $badge) {
562
    protected function print_badge_alignments(badge $badge) {
884
        $output = '';
563
        $output = '';
Línea 885... Línea 564...
885
 
564
 
886
        $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100'));
565
        $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100']);
887
        $output .= '<svg class="mr-2"
566
        $output .= '<svg class="me-2"
888
            width="24"
567
            width="22"
889
            height="24"
568
            height="22"
890
            viewBox="0 0 24 24"
569
            viewBox="0 0 24 24"
891
            fill="none"
570
            fill="none"
892
            xmlns="http://www.w3.org/2000/svg"><path d="M7.75 5.75H16.25"
571
            xmlns="http://www.w3.org/2000/svg"><path d="M7.75 5.75H16.25"
893
            stroke="currentColor"
572
            stroke="currentColor"
Línea 905... Línea 584...
905
                stroke-linejoin="round"></path></svg>' . get_string('alignment', 'badges');
584
                stroke-linejoin="round"></path></svg>' . get_string('alignment', 'badges');
906
        $output .= html_writer::end_tag('h5');
585
        $output .= html_writer::end_tag('h5');
Línea 907... Línea 586...
907
 
586
 
908
        $alignments = $badge->get_alignments();
587
        $alignments = $badge->get_alignments();
909
        if (!empty($alignments)) {
588
        if (!empty($alignments)) {
910
            $items = array();
589
            $items = [];
911
            foreach ($alignments as $alignment) {
590
            foreach ($alignments as $alignment) {
912
                $urlaligment = new moodle_url(
591
                $urlaligment = new moodle_url(
913
                    'alignment.php',
592
                    'alignment.php',
914
                    array('id' => $badge->id, 'alignmentid' => $alignment->id)
593
                    ['id' => $badge->id, 'alignmentid' => $alignment->id]
915
                );
594
                );
916
                $items[] = html_writer::link($urlaligment, $alignment->targetname, array('target' => '_blank'));
595
                $items[] = html_writer::link($urlaligment, $alignment->targetname, ['target' => '_blank']);
917
            }
596
            }
918
            $output .= html_writer::alist($items, array('class' => 'ml-4'), 'ul');
597
            $output .= html_writer::alist($items, ['class' => 'ms-4'], 'ul');
919
        } else {
598
        } else {
920
            $output .= html_writer::start_tag('div', array('class' => 'ml-4'));
599
            $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
921
            $output .= get_string('noalignment', 'badges');
600
            $output .= get_string('noalignment', 'badges');
922
            $output .= html_writer::end_tag('div');
601
            $output .= html_writer::end_tag('div');
923
        }
602
        }
924
        return $output;
603
        return $output;
Línea -... Línea 604...
-
 
604
    }
925
    }
605
 
-
 
606
    /**
-
 
607
     * Prints a badge overview infomation.
926
 
608
     *
927
    // Prints a badge overview infomation.
609
     */
Línea 928... Línea 610...
928
    public function print_badge_overview($badge, $context) {
610
    public function print_badge_overview($badge, $context) {
929
        $languages = get_string_manager()->get_list_of_languages();
611
        $languages = get_string_manager()->get_list_of_languages();
Línea -... Línea 612...
-
 
612
 
-
 
613
        $output = '';
-
 
614
        $output .= html_writer::start_tag('div', ['class' => 'mt-4']);
-
 
615
 
930
 
616
        $output .= html_writer::start_tag(
-
 
617
            'div',
-
 
618
            [
931
        $output = '';
619
                'class' => 'rui-badge-overview-wrapper
932
        $output .= html_writer::start_tag('div', array('class' => 'mt-4'));
620
                border rounded p-4 mt-0 mb-2 d-inline-flex flex-wrap align-items-start w-100',
933
 
621
            ]
Línea 934... Línea 622...
934
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-overview-wrapper border rounded p-4 mt-0 mb-2 d-inline-flex flex-wrap align-items-start w-100'));
622
        );
935
        $output .= '<div class="border rounded p-3 mr-md-6 w-100 w-md-auto">' .
623
        $output .= '<div class="border rounded p-3 me-md-6 w-100 w-md-auto">' .
Línea 936... Línea 624...
936
            print_badge_image($badge, $context, 'large') .
624
            print_badge_image($badge, $context, 'large') .
937
            '</div>';
625
            '</div>';
938
 
626
 
939
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-overview'));
627
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-overview']);
940
        // Badge details.
628
        // Badge details.
941
 
629
 
942
        if (!empty($badge->version)) {
630
        if (!empty($badge->version)) {
943
            $output .= html_writer::start_tag('div', array('class' => 'pb-2 small'));
631
            $output .= html_writer::start_tag('div', ['class' => 'pb-2 small']);
Línea 944... Línea 632...
944
            $output .= '<span class="mr-1 font-weight-bold">' .
632
            $output .= '<span class="me-1 font-weight-bold">' .
945
                get_string('version', 'badges') .
633
                get_string('version', 'badges') .
946
                ': </span>' .
634
                ': </span>' .
947
                $badge->version;
635
                $badge->version;
948
            $output .= html_writer::end_tag('div');
636
            $output .= html_writer::end_tag('div');
949
        }
637
        }
950
 
638
 
951
        if (!empty($languages[$badge->language])) {
639
        if (!empty($languages[$badge->language])) {
Línea 952... Línea 640...
952
            $output .= html_writer::start_tag('div', array('class' => 'pb-2 small'));
640
            $output .= html_writer::start_tag('div', ['class' => 'pb-2 small']);
953
            $output .= '<span class="mr-1 font-weight-bold">' .
641
            $output .= '<span class="me-1 font-weight-bold">' .
954
                get_string('language') .
642
                get_string('language') .
955
                ': </span>' .
643
                ': </span>' .
956
                $languages[$badge->language];
644
                $languages[$badge->language];
957
            $output .= html_writer::end_tag('div');
645
            $output .= html_writer::end_tag('div');
958
        }
646
        }
959
 
647
 
Línea 960... Línea 648...
960
        if (!empty(userdate($badge->timecreated))) {
648
        if (!empty(userdate($badge->timecreated))) {
961
            $output .= html_writer::start_tag('div', array('class' => 'pb-2 small'));
649
            $output .= html_writer::start_tag('div', ['class' => 'pb-2 small']);
962
            $output .= '<span class="mr-1 font-weight-bold">' .
650
            $output .= '<span class="me-1 font-weight-bold">' .
Línea 963... Línea 651...
963
                get_string('createdon', 'search') .
651
                get_string('createdon', 'search') .
964
                ': </span>' .
652
                ': </span>' .
965
                userdate($badge->timecreated);
653
                userdate($badge->timecreated);
966
            $output .= html_writer::end_tag('div');
654
            $output .= html_writer::end_tag('div');
967
        }
655
        }
968
 
656
 
969
        $output .= html_writer::start_tag('h4', array('class' => 'rui-badge-name'));
657
        $output .= html_writer::start_tag('h4', ['class' => 'rui-badge-name']);
970
        $output .= $badge->name;
658
        $output .= $badge->name;
971
        $output .= html_writer::end_tag('h4');
659
        $output .= html_writer::end_tag('h4');
972
 
660
 
Línea 994... Línea 682...
994
                    r="1
682
                    r="1
995
                    fill="currentColor"></circle></svg>' . get_string('expiredate', 'badges', userdate($badge->expiredate));
683
                    fill="currentColor"></circle></svg>' . get_string('expiredate', 'badges', userdate($badge->expiredate));
996
                $output .= html_writer::end_tag('span');
684
                $output .= html_writer::end_tag('span');
997
            } else if ($badge->expireperiod) {
685
            } else if ($badge->expireperiod) {
998
                if ($badge->expireperiod < 60) {
686
                if ($badge->expireperiod < 60) {
999
                    $output .= html_writer::start_tag('span', array('class' => 'rui-badge-expires-info'));
687
                    $output .= html_writer::start_tag('span', ['class' => 'rui-badge-expires-info']);
1000
                    $output .= get_string('expireperiods', 'badges', round($badge->expireperiod, 2));
688
                    $output .= get_string('expireperiods', 'badges', round($badge->expireperiod, 2));
1001
                    $output .= html_writer::end_tag('span');
689
                    $output .= html_writer::end_tag('span');
1002
                } else if ($badge->expireperiod < 60 * 60) {
690
                } else if ($badge->expireperiod < 60 * 60) {
1003
                    $output .= html_writer::start_tag('span', array('class' => 'rui-badge-expires-info'));
691
                    $output .= html_writer::start_tag('span', ['class' => 'rui-badge-expires-info']);
1004
                    $output .= get_string('expireperiodm', 'badges', round($badge->expireperiod / 60, 2));
692
                    $output .= get_string('expireperiodm', 'badges', round($badge->expireperiod / 60, 2));
1005
                    $output .= html_writer::end_tag('span');
693
                    $output .= html_writer::end_tag('span');
1006
                } else if ($badge->expireperiod < 60 * 60 * 24) {
694
                } else if ($badge->expireperiod < 60 * 60 * 24) {
1007
                    $output .= html_writer::start_tag('span', array('class' => 'rui-badge-expires-info'));
695
                    $output .= html_writer::start_tag('span', ['class' => 'rui-badge-expires-info']);
1008
                    $output .= get_string('expireperiodh', 'badges', round($badge->expireperiod / 60 / 60, 2));
696
                    $output .= get_string('expireperiodh', 'badges', round($badge->expireperiod / 60 / 60, 2));
1009
                    $output .= html_writer::end_tag('span');
697
                    $output .= html_writer::end_tag('span');
1010
                } else {
698
                } else {
1011
                    $output .= html_writer::start_tag('span', array('class' => 'badge badge-danger'));
699
                    $output .= html_writer::start_tag('span', ['class' => 'badge badge-danger']);
1012
                    $output .= get_string('expireperiod', 'badges', round($badge->expireperiod / 60 / 60 * 0.54, 2));
700
                    $output .= get_string('expireperiod', 'badges', round($badge->expireperiod / 60 / 60 * 0.54, 2));
1013
                    $output .= html_writer::end_tag('span');
701
                    $output .= html_writer::end_tag('span');
1014
                }
702
                }
1015
            }
703
            }
1016
        } else {
704
        } else {
1017
            $output .= html_writer::start_tag('span', array('class' => 'badge badge-success'));
705
            $output .= html_writer::start_tag('span', ['class' => 'badge badge-success']);
1018
            $output .= '<span class="mr-1 font-weight-bold">' . get_string('noexpiry', 'badges') . '</span>';
706
            $output .= '<span class="me-1 font-weight-bold">' . get_string('noexpiry', 'badges') . '</span>';
1019
            $output .= html_writer::end_tag('span');
707
            $output .= html_writer::end_tag('span');
1020
        }
708
        }
Línea 1021... Línea 709...
1021
 
709
 
Línea 1022... Línea 710...
1022
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-desc mt-3'));
710
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-desc mt-3']);
1023
 
711
 
1024
        $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100'));
712
        $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100']);
Línea 1025... Línea 713...
1025
        $output .= get_string('description', 'badges');
713
        $output .= get_string('description', 'badges');
Línea 1026... Línea 714...
1026
        $output .= html_writer::end_tag('h5');
714
        $output .= html_writer::end_tag('h5');
Línea 1027... Línea 715...
1027
 
715
 
1028
        $output .= $badge->description;
716
        $output .= $badge->description;
1029
 
717
 
1030
        $output .= html_writer::start_tag('ul', array('class' => 'rui-badge-desc-list mt-3 ml-3'));
718
        $output .= html_writer::start_tag('ul', ['class' => 'rui-badge-desc-list mt-3 ms-3']);
1031
 
719
 
1032
        if (!empty(userdate($badge->imageauthorname))) {
720
        if (!empty($badge->imageauthorname)) {
Línea 1033... Línea 721...
1033
            $output .= html_writer::start_tag('li');
721
            $output .= html_writer::start_tag('li');
1034
            $output .= '<span class="mr-1 font-weight-bold">' .
722
            $output .= '<span class="me-1 font-weight-bold">' .
1035
                get_string('imageauthorname', 'badges') . ': </span>' . $badge->imageauthorname;
723
                get_string('imageauthorname', 'badges') . ': </span>' . $badge->imageauthorname;
1036
            $output .= html_writer::end_tag('li');
724
            $output .= html_writer::end_tag('li');
1037
        }
725
        }
1038
 
726
 
1039
        if (!empty(userdate($badge->imageauthoremail))) {
-
 
1040
            $output .= html_writer::start_tag('li');
727
        if (!empty($badge->imageauthoremail)) {
1041
            $output .= '<span class="mr-1 font-weight-bold">' .
728
            $output .= html_writer::start_tag('li');
1042
                get_string('imageauthoremail', 'badges') .
729
            $output .= '<span class="me-1 font-weight-bold">' .
1043
                ': </span>' .
730
                get_string('imageauthoremail', 'badges') .
1044
                html_writer::tag('a', $badge->imageauthoremail, array('href' => 'mailto:' .
731
                ': </span>' .
1045
                $badge->imageauthoremail));
732
                html_writer::tag('a', $badge->imageauthoremail, ['href' => "mailto:{$badge->imageauthoremail}"]);
1046
            $output .= html_writer::end_tag('li');
733
            $output .= html_writer::end_tag('li');
1047
        }
734
        }
1048
        if (!empty(userdate($badge->imageauthorurl))) {
735
        if (!empty($badge->imageauthorurl)) {
1049
            $output .= html_writer::start_tag('li');
736
            $output .= html_writer::start_tag('li');
1050
            $output .= '<span class="mr-1 font-weight-bold">' . get_string('imageauthorurl', 'badges') .
737
            $output .= '<span class="me-1 font-weight-bold">' . get_string('imageauthorurl', 'badges') .
1051
                ': </span>' . html_writer::link($badge->imageauthorurl, $badge->imageauthorurl, array('target' => '_blank'));
738
                ': </span>' . html_writer::link($badge->imageauthorurl, $badge->imageauthorurl, ['target' => '_blank']);
1052
            $output .= html_writer::end_tag('li');
739
            $output .= html_writer::end_tag('li');
1053
        }
740
        }
1054
        if (!empty($badge->imagecaption)) {
741
        if (!empty($badge->imagecaption)) {
1055
            $output .= html_writer::start_tag('li');
742
            $output .= html_writer::start_tag('li');
1056
            $output .= '<span class="mr-1 font-weight-bold">' .
743
            $output .= '<span class="me-1 font-weight-bold">' .
Línea 1057... Línea 744...
1057
                get_string('imagecaption', 'badges') .
744
                get_string('imagecaption', 'badges') .
1058
                    ': </span>' .
745
                ': </span>' .
Línea 1059... Línea 746...
1059
                    $badge->imagecaption;
746
                $badge->imagecaption;
1060
            $output .= html_writer::end_tag('li');
747
            $output .= html_writer::end_tag('li');
1061
        }
748
        }
1062
        $output .= html_writer::end_tag('div');
749
        $output .= html_writer::end_tag('div');
1063
 
750
 
1064
        $output .= html_writer::end_tag('div'); // End rui-badge-desc.
751
        $output .= html_writer::end_tag('div'); // End rui-badge-desc.
Línea 1065... Línea 752...
1065
        $output .= html_writer::end_tag('div'); // End rui-badge-overview.
752
        $output .= html_writer::end_tag('div'); // End rui-badge-overview.
1066
 
753
 
-
 
754
        if (!empty($badge->issuername) || !empty($badge->issuercontact)) {
-
 
755
            $output .= html_writer::start_tag('span', ['class' => 'alert alert-secondary d-block']);
1067
        if (!empty($badge->issuername) || !empty($badge->issuercontact)) {
756
            $output .= '<span class="me-1 font-weight-bold">' .
-
 
757
                get_string('issuername', 'badges') .
1068
            $output .= html_writer::start_tag('span', array('class' => 'alert alert-secondary d-block'));
758
                ': </span>' .
Línea 1069... Línea 759...
1069
            $output .= '<span class="mr-1 font-weight-bold">' .
759
                $badge->issuername;
1070
                get_string('issuername', 'badges') .
760
 
Línea 1071... Línea 761...
1071
                ': </span>' .
761
            if (!empty($badge->issuername) || !empty($badge->issuercontact)) {
Línea 1072... Línea 762...
1072
                $badge->issuername;
762
                $output .= html_writer::tag(
1073
 
763
                    'a',
Línea 1074... Línea 764...
1074
            if (!empty($badge->issuername) || !empty($badge->issuercontact)) {
764
                    $badge->issuercontact,
1075
                $output .= html_writer::tag('a', $badge->issuercontact,
765
                    ['href' => "mailto:{$badge->issuercontact}"]
1076
                    array('href' => 'mailto:' . $badge->issuercontact));
766
                );
1077
            }
767
            }
1078
 
768
 
1079
            $output .= html_writer::end_tag('span');
769
            $output .= html_writer::end_tag('span');
1080
        }
770
        }
1081
 
771
 
1082
        $output .= html_writer::start_tag('div', array('class' => 'wrapper-fw'));
772
        $output .= html_writer::start_tag('div', ['class' => 'wrapper-fw']);
Línea 1099... Línea 789...
1099
            stroke-linejoin="round"></path>
789
            stroke-linejoin="round"></path>
1100
            </svg>' . get_string('bcriteria', 'badges');
790
            </svg>' . get_string('bcriteria', 'badges');
1101
        $output .= html_writer::end_tag('h5');
791
        $output .= html_writer::end_tag('h5');
Línea 1102... Línea 792...
1102
 
792
 
1103
        if ($badge->has_criteria()) {
793
        if ($badge->has_criteria()) {
1104
            $output .= '<div class="ml-4">' . self::print_badge_criteria($badge) . '</div>';
794
            $output .= '<div class="ms-4">' . self::print_badge_criteria($badge) . '</div>';
1105
        } else {
795
        } else {
1106
            $output .= '<p class="ml-4">' . get_string('nocriteria', 'badges') . '</p>';
796
            $output .= '<p class="ms-4">' . get_string('nocriteria', 'badges') . '</p>';
1107
            if (has_capability('moodle/badges:configurecriteria', $context)) {
797
            if (has_capability('moodle/badges:configurecriteria', $context)) {
1108
                $output .= $this->output->single_button(
798
                $output .= $this->output->single_button(
1109
                    new moodle_url('/badges/criteria.php', array('id' => $badge->id)),
799
                    new moodle_url('/badges/criteria.php', ['id' => $badge->id]),
1110
                    get_string('addcriteria', 'badges'),
800
                    get_string('addcriteria', 'badges'),
1111
                    'POST',
801
                    'POST',
1112
                    array('class' => 'activatebadge ml-4')
802
                    ['class' => 'activatebadge ms-4']
1113
                );
803
                );
1114
            }
804
            }
1115
        }
805
        }
Línea 1116... Línea 806...
1116
        $output .= html_writer::end_tag('div');
806
        $output .= html_writer::end_tag('div');
1117
 
807
 
1118
        // Awards details if any.
808
        // Awards details if any.
1119
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-awards my-4'));
809
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-awards my-4']);
1120
        if (has_capability('moodle/badges:viewawarded', $context)) {
810
        if (has_capability('moodle/badges:viewawarded', $context)) {
1121
            $output .= html_writer::start_tag('h5', array('class' => 'd-inline-flex align-items-center w-100'));
811
            $output .= html_writer::start_tag('h5', ['class' => 'd-inline-flex align-items-center w-100']);
1122
            $output .= '<svg class="mr-2"
812
            $output .= '<svg class="me-2"
1123
                width="24"
813
                width="22"
1124
                height="24"
814
                height="22"
1125
                fill="none"
815
                fill="none"
1126
                viewBox="0 0 24 24"><path stroke="currentColor"
816
                viewBox="0 0 24 24"><path stroke="currentColor"
1127
                stroke-linecap="round"
817
                stroke-linecap="round"
Línea 1151... Línea 841...
1151
                            stroke-linejoin="round"
841
                            stroke-linejoin="round"
1152
                            stroke-width="1.5"
842
                            stroke-width="1.5"
1153
                            d="M14.75 10.25C16.2688 10.25 17.25 9.01878 17.25
843
                            d="M14.75 10.25C16.2688 10.25 17.25 9.01878 17.25
1154
                            7.5C17.25 5.98122 16.2688 4.75 14.75 4.75"></path>
844
                            7.5C17.25 5.98122 16.2688 4.75 14.75 4.75"></path>
1155
                            </svg>' .
845
                            </svg>' .
1156
                        get_string('awards', 'badges');
846
                get_string('awards', 'badges');
1157
            $output .= html_writer::end_tag('h5');
847
            $output .= html_writer::end_tag('h5');
Línea 1158... Línea 848...
1158
 
848
 
1159
            if ($badge->has_awards()) {
849
            if ($badge->has_awards()) {
1160
                $url = new moodle_url('/badges/recipients.php', array('id' => $badge->id));
850
                $url = new moodle_url('/badges/recipients.php', ['id' => $badge->id]);
-
 
851
                $a = new stdClass();
1161
                $a = new stdClass();
852
                $a->badgename = $badge->name;
1162
                $a->link = $url->out();
853
                $a->link = $url->out();
-
 
854
                $a->count = count($badge->get_awards());
1163
                $a->count = count($badge->get_awards());
855
                $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
-
 
856
                $output .= get_string('numawards', 'badges', $a);
1164
                $output .= get_string('numawards', 'badges', $a);
857
                $output .= html_writer::end_tag('div');
1165
            } else {
858
            } else {
1166
                $output .= html_writer::start_tag('div', array('class' => 'ml-4'));
859
                $output .= html_writer::start_tag('div', ['class' => 'ms-4']);
1167
                $output .= get_string('noawards', 'badges');
860
                $output .= get_string('noawards', 'badges');
1168
                $output .= html_writer::end_tag('div');
861
                $output .= html_writer::end_tag('div');
Línea 1169... Línea 862...
1169
            }
862
            }
1170
 
863
 
1171
            if (
864
            if (
1172
                has_capability('moodle/badges:awardbadge', $context) &&
865
                has_capability('moodle/badges:awardbadge', $context) &&
1173
                $badge->has_manual_award_criteria() &&
866
                $badge->has_manual_award_criteria() &&
1174
                $badge->is_active()
867
                $badge->is_active()
1175
            ) {
868
            ) {
1176
                $output .= html_writer::start_tag('div', array('class' => 'mt-3 ml-4'));
869
                $output .= html_writer::start_tag('div', ['class' => 'mt-3 ms-4']);
1177
                $output .= $this->output->single_button(
870
                $output .= $this->output->single_button(
1178
                    new moodle_url('/badges/award.php', array('id' => $badge->id)),
871
                    new moodle_url('/badges/award.php', ['id' => $badge->id]),
1179
                    get_string('award', 'badges'),
872
                    get_string('award', 'badges'),
1180
                    'POST',
873
                    'POST',
1181
                    array('class' => 'activatebadge ml-auto')
874
                    ['class' => 'activatebadge ml-auto']
1182
                );
875
                );
1183
                $output .= html_writer::end_tag('div');
876
                $output .= html_writer::end_tag('div');
1184
            }
877
            }
Línea 1185... Línea 878...
1185
        }
878
        }
1186
        $output .= html_writer::end_tag('div');
879
        $output .= html_writer::end_tag('div');
1187
 
880
 
Línea 1188... Línea 881...
1188
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-endorsement my-4'));
881
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-endorsement my-4']);
1189
        $output .= self::print_badge_endorsement($badge);
882
        $output .= self::print_badge_endorsement($badge);
1190
        $output .= html_writer::end_tag('div');
883
        $output .= html_writer::end_tag('div');
Línea 1191... Línea 884...
1191
 
884
 
1192
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-related my-4'));
885
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-related my-4']);
1193
        $output .= self::print_badge_related($badge);
886
        $output .= self::print_badge_related($badge);
Línea 1194... Línea 887...
1194
        $output .= html_writer::end_tag('div');
887
        $output .= html_writer::end_tag('div');
Línea 1195... Línea 888...
1195
 
888
 
1196
        $output .= html_writer::start_tag('div', array('class' => 'rui-badge-alignments my-4'));
-
 
1197
        $output .= self::print_badge_alignments($badge);
-
 
1198
        $output .= html_writer::end_tag('div');
889
        $output .= html_writer::start_tag('div', ['class' => 'rui-badge-alignments my-4']);
1199
 
890
        $output .= self::print_badge_alignments($badge);
Línea 1200... Línea 891...
1200
        $output .= html_writer::end_tag('div'); // End wrapper-fw.
891
        $output .= html_writer::end_tag('div');
1201
 
892
 
Línea 1217... Línea 908...
1217
 
908
 
Línea 1218... Línea 909...
1218
        $mform = new MoodleQuickForm('searchform', 'POST', $this->page->url);
909
        $mform = new MoodleQuickForm('searchform', 'POST', $this->page->url);
Línea 1219... Línea 910...
1219
 
910
 
1220
        $mform->addElement('hidden', 'sesskey', sesskey());
911
        $mform->addElement('hidden', 'sesskey', sesskey());
1221
 
912
 
1222
        $el[] = $mform->createElement('text', 'search', get_string('search'), array('size' => 30));
913
        $el[] = $mform->createElement('text', 'search', get_string('search'), ['size' => 30]);
1223
        $mform->setDefault('search', $search);
914
        $mform->setDefault('search', $search);