-
Notifications
You must be signed in to change notification settings - Fork 60
/
settings.php
689 lines (632 loc) · 34.1 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
<?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/>.
/**
* Collapsed Topics Information
*
* A topic based format that solves the issue of the 'Scroll of Death' when a course has many topics. All topics
* except zero have a toggle that displays that topic. One or more topics can be displayed at any given time.
* Toggles are persistent on a per browser session per course basis but can be made to persist longer by a small
* code change. Full installation instructions, code adaptions and credits are included in the 'Readme.txt' file.
*
* @package format_topcoll
* @copyright © 2012-onwards G J Barnard in respect to modifications of standard topics format.
* @author G J Barnard - {@link https://moodle.org/user/profile.php?id=442195}
* @link https://docs.moodle.org/en/Collapsed_Topics_course_format
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$settings = null;
$ADMIN->add('formatsettings', new admin_category('format_topcoll', get_string('pluginname', 'format_topcoll')));
// Information.
$page = new admin_settingpage(
'format_topcoll_information',
get_string('information', 'format_topcoll')
);
if ($ADMIN->fulltree) {
$page->add(new admin_setting_heading(
'format_topcoll_information',
'',
format_text(get_string('informationsettingsdesc', 'format_topcoll'), FORMAT_MARKDOWN)
));
// Information.
$page->add(new \format_topcoll\admin_setting_information('format_topcoll/formatinformation', '', '', 403));
// Support.md.
$page->add(new \format_topcoll\admin_setting_markdown('format_topcoll/formatsupport', '', '', 'Support.md'));
// Changes.md.
$page->add(new \format_topcoll\admin_setting_markdown(
'format_topcoll/formatchanges',
get_string('informationchanges', 'format_topcoll'),
'',
'Changes.md'
));
}
$ADMIN->add('format_topcoll', $page);
// Settings.
$page = new admin_settingpage(
'format_topcoll_settings',
get_string('settings', 'format_topcoll')
);
if ($ADMIN->fulltree) {
$page->add(new admin_setting_heading(
'format_topcoll_defaults',
get_string('defaultheadingsub', 'format_topcoll'),
format_text(get_string('defaultheadingsubdesc', 'format_topcoll'), FORMAT_MARKDOWN)
));
/* Toggle instructions - 1 = no, 2 = yes. */
$name = 'format_topcoll/defaultdisplayinstructions';
$title = get_string('defaultdisplayinstructions', 'format_topcoll');
$description = get_string('defaultdisplayinstructions_desc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Toggle display block choices */
$name = 'format_topcoll/defaultdisplayblocks';
$title = get_string('defaultdisplayblocks', 'format_topcoll');
$description = get_string('defaultdisplayblocks_desc', 'format_topcoll');
$choices = core_plugin_manager::instance()->get_enabled_plugins('block');
// Change the value of the array to have the real string defined in the language file.
foreach ($choices as $key => $blockname) {
$choices[$key] = get_string('pluginname', 'block_' . $key);
}
/* See if our desired default blocks '$defaultsearchlist' are in the list of available
blocks '$choices' created above, and if so - add each of them to the '$default' array for use. */
$default = [];
$defaultsearchlist = ['search_forums', 'news_items', 'calendar_upcoming', 'recent_activity'];
foreach ($defaultsearchlist as $defaultblk) {
if (array_key_exists($defaultblk, $choices)) {
array_push($default, $defaultblk);
}
}
$page->add(new admin_setting_configmultiselect($name, $title, $description, $default, $choices));
// Toggle blocks location. 1 = pre, 2 = post.
$name = 'format_topcoll/defaultdisplayblocksloc';
$title = get_string('defaultdisplayblocksloc', 'format_topcoll');
$description = get_string('defaultdisplayblocksloc_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('sidepre', 'format_topcoll'), // Pre.
2 => new lang_string('sidepost', 'format_topcoll'), // Post.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Layout configuration.
Here you can see what numbers in the array represent what layout for setting the default value below.
1 => Toggle word, toggle section x and section number - default.
2 => Toggle word and section number.
3 => Toggle word and toggle section x.
4 => Toggle word.
5 => Toggle section x and section number.
6 => Section number.
7 => No additions.
8 => Toggle section x.
Default layout to use - used when a new Collapsed Topics course is created or an old one is accessed for the first time
after installing this functionality introduced in CONTRIB-3378. */
$name = 'format_topcoll/defaultlayoutelement';
$title = get_string('defaultlayoutelement', 'format_topcoll');
$description = get_string('defaultlayoutelement_descpositive', 'format_topcoll');
$default = 1;
$choices = [// In insertion order and not numeric for sorting purposes.
1 => new lang_string('setlayout_all', 'format_topcoll'), // Toggle word, toggle section x and section number - default.
3 => new lang_string('setlayout_toggle_word_section_x', 'format_topcoll'), // Toggle word and toggle section x.
2 => new lang_string('setlayout_toggle_word_section_number', 'format_topcoll'), // Toggle word and section number.
5 => new lang_string('setlayout_toggle_section_x_section_number', 'format_topcoll'), // Toggle section x and section number.
4 => new lang_string('setlayout_toggle_word', 'format_topcoll'), // Toggle word.
8 => new lang_string('setlayout_toggle_section_x', 'format_topcoll'), // Toggle section x.
6 => new lang_string('setlayout_section_number', 'format_topcoll'), // Section number.
7 => new lang_string('setlayout_no_additions', 'format_topcoll'), // No additions.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Structure configuration.
Here so you can see what numbers in the array represent what structure for setting the default value below.
1 => Topic.
2 => Week.
3 => Latest Week First.
4 => Current Topic First.
5 => Day.
Default structure to use - used when a new Collapsed Topics course is created or an old one is accessed for the first time
after installing this functionality introduced in CONTRIB-3378. */
$name = 'format_topcoll/defaultlayoutstructure';
$title = get_string('defaultlayoutstructure', 'format_topcoll');
$description = get_string('defaultlayoutstructure_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('setlayoutstructuretopic', 'format_topcoll'), // Topic.
2 => new lang_string('setlayoutstructureweek', 'format_topcoll'), // Week.
3 => new lang_string('setlayoutstructurelatweekfirst', 'format_topcoll'), // Latest Week First.
4 => new lang_string('setlayoutstructurecurrenttopicfirst', 'format_topcoll'), // Current Topic First.
5 => new lang_string('setlayoutstructureday', 'format_topcoll'), // Day.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Default column orientation - 1 = vertical and 2 = horizontal.
$name = 'format_topcoll/defaultlayoutcolumnorientation';
$title = get_string('defaultlayoutcolumnorientation', 'format_topcoll');
$description = get_string('defaultlayoutcolumnorientation_desc', 'format_topcoll');
$default = 3;
$choices = [
3 => new lang_string('columndynamic', 'format_topcoll'),
2 => new lang_string('columnhorizontal', 'format_topcoll'),
1 => new lang_string('columnvertical', 'format_topcoll'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Default number of columns between 1 and 4.
$name = 'format_topcoll/defaultlayoutcolumns';
$title = get_string('defaultlayoutcolumns', 'format_topcoll');
$description = get_string('defaultlayoutcolumns_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('one', 'format_topcoll'), // Default.
2 => new lang_string('two', 'format_topcoll'), // Two.
3 => new lang_string('three', 'format_topcoll'), // Three.
4 => new lang_string('four', 'format_topcoll'), // Four.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Flexible modules - 1 = no, 2 = yes. */
$name = 'format_topcoll/defaultflexiblemodules';
$title = get_string('defaultflexiblemodules', 'format_topcoll');
$description = get_string('defaultflexiblemodules_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Toggle all enabled - 1 = no, 2 = yes. */
$name = 'format_topcoll/defaulttoggleallenabled';
$title = get_string('defaulttoggleallenabled', 'format_topcoll');
$description = get_string('defaulttoggleallenabled_desc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* View single section enabled - 1 = no, 2 = yes. */
$name = 'format_topcoll/defaultviewsinglesectionenabled';
$title = get_string('defaultviewsinglesectionenabled', 'format_topcoll');
$description = get_string('defaultviewsinglesectionenabled_desc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle text alignment.
// 1 = left, 2 = center and 3 = right - done this way to avoid typos.
$name = 'format_topcoll/defaulttogglealignment';
$title = get_string('defaulttogglealignment', 'format_topcoll');
$description = get_string('defaulttogglealignment_desc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('left', 'format_topcoll'), // Left.
2 => new lang_string('center', 'format_topcoll'), // Centre.
3 => new lang_string('right', 'format_topcoll'), // Right.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle icon position.
// 1 = left and 2 = right - done this way to avoid typos.
$name = 'format_topcoll/defaulttoggleiconposition';
$title = get_string('defaulttoggleiconposition', 'format_topcoll');
$description = get_string('defaulttoggleiconposition_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('left', 'format_topcoll'), // Left.
2 => new lang_string('right', 'format_topcoll'), // Right.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Toggle icon set.
arrow => Arrow icon set.
bulb => Bulb icon set.
cloud => Cloud icon set.
eye => Eye icon set.
folder => Folder icon set.
groundsignal => Ground signal set.
led => LED icon set.
point => Point icon set.
power => Power icon set.
radio => Radio icon set.
smiley => Smiley icon set.
square => Square icon set.
sunmoon => Sun / Moon icon set.
switch => Switch icon set.
tif => Icon font.
*/
$iconseticons = [
'arrow' => $OUTPUT->pix_icon('arrow_right', get_string('arrow', 'format_topcoll'), 'format_topcoll'),
'bulb' => $OUTPUT->pix_icon('bulb_off', get_string('bulb', 'format_topcoll'), 'format_topcoll'),
'cloud' => $OUTPUT->pix_icon('cloud_off', get_string('cloud', 'format_topcoll'), 'format_topcoll'),
'eye' => $OUTPUT->pix_icon('eye_show', get_string('eye', 'format_topcoll'), 'format_topcoll'),
'folder' => $OUTPUT->pix_icon('folder_closed', get_string('folder', 'format_topcoll'), 'format_topcoll'),
'groundsignal' => $OUTPUT->pix_icon('ground_signal_off', get_string('groundsignal', 'format_topcoll'), 'format_topcoll'),
'led' => $OUTPUT->pix_icon('led_on', get_string('led', 'format_topcoll'), 'format_topcoll'),
'point' => $OUTPUT->pix_icon('point_right', get_string('point', 'format_topcoll'), 'format_topcoll'),
'power' => $OUTPUT->pix_icon('toggle_plus', get_string('power', 'format_topcoll'), 'format_topcoll'),
'radio' => $OUTPUT->pix_icon('radio_on', get_string('radio', 'format_topcoll'), 'format_topcoll'),
'smiley' => $OUTPUT->pix_icon('smiley_on', get_string('smiley', 'format_topcoll'), 'format_topcoll'),
'square' => $OUTPUT->pix_icon('square_on', get_string('square', 'format_topcoll'), 'format_topcoll'),
'sunmoon' => $OUTPUT->pix_icon('sunmoon_on', get_string('sunmoon', 'format_topcoll'), 'format_topcoll'),
'switch' => $OUTPUT->pix_icon('switch_on', get_string('switch', 'format_topcoll'), 'format_topcoll'),
'tif' => $OUTPUT->pix_icon('iconfont', get_string('tif', 'format_topcoll'), 'format_topcoll'),
];
$name = 'format_topcoll/defaulttoggleiconset';
$title = get_string('defaulttoggleiconset', 'format_topcoll');
$description = get_string('defaulttoggleiconset_desc', 'format_topcoll', $iconseticons);
$default = 'tif';
$choices = [
'arrow' => new lang_string('arrow', 'format_topcoll'), // Arrow icon set.
'bulb' => new lang_string('bulb', 'format_topcoll'), // Bulb icon set.
'cloud' => new lang_string('cloud', 'format_topcoll'), // Cloud icon set.
'eye' => new lang_string('eye', 'format_topcoll'), // Eye icon set.
'folder' => new lang_string('folder', 'format_topcoll'), // Folder icon set.
'groundsignal' => new lang_string('groundsignal', 'format_topcoll'), // Ground signal set.
'led' => new lang_string('led', 'format_topcoll'), // LED icon set.
'point' => new lang_string('point', 'format_topcoll'), // Point icon set.
'power' => new lang_string('power', 'format_topcoll'), // Power icon set.
'radio' => new lang_string('radio', 'format_topcoll'), // Radio icon set.
'smiley' => new lang_string('smiley', 'format_topcoll'), // Smiley icon set.
'square' => new lang_string('square', 'format_topcoll'), // Square icon set.
'sunmoon' => new lang_string('sunmoon', 'format_topcoll'), // Sun / Moon icon set.
'switch' => new lang_string('switch', 'format_topcoll'), // Switch icon set.
'tif' => new lang_string('tif', 'format_topcoll'), // Toggle icon font.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/defaulttoggleiconfontclosed';
$title = get_string('defaulttoggleiconfontclosed', 'format_topcoll');
$description = get_string('defaulttoggleiconfontclosed_desc', 'format_topcoll');
$default = 'fa fa-chevron-circle-right';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);
$page->add($setting);
$name = 'format_topcoll/defaulttoggleiconfontopen';
$title = get_string('defaulttoggleiconfontopen', 'format_topcoll');
$description = get_string('defaulttoggleiconfontopen_desc', 'format_topcoll');
$default = 'fa fa-chevron-circle-down';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);
$page->add($setting);
/* One section - 1 = no, 2 = yes. */
$name = 'format_topcoll/defaultonesection';
$title = get_string('defaultonesection', 'format_topcoll');
$description = get_string('defaultonesection_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('no'), // No.
2 => new lang_string('yes'), // Yes.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* One section icon font */
$name = 'format_topcoll/defaultonesectioniconfont';
$title = get_string('defaultonesectioniconfont', 'format_topcoll');
$description = get_string('defaultonesectioniconfont_desc', 'format_topcoll');
$default = 'fa fa-dot-circle-o';
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_TEXT);
$page->add($setting);
/* Toggle all icon hovers.
1 => No.
2 => Yes. */
$name = 'format_topcoll/defaulttoggleallhover';
$title = get_string('defaulttoggleallhover', 'format_topcoll');
$description = get_string('defaulttoggleallhover_desc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$opacityvalues = [
'0.0' => '0.0',
'0.1' => '0.1',
'0.2' => '0.2',
'0.3' => '0.3',
'0.4' => '0.4',
'0.5' => '0.5',
'0.6' => '0.6',
'0.7' => '0.7',
'0.8' => '0.8',
'0.9' => '0.9',
'1.0' => '1.0',
];
// Default toggle foreground colour in hexadecimal RGB with preceding '#'.
$name = 'format_topcoll/defaulttoggleforegroundcolour';
$title = get_string('defaulttgfgcolour', 'format_topcoll');
$description = get_string('defaulttgfgcolour_desc', 'format_topcoll');
$default = '#eeeeee';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$page->add($setting);
// Default toggle foreground opacity between 0 and 1 in 0.1 increments.
$name = 'format_topcoll/defaulttoggleforegroundopacity';
$title = get_string('defaulttgfgopacity', 'format_topcoll');
$description = get_string('defaulttgfgopacity_desc', 'format_topcoll');
$default = '1.0';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $opacityvalues));
// Default toggle foreground hover colour in hexadecimal RGB with preceding '#'.
$name = 'format_topcoll/defaulttoggleforegroundhovercolour';
$title = get_string('defaulttgfghvrcolour', 'format_topcoll');
$description = get_string('defaulttgfghvrcolour_desc', 'format_topcoll');
$default = '#ffffff';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$page->add($setting);
// Default toggle foreground hover opacity between 0 and 1 in 0.1 increments.
$name = 'format_topcoll/defaulttoggleforegroundhoveropacity';
$title = get_string('defaulttgfghvropacity', 'format_topcoll');
$description = get_string('defaulttgfghvropacity_desc', 'format_topcoll');
$default = '1.0';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $opacityvalues));
// Default toggle background colour in hexadecimal RGB with preceding '#'.
$name = 'format_topcoll/defaulttogglebackgroundcolour';
$title = get_string('defaulttgbgcolour', 'format_topcoll');
$description = get_string('defaulttgbgcolour_desc', 'format_topcoll');
$default = '#1177d1';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$page->add($setting);
// Default toggle background opacity between 0 and 1 in 0.1 increments.
$name = 'format_topcoll/defaulttogglebackgroundopacity';
$title = get_string('defaulttgbgopacity', 'format_topcoll');
$description = get_string('defaulttgbgopacity_desc', 'format_topcoll');
$default = '1.0';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $opacityvalues));
// Default toggle background hover colour in hexadecimal RGB with preceding '#'.
$name = 'format_topcoll/defaulttogglebackgroundhovercolour';
$title = get_string('defaulttgbghvrcolour', 'format_topcoll');
$description = get_string('defaulttgbghvrcolour_desc', 'format_topcoll');
$default = '#1482E2';
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default);
$page->add($setting);
// Default toggle background hover opacity between 0 and 1 in 0.1 increments.
$name = 'format_topcoll/defaulttogglebackgroundhoveropacity';
$title = get_string('defaulttgbghvropacity', 'format_topcoll');
$description = get_string('defaulttgbghvropacity_desc', 'format_topcoll');
$default = '1.0';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $opacityvalues));
/* Show the section summary when collapsed.
1 => No.
2 => Yes. */
$name = 'format_topcoll/defaultshowsectionsummary';
$title = get_string('defaultshowsectionsummary', 'format_topcoll');
$description = get_string('defaultshowsectionsummary_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$page->add(new admin_setting_heading(
'format_topcoll_configuration',
get_string('configurationheadingsub', 'format_topcoll'),
format_text(get_string('configurationheadingsubdesc', 'format_topcoll'), FORMAT_MARKDOWN)
));
/* Toggle persistence - 1 = on, 0 = off. You may wish to disable for an AJAX performance increase.
Note: If turning persistence off remove any rows containing 'topcoll_toggle_x' in the 'name' field
of the 'user_preferences' table in the database. Where the 'x' in 'topcoll_toggle_x' will be
a course id. */
$name = 'format_topcoll/defaulttogglepersistence';
$title = get_string('defaulttogglepersistence', 'format_topcoll');
$description = get_string('defaulttogglepersistence_desc', 'format_topcoll');
$default = 1;
$choices = [
0 => new lang_string('off', 'format_topcoll'), // Off.
1 => new lang_string('on', 'format_topcoll'), // On.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Toggle preference for the first time a user accesses a course.
0 => All closed.
1 => All open. */
$name = 'format_topcoll/defaultuserpreference';
$title = get_string('defaultuserpreference', 'format_topcoll');
$description = get_string('defaultuserpreference_desc', 'format_topcoll');
$default = 0;
$choices = [
0 => new lang_string('topcollclosed', 'format_topcoll'),
1 => new lang_string('topcollopened', 'format_topcoll'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle icon size.
$name = 'format_topcoll/defaulttoggleiconsize';
$title = get_string('defaulttoggleiconsize', 'format_topcoll');
$description = get_string('defaulttoggleiconsize_desc', 'format_topcoll');
$default = 'tc-medium';
$choices = [
'tc-small' => new lang_string('small', 'format_topcoll'),
'tc-medium' => new lang_string('medium', 'format_topcoll'),
'tc-large' => new lang_string('large', 'format_topcoll'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle border radius top left.
$name = 'format_topcoll/defaulttoggleborderradiustl';
$title = get_string('defaulttoggleborderradiustl', 'format_topcoll');
$description = get_string('defaulttoggleborderradiustl_desc', 'format_topcoll');
$default = '0.0';
$choices = [
'0.0' => new lang_string('em0_0', 'format_topcoll'),
'0.1' => new lang_string('em0_1', 'format_topcoll'),
'0.2' => new lang_string('em0_2', 'format_topcoll'),
'0.3' => new lang_string('em0_3', 'format_topcoll'),
'0.4' => new lang_string('em0_4', 'format_topcoll'),
'0.5' => new lang_string('em0_5', 'format_topcoll'),
'0.6' => new lang_string('em0_6', 'format_topcoll'),
'0.7' => new lang_string('em0_7', 'format_topcoll'),
'0.8' => new lang_string('em0_8', 'format_topcoll'),
'0.9' => new lang_string('em0_9', 'format_topcoll'),
'1.0' => new lang_string('em1_0', 'format_topcoll'),
'1.1' => new lang_string('em1_1', 'format_topcoll'),
'1.2' => new lang_string('em1_2', 'format_topcoll'),
'1.3' => new lang_string('em1_3', 'format_topcoll'),
'1.4' => new lang_string('em1_4', 'format_topcoll'),
'1.5' => new lang_string('em1_5', 'format_topcoll'),
'1.6' => new lang_string('em1_6', 'format_topcoll'),
'1.7' => new lang_string('em1_7', 'format_topcoll'),
'1.8' => new lang_string('em1_8', 'format_topcoll'),
'1.9' => new lang_string('em1_9', 'format_topcoll'),
'2.0' => new lang_string('em2_0', 'format_topcoll'),
'2.1' => new lang_string('em2_1', 'format_topcoll'),
'2.2' => new lang_string('em2_2', 'format_topcoll'),
'2.3' => new lang_string('em2_3', 'format_topcoll'),
'2.4' => new lang_string('em2_4', 'format_topcoll'),
'2.5' => new lang_string('em2_5', 'format_topcoll'),
'2.6' => new lang_string('em2_6', 'format_topcoll'),
'2.7' => new lang_string('em2_7', 'format_topcoll'),
'2.8' => new lang_string('em2_8', 'format_topcoll'),
'2.9' => new lang_string('em2_9', 'format_topcoll'),
'3.0' => new lang_string('em3_0', 'format_topcoll'),
'3.1' => new lang_string('em3_1', 'format_topcoll'),
'3.2' => new lang_string('em3_2', 'format_topcoll'),
'3.3' => new lang_string('em3_3', 'format_topcoll'),
'3.4' => new lang_string('em3_4', 'format_topcoll'),
'3.5' => new lang_string('em3_5', 'format_topcoll'),
'3.6' => new lang_string('em3_6', 'format_topcoll'),
'3.7' => new lang_string('em3_7', 'format_topcoll'),
'3.8' => new lang_string('em3_8', 'format_topcoll'),
'3.9' => new lang_string('em3_9', 'format_topcoll'),
'4.0' => new lang_string('em4_0', 'format_topcoll'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle border radius top right.
$name = 'format_topcoll/defaulttoggleborderradiustr';
$title = get_string('defaulttoggleborderradiustr', 'format_topcoll');
$description = get_string('defaulttoggleborderradiustr_desc', 'format_topcoll');
$default = '1.2';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle border radius bottom right.
$name = 'format_topcoll/defaulttoggleborderradiusbr';
$title = get_string('defaulttoggleborderradiusbr', 'format_topcoll');
$description = get_string('defaulttoggleborderradiusbr_desc', 'format_topcoll');
$default = '0.4';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Toggle border radius bottom left.
$name = 'format_topcoll/defaulttoggleborderradiusbl';
$title = get_string('defaulttoggleborderradiusbl', 'format_topcoll');
$description = get_string('defaulttoggleborderradiusbl_desc', 'format_topcoll');
$default = '0.2';
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Format responsive. Turn on to support a non responsive theme theme. */
$name = 'format_topcoll/formatresponsive';
$title = get_string('formatresponsive', 'format_topcoll');
$description = get_string('formatresponsive_desc', 'format_topcoll');
$default = 0;
$choices = [
0 => new lang_string('off', 'format_topcoll'), // Off.
1 => new lang_string('on', 'format_topcoll'), // On.
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
/* Show the section summary when collapsed.
1 => No.
2 => Yes. */
$name = 'format_topcoll/defaultshowsectionsummary';
$title = get_string('defaultshowsectionsummary', 'format_topcoll');
$description = get_string('defaultshowsectionsummary_desc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
// Course Activity Further Information section heading.
$name = 'format_topcoll/coursesectionactivityfurtherinformation';
$heading = get_string('coursesectionactivityfurtherinformation', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformation_desc', 'format_topcoll');
$setting = new admin_setting_heading($name, $heading, $description);
$page->add($setting);
$name = 'format_topcoll/enableadditionalmoddata';
$title = get_string('enableadditionalmoddata', 'format_topcoll');
$description = get_string('enableadditionalmoddatadesc', 'format_topcoll');
$default = 1;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
$setting->set_updatedcallback('cache_helper::purge_all');
$page->add($setting);
$name = 'format_topcoll/courseadditionalmoddatamaxstudents';
$title = get_string('courseadditionalmoddatamaxstudents', 'format_topcoll');
$description = get_string('courseadditionalmoddatamaxstudentsdesc', 'format_topcoll');
$default = 0;
$setting = new admin_setting_configtext($name, $title, $description, $default, PARAM_INT);
$setting->set_updatedcallback('cache_helper::purge_all');
$page->add($setting);
$name = 'format_topcoll/defaultshowadditionalmoddata';
$title = get_string('defaultshowadditionalmoddata', 'format_topcoll');
$description = get_string('defaultshowadditionalmoddatadesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationassign';
$title = get_string('coursesectionactivityfurtherinformationassign', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationassigndesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationquiz';
$title = get_string('coursesectionactivityfurtherinformationquiz', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationquizdesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationchoice';
$title = get_string('coursesectionactivityfurtherinformationchoice', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationchoicedesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationfeedback';
$title = get_string('coursesectionactivityfurtherinformationfeedback', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationfeedbackdesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationforum';
$title = get_string('coursesectionactivityfurtherinformationforum', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationforumdesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationlesson';
$title = get_string('coursesectionactivityfurtherinformationlesson', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationlessondesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
$name = 'format_topcoll/coursesectionactivityfurtherinformationdata';
$title = get_string('coursesectionactivityfurtherinformationdata', 'format_topcoll');
$description = get_string('coursesectionactivityfurtherinformationdatadesc', 'format_topcoll');
$default = 2;
$choices = [
1 => new lang_string('no'),
2 => new lang_string('yes'),
];
$page->add(new admin_setting_configselect($name, $title, $description, $default, $choices));
}
$ADMIN->add('format_topcoll', $page);