forked from bmbrands/moodle-theme_elegance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.php
662 lines (584 loc) · 22.2 KB
/
lib.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The Elegance theme is built upon Bootstrapbase 3 (non-core).
*
* @package theme
* @subpackage theme_elegance
* @author Julian (@moodleman) Ridden
* @author Based on code originally written by G J Bernard, Mary Evans, Bas Brands, Stuart Lamour and David Scotson.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function theme_elegance_get_nav_links($course, $sections, $sectionno) {
// FIXME: This is really evil and should by using the navigation API.
$courseformat = course_get_format($course);
$course = $courseformat->get_course();
$previousarrow= '<i class="nav_icon fa fa-chevron-circle-left"></i>';
$nextarrow= '<i class="nav_icon fa fa-chevron-circle-right"></i>';
$canviewhidden = has_capability('moodle/course:viewhiddensections', context_course::instance($course->id))
or !$course->hiddensections;
$links = array('previous' => '', 'next' => '');
$back = $sectionno - 1;
while ($back > 0 and empty($links['previous'])) {
if ($canviewhidden || $sections[$back]->uservisible) {
$params = array('id' => 'previous_section');
if (!$sections[$back]->visible) {
$params = array('id' => 'previous_section', 'class' => 'dimmed_text');
}
$previouslink = $previousarrow;
$previouslink .= html_writer::start_tag('span', array('class' => 'text'));
$previouslink .= html_writer::start_tag('span', array('class' => 'nav_guide'));
$previouslink .= get_string('previoussection', 'theme_elegance');
$previouslink .= html_writer::end_tag('span');
$previouslink .= html_writer::empty_tag('br');
$previouslink .= $courseformat->get_section_name($sections[$back]);
$previouslink .= html_writer::end_tag('span');
$links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink, $params);
}
$back--;
}
$forward = $sectionno + 1;
while ($forward <= $course->numsections and empty($links['next'])) {
if ($canviewhidden || $sections[$forward]->uservisible) {
$params = array('id' => 'next_section');
if (!$sections[$forward]->visible) {
$params = array('id' => 'next_section', 'class' => 'dimmed_text');
}
$nextlink = $nextarrow;
$nextlink .= html_writer::start_tag('span', array('class' => 'text'));
$nextlink .= html_writer::start_tag('span', array('class' => 'nav_guide'));
$nextlink .= get_string('nextsection', 'theme_elegance');
$nextlink .= html_writer::end_tag('span');
$nextlink .= html_writer::empty_tag('br');
$nextlink .= $courseformat->get_section_name($sections[$forward]);
$nextlink .= html_writer::end_tag('span');
$links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink, $params);
}
$forward++;
}
return $links;
}
function theme_elegance_bootstrap3_grid($hassidepost) {
$regions = array('content' => 'col-sm-8 col-md-9');
$regions['pre'] = 'empty';
$regions['post'] = 'col-sm-4 col-md-3';
return $regions;
}
function theme_elegance_initialise_reader(moodle_page $page) {
$page->requires->yui_module('moodle-theme_elegance-reader', 'M.theme_elegance.initreader', array());
}
function theme_elegance_process_css($css, $theme) {
// Set the background image for the logo.
$logo = $theme->setting_file_url('logo', 'logo');
$css = theme_elegance_set_logo($css, $logo);
// Set the background image for the header.
$setting = 'headerbg';
$headerbg = $theme->setting_file_url($setting, $setting);
$css = theme_elegance_set_headerbg($css, $headerbg, $setting);
// Set the background image for the Page.
$setting = 'bodybg';
$bodybg = $theme->setting_file_url($setting, $setting);
$css = theme_elegance_set_bodybg($css, $bodybg, $setting);
// Set custom CSS.
if (!empty($theme->settings->customcss)) {
$customcss = $theme->settings->customcss;
} else {
$customcss = null;
}
$css = theme_elegance_set_customcss($css, $customcss);
// Set custom Moodle Mobile CSS.
if (!empty($theme->settings->moodlemobilecss)) {
$moodlemobilecss = $theme->settings->moodlemobilecss;
} else {
$moodlemobilecss = null;
}
$css = theme_elegance_set_moodlemobilecss($css, $moodlemobilecss);
// Set the theme main color.
if (!empty($theme->settings->themecolor)) {
$themecolor = $theme->settings->themecolor;
} else {
$themecolor = null;
}
$css = theme_elegance_set_themecolor($css, $themecolor);
// Set the theme backgroundcolor.
if (!empty($theme->settings->bodycolor)) {
$bodycolor = $theme->settings->bodycolor;
} else {
$bodycolor = null;
}
$css = theme_elegance_set_bodycolor($css, $bodycolor);
// Set the font color.
if (!empty($theme->settings->fontcolor)) {
$fontcolor = $theme->settings->fontcolor;
} else {
$fontcolor = null;
}
$css = theme_elegance_set_fontcolor($css, $fontcolor);
// Set the heading color.
if (!empty($theme->settings->headingcolor)) {
$headingcolor = $theme->settings->headingcolor;
} else {
$headingcolor = null;
}
$css = theme_elegance_set_headingcolor($css, $headingcolor);
// Set the Video Max width.
if (!empty($theme->settings->videowidth)) {
$videowidth = $theme->settings->videowidth;
} else {
$videowidth = null;
}
$css = theme_elegance_set_videowidth($css, $videowidth);
// Set Quicklink Icon Color.
foreach (range(1, 12) as $quicklinksnumber) {
$quicklinkiconcolor = $theme->settings->themecolor;
if (!empty($theme->settings->{'quicklinkiconcolor' . $quicklinksnumber})) {
$quicklinkiconcolor = $theme->settings->{'quicklinkiconcolor' . $quicklinksnumber};
}
$css = theme_elegance_set_quicklinkiconcolor($css, $quicklinkiconcolor, $quicklinksnumber);
}
// Set Quicklink Button Color.
foreach (range(1, 12) as $quicklinksnumber) {
$quicklinkbuttoncolor = '#ecedf0';
if (!empty($theme->settings->{'quicklinkbuttoncolor' . $quicklinksnumber})) {
$quicklinkbuttoncolor = $theme->settings->{'quicklinkbuttoncolor' . $quicklinksnumber};
}
$css = theme_elegance_set_quicklinkbuttoncolor($css, $quicklinkbuttoncolor, $quicklinksnumber);
}
// Set the Slide 1 color.
if (!empty($theme->settings->bannercolor1)) {
$bannercolor1 = $theme->settings->bannercolor1;
} else {
$bannercolor1 = null;
}
$css = theme_elegance_set_bannercolor1($css, $bannercolor1);
// Set the Slide 2 color.
if (!empty($theme->settings->bannercolor2)) {
$bannercolor2 = $theme->settings->bannercolor2;
} else {
$bannercolor2 = null;
}
$css = theme_elegance_set_bannercolor2($css, $bannercolor2);
// Set the Slide 3 color.
if (!empty($theme->settings->bannercolor3)) {
$bannercolor3 = $theme->settings->bannercolor3;
} else {
$bannercolor3 = null;
}
$css = theme_elegance_set_bannercolor3($css, $bannercolor3);
// Set the Slide 4 color.
if (!empty($theme->settings->bannercolor4)) {
$bannercolor4 = $theme->settings->bannercolor4;
} else {
$bannercolor4 = null;
}
$css = theme_elegance_set_bannercolor4($css, $bannercolor4);
// Set the Slide 5 color.
if (!empty($theme->settings->bannercolor5)) {
$bannercolor5 = $theme->settings->bannercolor5;
} else {
$bannercolor5 = null;
}
$css = theme_elegance_set_bannercolor5($css, $bannercolor5);
// Set the Slide 6 color.
if (!empty($theme->settings->bannercolor6)) {
$bannercolor6 = $theme->settings->bannercolor6;
} else {
$bannercolor6 = null;
}
$css = theme_elegance_set_bannercolor6($css, $bannercolor6);
// Set the Slide 7 color.
if (!empty($theme->settings->bannercolor7)) {
$bannercolor7 = $theme->settings->bannercolor7;
} else {
$bannercolor7 = null;
}
$css = theme_elegance_set_bannercolor7($css, $bannercolor7);
// Set the Slide 8 color.
if (!empty($theme->settings->bannercolor8)) {
$bannercolor8 = $theme->settings->bannercolor8;
} else {
$bannercolor8 = null;
}
$css = theme_elegance_set_bannercolor8($css, $bannercolor8);
// Set the Slide 9 color.
if (!empty($theme->settings->bannercolor9)) {
$bannercolor9 = $theme->settings->bannercolor9;
} else {
$bannercolor9 = null;
}
$css = theme_elegance_set_bannercolor9($css, $bannercolor9);
// Set the Slide 10 color.
if (!empty($theme->settings->bannercolor10)) {
$bannercolor10 = $theme->settings->bannercolor10;
} else {
$bannercolor10 = null;
}
$css = theme_elegance_set_bannercolor10($css, $bannercolor10);
// Set the Transparency.
if (!empty($theme->settings->transparency)) {
$transparency = $theme->settings->transparency;
} else {
$transparency = null;
}
$css = theme_elegance_set_transparency($css, $transparency);
return $css;
}
/**
* Adds the logo to CSS.
*
* @param string $css The CSS.
* @param string $logo The URL of the logo.
* @return string The parsed CSS
*/
function theme_elegance_set_logo($css, $logo) {
global $OUTPUT;
$tag = '[[setting:logo]]';
$replacement = $logo;
if (is_null($replacement)) {
$replacement = $OUTPUT->pix_url('bg/logo', 'theme');
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_themecolor($css, $themecolor) {
$tag = '[[setting:themecolor]]';
$replacement = $themecolor;
if (is_null($replacement)) {
$replacement = '#0098e0';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bodycolor($css, $bodycolor) {
$tag = '[[setting:bodycolor]]';
$replacement = $bodycolor;
if (is_null($replacement)) {
$replacement = '#f1f1f4';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_fontcolor($css, $fontcolor) {
$tag = '[[setting:fontcolor]]';
$replacement = $fontcolor;
if (is_null($replacement)) {
$replacement = '#666';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_headingcolor($css, $headingcolor) {
$tag = '[[setting:headingcolor]]';
$replacement = $headingcolor;
if (is_null($replacement)) {
$replacement = '#27282a';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
/**
* Serves any files associated with the theme settings.
*
* @param stdClass $course
* @param stdClass $cm
* @param context $context
* @param string $filearea
* @param array $args
* @param bool $forcedownload
* @param array $options
* @return bool
*/
function theme_elegance_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM) {
$theme = theme_config::load('elegance');
if ($filearea === 'logo') {
return $theme->setting_file_serve('logo', $args, $forcedownload, $options);
} else if ($filearea === 'headerbg') {
return $theme->setting_file_serve('headerbg', $args, $forcedownload, $options);
} else if ($filearea === 'bodybg') {
return $theme->setting_file_serve('bodybg', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage1') {
return $theme->setting_file_serve('bannerimage1', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage2') {
return $theme->setting_file_serve('bannerimage2', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage3') {
return $theme->setting_file_serve('bannerimage3', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage4') {
return $theme->setting_file_serve('bannerimage4', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage5') {
return $theme->setting_file_serve('bannerimage5', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage6') {
return $theme->setting_file_serve('bannerimage6', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage7') {
return $theme->setting_file_serve('bannerimage7', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage8') {
return $theme->setting_file_serve('bannerimage8', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage9') {
return $theme->setting_file_serve('bannerimage9', $args, $forcedownload, $options);
} else if ($filearea === 'bannerimage10') {
return $theme->setting_file_serve('bannerimage10', $args, $forcedownload, $options);
} else if ($filearea === 'loginimage1') {
return $theme->setting_file_serve('loginimage1', $args, $forcedownload, $options);
} else if ($filearea === 'loginimage2') {
return $theme->setting_file_serve('loginimage2', $args, $forcedownload, $options);
} else if ($filearea === 'loginimage3') {
return $theme->setting_file_serve('loginimage3', $args, $forcedownload, $options);
} else if ($filearea === 'loginimage4') {
return $theme->setting_file_serve('loginimage4', $args, $forcedownload, $options);
} else if ($filearea === 'loginimage5') {
return $theme->setting_file_serve('loginimage5', $args, $forcedownload, $options);
} else {
send_file_not_found();
}
} else {
send_file_not_found();
}
}
/**
* Adds any custom CSS to the CSS before it is cached.
*
* @param string $css The original CSS.
* @param string $customcss The custom CSS to add.
* @return string The CSS which now contains our custom CSS.
*/
function theme_elegance_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
if (is_null($replacement)) {
$replacement = '';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
/**
* Adds any custom Moodle Mobile CSS to the CSS before it is cached.
*
* @param string $css The original CSS.
* @param string $moodlemobilecss The custom CSS to add.
* @return string The CSS which now contains our custom Moodle Mobile CSS.
*/
function theme_elegance_set_moodlemobilecss($css, $moodlemobilecss) {
$tag = '[[setting:moodlemobilecss]]';
$replacement = $moodlemobilecss;
if (is_null($replacement)) {
$replacement = '';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
/**
* Returns an object containing HTML for the areas affected by settings.
*
* @param renderer_base $output Pass in $OUTPUT.
* @param moodle_page $page Pass in $PAGE.
* @return stdClass An object with the following properties:
* - navbarclass A CSS class to use on the navbar. By default ''.
* - heading HTML to use for the heading. A logo if one is selected or the default heading.
* - footnote HTML to use as a footnote. By default ''.
*/
function theme_elegance_get_html_for_settings(renderer_base $output, moodle_page $page) {
global $CFG;
$return = new stdClass;
$return->navbarclass = ' ';
if (!empty($page->theme->settings->invert)) {
$return->navbarclass .= 'navbar-inverse';
} else {
$return->navbarclass .= 'navbar-default';
}
$return->footnote = '';
if (!empty($page->theme->settings->footnote)) {
$return->footnote = '<div class="footnote text-center">'.$page->theme->settings->footnote.'</div>';
}
return $return;
}
/**
* All theme functions should start with theme_elegance_
* @deprecated since 2.5.1
*/
function elegance_process_css() {
throw new coding_exception('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__);
}
/**
* All theme functions should start with theme_elegance_
* @deprecated since 2.5.1
*/
function elegance_set_logo() {
throw new coding_exception('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__);
}
/**
* All theme functions should start with theme_elegance_
* @deprecated since 2.5.1
*/
function elegance_set_customcss() {
throw new coding_exception('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__);
}
function theme_elegance_set_headerbg($css, $headerbg, $setting) {
global $OUTPUT;
$tag = '[[setting:headerbg]]';
$replacement = $headerbg;
if (is_null($replacement)) {
// Get default image from themes 'bg' folder of the name in $setting.
$replacement = $OUTPUT->pix_url('bg/header', 'theme');
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bodybg($css, $bodybg, $setting) {
global $OUTPUT;
$tag = '[[setting:bodybg]]';
$replacement = $bodybg;
if (is_null($replacement)) {
// Get default image from themes 'bg' folder of the name in $setting.
$replacement = $OUTPUT->pix_url('bg/body', 'theme');
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_quicklinkiconcolor($css, $quicklinkiconcolor, $quicklinksnumber) {
$tag = '[[setting:quicklinkiconcolor' . $quicklinksnumber . ']]';
$replacement = $quicklinkiconcolor;
if (is_null($replacement)) {
$replacement = $theme->settings->themecolor;
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_quicklinkbuttoncolor($css, $quicklinkbuttoncolor, $quicklinksnumber) {
$tag = '[[setting:quicklinkbuttoncolor' . $quicklinksnumber . ']]';
$replacement = $quicklinkbuttoncolor;
if (is_null($replacement)) {
$replacement = '#ecedf0';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor1($css, $bannercolor1) {
$tag = '[[setting:slide1color]]';
$replacement = $bannercolor1;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor2($css, $bannercolor2) {
$tag = '[[setting:slide2color]]';
$replacement = $bannercolor2;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor3($css, $bannercolor3) {
$tag = '[[setting:slide3color]]';
$replacement = $bannercolor3;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor4($css, $bannercolor4) {
$tag = '[[setting:slide4color]]';
$replacement = $bannercolor4;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor5($css, $bannercolor5) {
$tag = '[[setting:slide5color]]';
$replacement = $bannercolor5;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor6($css, $bannercolor6) {
$tag = '[[setting:slide6color]]';
$replacement = $bannercolor6;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor7($css, $bannercolor7) {
$tag = '[[setting:slide7color]]';
$replacement = $bannercolor7;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor8($css, $bannercolor8) {
$tag = '[[setting:slide8color]]';
$replacement = $bannercolor8;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor9($css, $bannercolor9) {
$tag = '[[setting:slide9color]]';
$replacement = $bannercolor9;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_bannercolor10($css, $bannercolor10) {
$tag = '[[setting:slide10color]]';
$replacement = $bannercolor10;
if (is_null($replacement)) {
$replacement = '#000000';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_transparency($css, $transparency) {
$tag = '[[setting:transparency]]';
$replacement = $transparency;
if (is_null($replacement)) {
$replacement = '1';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_set_videowidth($css, $videowidth) {
$tag = '[[setting:videowidth]]';
$replacement = $videowidth;
if (is_null($replacement)) {
$replacement = '100%';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
function theme_elegance_page_init(moodle_page $page) {
$page->requires->jquery();
$page->requires->jquery_plugin('fitvids', 'theme_elegance');
$page->requires->jquery_plugin('nprogress', 'theme_elegance');
$page->requires->jquery_plugin('unslider', 'theme_elegance');
$page->requires->jquery_plugin('eventswipe', 'theme_elegance');
$page->requires->jquery_plugin('backstretch', 'theme_elegance');
$page->requires->jquery_plugin('modernizr', 'theme_elegance');
}