-
Notifications
You must be signed in to change notification settings - Fork 4
/
settings.php
1362 lines (1239 loc) · 61.8 KB
/
settings.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
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?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/>.
/**
* Campus theme.
*
* @package theme_campus
* @copyright © 2014-onwards G J Barnard.
* @copyright © 2014-onwards Work undertaken for David Bogner of Edulabs.org.
* @copyright © 2020-onwards Work undertaken for David Bogner of Wunderbyte.at.
* @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195}
* @author Based on code originally written by Mary Evans, Bas Brands, Stuart Lamour and David Scotson.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings = new theme_boost_admin_settingspage_tabs('themesettingcampus', get_string('configtitle', 'theme_campus'));
// Generic settings.
$settingpage = new admin_settingpage('theme_campus_generic', get_string('genericsettings', 'theme_campus'));
global $CFG;
if (file_exists("{$CFG->dirroot}/theme/campus/admin_setting_configinteger.php")) {
require_once($CFG->dirroot . '/theme/campus/admin_setting_configinteger.php');
} else if (!empty($CFG->themedir) && file_exists("{$CFG->themedir}/campus/admin_setting_configinteger.php")) {
require_once($CFG->themedir . '/campus/admin_setting_configinteger.php');
}
$settingpage->add(new admin_setting_heading('theme_campus_privacy', '',
get_string('privacy:note', 'theme_campus')));
$settingpage->add(new admin_setting_heading(
'theme_campus_generalheading',
null,
format_text(get_string('generalheadingdesc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Login alternative URL setting.
$name = 'theme_campus/alternateloginurl';
$title = get_string('alternateloginurl', 'theme_campus');
$description = get_string('alternateloginurldesc', 'theme_campus');
$default = 0;
$sql = "SELECT DISTINCT h.id, h.wwwroot, h.name, a.sso_jump_url, a.name as application
FROM {mnet_host} h
JOIN {mnet_host2service} m ON h.id = m.hostid
JOIN {mnet_service} s ON s.id = m.serviceid
JOIN {mnet_application} a ON h.applicationid = a.id
WHERE s.name = ? AND h.deleted = ? AND m.publish = ?";
$params = ['sso_sp', 0, 1];
if (!empty($CFG->mnet_all_hosts_id)) {
$sql .= " AND h.id <> ?";
$params[] = $CFG->mnet_all_hosts_id;
}
if ($hosts = $DB->get_records_sql($sql, $params)) {
$choices = [];
$choices[0] = 'notset';
foreach ($hosts as $id => $host) {
$choices[$id] = $host->name;
}
} else {
$choices = [];
$choices[0] = 'notset';
}
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Hide local login on login page.
$name = 'theme_campus/hidelocallogin';
$title = get_string('hidelocallogin', 'theme_campus');
$description = get_string('hidelocallogindesc', 'theme_campus');
$default = false;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Show login info header.
$name = 'theme_campus/showlogininfoheader';
$title = get_string('showlogininfoheader', 'theme_campus');
$description = get_string('showlogininfoheaderdesc', 'theme_campus');
$default = true;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Show login info footer.
$name = 'theme_campus/showlogininfofooter';
$title = get_string('showlogininfofooter', 'theme_campus');
$description = get_string('showlogininfofooterdesc', 'theme_campus');
$default = true;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Favicon file setting.
$name = 'theme_campus/favicon';
$title = get_string('favicon', 'theme_campus');
$description = get_string('favicondesc', 'theme_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'favicon');
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Number of course blocks.
$name = 'theme_campus/numcourseblocks';
$title = get_string('numcourseblocks', 'theme_campus');
$description = get_string('numcourseblocksdesc', 'theme_campus');
$choices = [
1 => new lang_string('one', 'theme_campus'),
2 => new lang_string('two', 'theme_campus'),
3 => new lang_string('three', 'theme_campus'),
4 => new lang_string('four', 'theme_campus'),
];
$default = 2;
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Custom CSS.
$name = 'theme_campus/customcss';
$title = get_string('customcss', 'theme_campus');
$description = get_string('customcssdesc', 'theme_campus');
$default = '';
$setting = new admin_setting_configtextarea($name, $title, $description, $default);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Must add the page after defining all the settings!
$settings->add($settingpage);
// Look and feel settings.
$settingpage = new admin_settingpage('theme_campus_landf', get_string('landfsettings', 'theme_campus'));
$settingpage->add(new admin_setting_heading(
'theme_campus_landfheading',
null,
format_text(get_string('landfheadingdesc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Page width maximum.
$name = 'theme_campus/pagewidthmax';
$title = get_string('pagewidthmax', 'theme_campus');
$description = get_string('pagewidthmaxdesc', 'theme_campus');
$default = '1680';
$choices = [
'1000' => new lang_string('px1000', 'theme_campus'),
'1200' => new lang_string('px1200', 'theme_campus'),
'1400' => new lang_string('px1400', 'theme_campus'),
'1680' => new lang_string('px1680', 'theme_campus'),
'100' => new lang_string('per100', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
$currentpagewidthmaxheaders = get_config('theme_campus', 'pagewidthmax'); // Current value for other setting information descriptions below.
if ($currentpagewidthmaxheaders == 100) { // Percentage value.
$currentpagewidthmaxheaders = 1680; // Default for headers as need px max width.
}
// Heading font.
$name = 'theme_campus/headingfont';
$title = get_string('headingfont', 'theme_campus');
$description = get_string('headingfontdesc', 'theme_campus');
$default = 'Roboto Condensed';
$choices = [
'Droid Serif' => 'Droid Serif',
'EB Garamond' => 'EB Garamond',
'Jura' => 'Jura',
'Nunito' => 'Nunito',
'Roboto Condensed' => 'Roboto Condensed',
'Source Sans Pro' => 'Source Sans Pro',
'Titillium Text' => 'Titillium Text',
'Ubuntu' => 'Ubuntu',
'Vollkorn' => 'Vollkorn',
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Body font.
$name = 'theme_campus/bodyfont';
$title = get_string('bodyfont', 'theme_campus');
$description = get_string('bodyfontdesc', 'theme_campus');
$default = 'Questrial';
$choices = [
'Open Sans' => 'Open Sans',
'Questrial' => 'Questrial',
'Roboto Condensed' => 'Roboto Condensed',
'Source Sans Pro' => 'Source Sans Pro',
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Text colour setting.
$name = 'theme_campus/textcolour';
$title = get_string('textcolour', 'theme_campus');
$description = get_string('textcolourdesc', 'theme_campus');
$default = '#333333';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Link colour setting.
$name = 'theme_campus/linkcolour';
$title = get_string('linkcolour', 'theme_campus');
$description = get_string('linkcolourdesc', 'theme_campus');
$default = '#333333';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Content colour setting.
$name = 'theme_campus/contentcolour';
$title = get_string('contentcolour', 'theme_campus');
$description = get_string('contentcolourdesc', 'theme_campus');
$default = '#ffffff';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Heading colour setting.
$name = 'theme_campus/headingcolour';
$title = get_string('headingcolour', 'theme_campus');
$description = get_string('headingcolourdesc', 'theme_campus');
$default = '#555555';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Navbar text colour setting.
$name = 'theme_campus/navbartextcolour';
$title = get_string('navbartextcolour', 'theme_campus');
$description = get_string('navbartextcolourdesc', 'theme_campus');
$default = '#eeeeee';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Navbar link colour setting.
$name = 'theme_campus/navbarlinkcolour';
$title = get_string('navbarlinkcolour', 'theme_campus');
$description = get_string('navbarlinkcolourdesc', 'theme_campus');
$default = '#eeeeee';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Navbar icon colour setting.
$name = 'theme_campus/navbariconcolour';
$title = get_string('navbariconcolour', 'theme_campus');
$description = get_string('navbariconcolourdesc', 'theme_campus');
$default = '#eeeeee';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Navbar background colour setting.
$name = 'theme_campus/navbarbackgroundcolour';
$title = get_string('navbarbackgroundcolour', 'theme_campus');
$description = get_string('navbarbackgroundcolourdesc', 'theme_campus');
$default = '#ec8600';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block heading colour setting.
$name = 'theme_campus/blockheadingcolour';
$title = get_string('blockheadingcolour', 'theme_campus');
$description = get_string('blockheadingcolourdesc', 'theme_campus');
$default = '#190300';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block heading background colour setting.
$name = 'theme_campus/blockheadingbackgroundcolour';
$title = get_string('blockheadingbackgroundcolour', 'theme_campus');
$description = get_string('blockheadingbackgroundcolourdesc', 'theme_campus');
$default = '#a1d6de';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block background colour setting.
$name = 'theme_campus/blockbackgroundcolour';
$title = get_string('blockbackgroundcolour', 'theme_campus');
$description = get_string('blockbackgroundcolourdesc', 'theme_campus');
$default = '#ffffff';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block border options.
$name = 'theme_campus/blockborderoptions';
$title = get_string('blockborderoptions', 'theme_campus');
$description = get_string('blockborderoptionsdesc', 'theme_campus');
$default = 2;
$choices = [
1 => new lang_string('blocknoborder', 'theme_campus'),
2 => new lang_string('blockborderall', 'theme_campus'),
3 => new lang_string('blockborderheader', 'theme_campus'),
4 => new lang_string('blockbordercontent', 'theme_campus'),
5 => new lang_string('blockborderthreelines', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block border colour setting.
$name = 'theme_campus/blockbordercolour';
$title = get_string('blockbordercolour', 'theme_campus');
$description = get_string('blockbordercolourdesc', 'theme_campus');
$default = '#a1d6de';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block border thickness.
$name = 'theme_campus/blockborderthickness';
$title = get_string('blockborderthickness', 'theme_campus');
$description = get_string('blockborderthicknessdesc', 'theme_campus');
$default = '2px';
$choices = [
'1px' => new lang_string('px01', 'theme_campus'),
'2px' => new lang_string('px02', 'theme_campus'),
'3px' => new lang_string('px03', 'theme_campus'),
'4px' => new lang_string('px04', 'theme_campus'),
'5px' => new lang_string('px05', 'theme_campus'),
'6px' => new lang_string('px06', 'theme_campus'),
'7px' => new lang_string('px07', 'theme_campus'),
'8px' => new lang_string('px08', 'theme_campus'),
'9px' => new lang_string('px09', 'theme_campus'),
'10px' => new lang_string('px10', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Block border style.
$name = 'theme_campus/blockborderstyle';
$title = get_string('blockborderstyle', 'theme_campus');
$description = get_string('blockborderstyledesc', 'theme_campus');
$default = 'solid';
$choices = [
'none' => new lang_string('blockborderstylenone', 'theme_campus'),
'hidden' => new lang_string('blockborderstylehidden', 'theme_campus'),
'dotted' => new lang_string('blockborderstyledotted', 'theme_campus'),
'dashed' => new lang_string('blockborderstyledashed', 'theme_campus'),
'solid' => new lang_string('blockborderstylesolid', 'theme_campus'),
'double' => new lang_string('blockborderstyledouble', 'theme_campus'),
'groove' => new lang_string('blockborderstylegroove', 'theme_campus'),
'ridge' => new lang_string('blockborderstylenridge', 'theme_campus'),
'inset' => new lang_string('blockborderstyleninset', 'theme_campus'),
'outset' => new lang_string('blockborderstylenoutset', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Theme colour setting.
$name = 'theme_campus/themecolour';
$title = get_string('themecolour', 'theme_campus');
$description = get_string('themecolourdesc', 'theme_campus');
$default = '#263683';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Theme background colour setting.
$name = 'theme_campus/themebackgroundcolour';
$title = get_string('themebackgroundcolour', 'theme_campus');
$description = get_string('themebackgroundcolourdesc', 'theme_campus');
$default = '#ffffff';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Forum header text colour setting.
$name = 'theme_campus/forumheadertextcolour';
$title = get_string('forumheadertextcolour', 'theme_campus');
$description = get_string('forumheadertextcolourdesc', 'theme_campus');
$default = '#333333';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Small border radius.
$name = 'theme_campus/borderradiussmall';
$title = get_string('borderradiussmall', 'theme_campus');
$description = get_string('borderradiussmall_desc', 'theme_campus');
$default = '3px';
$choices = [
'0px' => new lang_string('px00', 'theme_campus'),
'1px' => new lang_string('px01', 'theme_campus'),
'2px' => new lang_string('px02', 'theme_campus'),
'3px' => new lang_string('px03', 'theme_campus'),
'4px' => new lang_string('px04', 'theme_campus'),
'5px' => new lang_string('px05', 'theme_campus'),
'6px' => new lang_string('px06', 'theme_campus'),
'7px' => new lang_string('px07', 'theme_campus'),
'8px' => new lang_string('px08', 'theme_campus'),
'9px' => new lang_string('px09', 'theme_campus'),
'10px' => new lang_string('px10', 'theme_campus'),
'11px' => new lang_string('px11', 'theme_campus'),
'12px' => new lang_string('px12', 'theme_campus'),
'13px' => new lang_string('px13', 'theme_campus'),
'14px' => new lang_string('px14', 'theme_campus'),
'15px' => new lang_string('px15', 'theme_campus'),
'16px' => new lang_string('px16', 'theme_campus'),
'17px' => new lang_string('px17', 'theme_campus'),
'18px' => new lang_string('px18', 'theme_campus'),
'19px' => new lang_string('px19', 'theme_campus'),
'20px' => new lang_string('px20', 'theme_campus'),
'21px' => new lang_string('px21', 'theme_campus'),
'22px' => new lang_string('px22', 'theme_campus'),
'23px' => new lang_string('px23', 'theme_campus'),
'24px' => new lang_string('px24', 'theme_campus'),
'25px' => new lang_string('px25', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Medium border radius.
$name = 'theme_campus/borderradiusmedium';
$title = get_string('borderradiusmedium', 'theme_campus');
$description = get_string('borderradiusmedium_desc', 'theme_campus');
$default = '6px';
$choices = [
'0px' => new lang_string('px00', 'theme_campus'),
'1px' => new lang_string('px01', 'theme_campus'),
'2px' => new lang_string('px02', 'theme_campus'),
'3px' => new lang_string('px03', 'theme_campus'),
'4px' => new lang_string('px04', 'theme_campus'),
'5px' => new lang_string('px05', 'theme_campus'),
'6px' => new lang_string('px06', 'theme_campus'),
'7px' => new lang_string('px07', 'theme_campus'),
'8px' => new lang_string('px08', 'theme_campus'),
'9px' => new lang_string('px09', 'theme_campus'),
'10px' => new lang_string('px10', 'theme_campus'),
'11px' => new lang_string('px11', 'theme_campus'),
'12px' => new lang_string('px12', 'theme_campus'),
'13px' => new lang_string('px13', 'theme_campus'),
'14px' => new lang_string('px14', 'theme_campus'),
'15px' => new lang_string('px15', 'theme_campus'),
'16px' => new lang_string('px16', 'theme_campus'),
'17px' => new lang_string('px17', 'theme_campus'),
'18px' => new lang_string('px18', 'theme_campus'),
'19px' => new lang_string('px19', 'theme_campus'),
'20px' => new lang_string('px20', 'theme_campus'),
'21px' => new lang_string('px21', 'theme_campus'),
'22px' => new lang_string('px22', 'theme_campus'),
'23px' => new lang_string('px23', 'theme_campus'),
'24px' => new lang_string('px24', 'theme_campus'),
'25px' => new lang_string('px25', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Large border radius.
$name = 'theme_campus/borderradiuslarge';
$title = get_string('borderradiuslarge', 'theme_campus');
$description = get_string('borderradiuslarge_desc', 'theme_campus');
$default = '8px';
$choices = [
'0px' => new lang_string('px00', 'theme_campus'),
'1px' => new lang_string('px01', 'theme_campus'),
'2px' => new lang_string('px02', 'theme_campus'),
'3px' => new lang_string('px03', 'theme_campus'),
'4px' => new lang_string('px04', 'theme_campus'),
'5px' => new lang_string('px05', 'theme_campus'),
'6px' => new lang_string('px06', 'theme_campus'),
'7px' => new lang_string('px07', 'theme_campus'),
'8px' => new lang_string('px08', 'theme_campus'),
'9px' => new lang_string('px09', 'theme_campus'),
'10px' => new lang_string('px10', 'theme_campus'),
'11px' => new lang_string('px11', 'theme_campus'),
'12px' => new lang_string('px12', 'theme_campus'),
'13px' => new lang_string('px13', 'theme_campus'),
'14px' => new lang_string('px14', 'theme_campus'),
'15px' => new lang_string('px15', 'theme_campus'),
'16px' => new lang_string('px16', 'theme_campus'),
'17px' => new lang_string('px17', 'theme_campus'),
'18px' => new lang_string('px18', 'theme_campus'),
'19px' => new lang_string('px19', 'theme_campus'),
'20px' => new lang_string('px20', 'theme_campus'),
'21px' => new lang_string('px21', 'theme_campus'),
'22px' => new lang_string('px22', 'theme_campus'),
'23px' => new lang_string('px23', 'theme_campus'),
'24px' => new lang_string('px24', 'theme_campus'),
'25px' => new lang_string('px25', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Must add the page after defining all the settings!
$settings->add($settingpage);
// Header settings.
$settingpage = new admin_settingpage('theme_campus_header', get_string('headersettings', 'theme_campus'));
$settingpage->add(new admin_setting_heading(
'theme_campus_headerheading',
null,
format_text(get_string('headerheadingdesc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Invert Navbar to dark background.
$name = 'theme_campus/invert';
$title = get_string('invert', 'theme_campus');
$description = get_string('invertdesc', 'theme_campus');
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Navbar type.
$name = 'theme_campus/navbartype';
$title = get_string('navbartype', 'theme_campus');
$description = get_string('navbartypedesc', 'theme_campus');
$default = 1;
$choices = [
1 => new lang_string('standardnavbar', 'theme_campus'),
2 => new lang_string('fancynavbar', 'theme_campus'),
];
// No CSS change, so no need to reset caches.
$settingpage->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Page heading range.
$name = 'theme_campus/navbarpageheadingmax';
$title = get_string('navbarpageheadingmax', 'theme_campus');
$default = 200;
$lower = 40;
$upper = 400;
$description = get_string('navbarpageheadingmaxdesc', 'theme_campus', ['lower' => $lower, 'upper' => $upper]);
$setting = new admin_setting_configinteger($name, $title, $description, $default, $lower, $upper);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Course and category page heading position setting.
$name = 'theme_campus/coursepagepageheadinglocation';
$title = get_string('coursepagepageheadinglocation', 'theme_campus');
$description = get_string('coursepagepageheadinglocationdesc', 'theme_campus');
$default = 1;
$choices = [
1 => new lang_string('pageheadinglocationnavbar', 'theme_campus'),
3 => new lang_string('pageheadinglocationpagecontenttop', 'theme_campus'),
4 => new lang_string('pageheadinglocationheaderarea', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$settingpage->add($setting);
// Show system area name in the breadcrumb.
$name = 'theme_campus/showsysteminbreadcrumb';
$title = get_string('showsysteminbreadcrumb', 'theme_campus');
$description = get_string('showsysteminbreadcrumbdesc', 'theme_campus');
$default = true;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Show section name in the breadcrumb.
$name = 'theme_campus/showsectioninbreadcrumb';
$title = get_string('showsectioninbreadcrumb', 'theme_campus');
$description = get_string('showsectioninbreadcrumbdesc', 'theme_campus');
$default = true;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Settings title for grouping course settings related aspects together.
$name = 'theme_campus/coursesettingsheading';
$title = get_string('coursesettingsheadingsetting', 'theme_campus');
$setting = new admin_setting_heading($name, $title, null);
$settingpage->add($setting);
// Setting to display the course settings page as a panel within the course.
$name = 'theme_campus/showsettingsincourse';
$title = get_string('showsettingsincoursesetting', 'theme_campus');
$description = get_string('showsettingsincoursesetting_desc', 'theme_campus');
$setting = new admin_setting_configcheckbox($name, $title, $description, 'no', 'yes', 'no'); // Overriding default values.
/* yes = 1 and no = 0 because of the use of empty() in theme_boost_campus_get_pre_scss() (lib.php).
Default 0 value would not write the variable to scss that could cause the scss to crash if used in that file.
See MDL-58376.*/
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Setting to display the switch role to link as a separate tab within the in-course settings panel.
$name = 'theme_campus/incoursesettingsswitchtoroleposition';
$title = get_string('incoursesettingsswitchtorolepositionsetting', 'theme_campus');
$description = get_string('incoursesettingsswitchtorolepositionsetting_desc', 'theme_campus');
$incoursesettingsswitchtorolesetting = [
'no' => get_string('incoursesettingsswitchtorolesettingjustmenu', 'theme_campus'),
'yes' => get_string('incoursesettingsswitchtorolesettingjustcourse', 'theme_campus'),
'both' => get_string('incoursesettingsswitchtorolesettingboth', 'theme_campus'),
];
$setting = new admin_setting_configselect(
$name,
$title,
$description,
$incoursesettingsswitchtorolesetting['no'],
$incoursesettingsswitchtorolesetting
);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
$settingpage->hide_if(
'theme_campus/incoursesettingsswitchtoroleposition',
'theme_campus/showsettingsincourse',
'notchecked'
);
// Frontpage header settings.
$settingpage->add(new admin_setting_heading(
'theme_campus_frontpage',
get_string('frontpageheadersettings', 'theme_campus'),
format_text(get_string('frontpageheadersettings_desc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Have a custom front page header.
$name = 'theme_campus/usefrontpageheader';
$title = get_string('usefrontpageheader', 'theme_campus');
$description = get_string('usefrontpageheaderdesc', 'theme_campus');
$setting = new admin_setting_configcheckbox($name, $title, $description, 1);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Frontpage layout setting.
$name = 'theme_campus/frontpagelayout';
$title = get_string('frontpagelayout', 'theme_campus');
$description = get_string('frontpagelayoutdesc', 'theme_campus');
$default = 'flexlayout';
$choices = [
'absolutelayout' => new lang_string('layoutontop', 'theme_campus'),
'flexlayout' => new lang_string('layoutonside', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo file setting.
$name = 'theme_campus/frontpagelogo';
$title = get_string('frontpagelogo', 'theme_campus');
$description = get_string('frontpagelogodesc', 'theme_campus', ['pagewidthmax' => $currentpagewidthmaxheaders]);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpagelogo');
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo file setting on small devices.
$name = 'theme_campus/frontpageresponsivelogo';
$title = get_string('frontpageresponsivelogo', 'theme_campus');
$description = get_string('frontpageresponsivelogodesc', 'theme_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpageresponsivelogo');
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo position setting.
$name = 'theme_campus/frontpagelogoposition';
$title = get_string('frontpagelogoposition', 'theme_campus');
$description = get_string('frontpagelogopositiondesc', 'theme_campus');
$default = 2;
$choices = [
1 => new lang_string('imageleft', 'theme_campus'),
2 => new lang_string('imageright', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Background image file setting.
$name = 'theme_campus/frontpagebackgroundimage';
$title = get_string('frontpagebackgroundimage', 'theme_campus');
$description = get_string(
'frontpagebackgroundimagedesc',
'theme_campus',
['pagewidthmax' => $currentpagewidthmaxheaders]
);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpagebackgroundimage');
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Background image file setting on small devices.
$name = 'theme_campus/frontpageresponsivebackgroundimage';
$title = get_string('frontpageresponsivebackgroundimage', 'theme_campus');
$description = get_string('frontpageresponsivebackgroundimagedesc', 'theme_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'frontpageresponsivebackgroundimage');
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Frontpage heading position setting.
$name = 'theme_campus/frontpagepageheadinglocation';
$title = get_string('frontpagepageheadinglocation', 'theme_campus');
$description = get_string('frontpagepageheadinglocationdesc', 'theme_campus');
$default = 1;
$choices = [
1 => new lang_string('pageheadinglocationnavbar', 'theme_campus'),
2 => new lang_string('pageheadinglocationunderneathnavbar', 'theme_campus'),
3 => new lang_string('pageheadinglocationpagecontenttop', 'theme_campus'),
4 => new lang_string('pageheadinglocationheaderarea', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$settingpage->add($setting);
$settingpage->add(new admin_setting_heading(
'theme_campus_coursecategory',
get_string('coursecategoryhavecustomheaderheader', 'theme_campus'),
format_text(get_string('coursecategoryhavecustomheaderheader_desc', 'theme_campus'), FORMAT_MARKDOWN)
));
if (file_exists("{$CFG->dirroot}/theme/campus/campus-lib.php")) {
include_once($CFG->dirroot . '/theme/campus/campus-lib.php');
} else if (!empty($CFG->themedir) && file_exists("{$CFG->themedir}/campus/campus-lib.php")) {
include_once($CFG->themedir . '/campus/campus-lib.php');
}
$campuscategorytree = theme_campus_get_top_level_categories();
foreach ($campuscategorytree as $key => $value) {
// Have a custom header for the course category.
$name = 'theme_campus/coursecategoryhavecustomheader' . $key;
$title = get_string('coursecategoryhavecustomheader', 'theme_campus', ['categoryname' => $value]);
$description = get_string('coursecategoryhavecustomheaderdesc', 'theme_campus', ['categoryname' => $value]);
$setting = new admin_setting_configcheckbox($name, $title, $description, 0);
$setting->set_updatedcallback('theme_reset_all_caches'); // CSS change to generate extra selectors if turning on for a new category for the first time.
$settingpage->add($setting);
}
// Must add the page after defining all the settings!
$settings->add($settingpage);
// Course category header settings.
$settingpage = new admin_settingpage(
'theme_campus_category_header',
get_string('coursecategoryheadersettings', 'theme_campus')
);
$settingpage->add(new admin_setting_heading(
'theme_campus_category_header_heading',
null,
format_text(get_string('coursecategoryheadersettings_desc', 'theme_campus'), FORMAT_MARKDOWN)
));
$havecategories = false;
foreach ($campuscategorytree as $key => $value) {
$havecustomheader = get_config('theme_campus', 'coursecategoryhavecustomheader' . $key);
if (empty($havecustomheader)) {
continue;
}
$havecategories = true;
$name = 'theme_campus/coursecategoryheading' . $key;
$heading = get_string('coursecategoryheading', 'theme_campus', ['categoryname' => $value]);
$information = '';
$setting = new admin_setting_heading($name, $heading, $information);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Background colour.
$name = 'theme_campus/coursecategorybgcolour' . $key;
$title = get_string('coursecategorybgcolour', 'theme_campus');
$description = get_string('coursecategorybgcolourdesc', 'theme_campus', ['categoryname' => $value]);
$default = '#11847D';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Course category layout setting.
$name = 'theme_campus/coursecategorylayout' . $key;
$title = get_string('coursecategorylayout', 'theme_campus');
$description = get_string('coursecategorylayoutdesc', 'theme_campus');
$default = 'flexlayout';
$choices = [
'absolutelayout' => new lang_string('layoutontop', 'theme_campus'),
'flexlayout' => new lang_string('layoutonside', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo file setting.
$name = 'theme_campus/coursecategorylogo' . $key;
$title = get_string('coursecategorylogo', 'theme_campus');
$description = get_string(
'coursecategorylogodesc',
'theme_campus',
['pagewidthmax' => $currentpagewidthmaxheaders]
);
$setting = new admin_setting_configstoredfile($name, $title, $description, 'coursecategorylogo' . $key);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo file setting on small devices.
$name = 'theme_campus/coursecategoryresponsivelogo' . $key;
$title = get_string('coursecategoryresponsivelogo', 'theme_campus');
$description = get_string('coursecategoryresponsivelogodesc', 'theme_campus');
$setting = new admin_setting_configstoredfile($name, $title, $description, 'coursecategoryresponsivelogo' . $key);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Logo position setting.
$name = 'theme_campus/coursecategorylogoposition' . $key;
$title = get_string('coursecategorylogoposition', 'theme_campus');
$description = get_string('coursecategorylogopositiondesc', 'theme_campus');
$default = 2;
$choices = [
1 => new lang_string('imageleft', 'theme_campus'),
2 => new lang_string('imageright', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Background image file setting.
$name = 'theme_campus/coursecategorybackgroundimage' . $key;
$title = get_string('coursecategorybackgroundimage', 'theme_campus');
$description = get_string(
'coursecategorybackgroundimagedesc',
'theme_campus',
['pagewidthmax' => $currentpagewidthmaxheaders]
);
$setting = new admin_setting_configstoredfile(
$name,
$title,
$description,
'coursecategorybackgroundimage' . $key
);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Background image file setting on small devices.
$name = 'theme_campus/coursecategoryresponsivebackgroundimage' . $key;
$title = get_string('coursecategoryresponsivebackgroundimage', 'theme_campus');
$description = get_string('coursecategoryresponsivebackgroundimagedesc', 'theme_campus');
$setting = new admin_setting_configstoredfile(
$name,
$title,
$description,
'coursecategoryresponsivebackgroundimage' . $key
);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
}
if ($havecategories == false) {
$settingpage->add(new admin_setting_heading(
'theme_campus_category_header_none_heading',
null,
format_text(get_string('coursecategoryhavecustomheadernone', 'theme_campus'), FORMAT_MARKDOWN)
));
}
// Must add the page after defining all the settings!
$settings->add($settingpage);
// Footer settings.
$settingpage = new admin_settingpage('theme_campus_footer', get_string('footersettings', 'theme_campus'));
$settingpage->add(new admin_setting_heading(
'theme_campus_footerheading',
null,
format_text(get_string('footerheadingdesc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Number of footer blocks.
$name = 'theme_campus/numfooterblocks';
$title = get_string('numfooterblocks', 'theme_campus');
$description = get_string('numfooterblocksdesc', 'theme_campus');
$choices = [
1 => new lang_string('one', 'theme_campus'),
2 => new lang_string('two', 'theme_campus'),
3 => new lang_string('three', 'theme_campus'),
4 => new lang_string('four', 'theme_campus'),
];
$default = 2;
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Footnote setting.
$name = 'theme_campus/footnote';
$title = get_string('footnote', 'theme_campus');
$description = get_string('footnotedesc', 'theme_campus');
$default = '';
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Must add the page after defining all the settings!
$settings->add($settingpage);
// Carousel settings.
$settingpage = new admin_settingpage('theme_campus_carousel', get_string('carouselsettings', 'theme_campus'));
$settingpage->add(new admin_setting_heading(
'theme_campus_carouselheading',
null,
format_text(get_string('carouselsettingsdesc', 'theme_campus'), FORMAT_MARKDOWN)
));
// Slider position setting.
$name = 'theme_campus/sliderposition';
$title = get_string('sliderposition', 'theme_campus');
$description = get_string('sliderpositiondesc', 'theme_campus');
$default = 1;
$choices = [
1 => new lang_string('sliderpositionheader', 'theme_campus'),
2 => new lang_string('sliderpositionpage', 'theme_campus'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Autoplay.
$name = 'theme_campus/carouselautoplay';
$title = get_string('carouselautoplay', 'theme_campus');
$description = get_string('carouselautoplaydesc', 'theme_campus');
$default = 2;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Slide interval.
$name = 'theme_campus/slideinterval';
$title = get_string('slideinterval', 'theme_campus');
$default = 5000;
$lower = 1000;
$upper = 100000;
$description = get_string('slideintervaldesc', 'theme_campus', ['lower' => $lower, 'upper' => $upper]);
$setting = new admin_setting_configinteger($name, $title, $description, $default, $lower, $upper);
// No CSS change, so no need to reset caches.
$settingpage->add($setting);
// Carousel text colour setting.
$name = 'theme_campus/carouseltextcolour';
$title = get_string('carouseltextcolour', 'theme_campus');
$description = get_string('carouseltextcolourdesc', 'theme_campus');
$default = '#ffffff';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Show caption centred.
$name = 'theme_campus/slidecaptioncentred';
$title = get_string('slidecaptioncentred', 'theme_campus');
$description = get_string('slidecaptioncentreddesc', 'theme_campus');
$default = false;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Slide button colour setting.
$name = 'theme_campus/slidebuttoncolour';
$title = get_string('slidebuttoncolour', 'theme_campus');
$description = get_string('slidebuttoncolourdesc', 'theme_campus');
$default = '#3a53c1';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Slide button hover colour setting.
$name = 'theme_campus/slidebuttonhovercolour';
$title = get_string('slidebuttonhovercolour', 'theme_campus');
$description = get_string('slidebuttonhovercolourdesc', 'theme_campus');
$default = '#4f72ff';
$previewconfig = null;
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig);
$setting->set_updatedcallback('theme_reset_all_caches');
$settingpage->add($setting);
// Must add the page after defining all the settings!