forked from juacas/quizaccess_delayed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
117 lines (111 loc) · 3.97 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
<?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/>.
/**
* Implementaton of the quizaccess_delayed plugin.
* Based on quizaccess_activateattempt https://github.com/IITBombayWeb/moodle-quizaccess_delayed/tree/v1.0.3
*
* @package quizaccess_delayed
* @author Juan Pablo de Castro
* @copyright 2020 University of Valladolid, Spain
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined ( 'MOODLE_INTERNAL' ) || die ();
if ($hassiteconfig) {
$settings->add(new admin_setting_configcheckbox(
'quizaccess_delayed/enabled',
new lang_string('quizaccess_delayed_enabled', 'quizaccess_delayed'),
'',
1
));
// Allow disable the rule per instance.
$settings->add(new admin_setting_configcheckbox(
'quizaccess_delayed/allowdisable',
new lang_string('quizaccess_delayed_allowdisable', 'quizaccess_delayed'),
'',
1
));
// Default enabled state in new instances.
$settings->add(new admin_setting_configcheckbox(
'quizaccess_delayed/enabledbydefault',
new lang_string('quizaccess_delayed_enabledbydefault', 'quizaccess_delayed'),
'',
1
));
$vals = [];
foreach( range(1,200) as $val) {
$vals[$val] =$val;
}
$settings->add(new admin_setting_configselect(
'quizaccess_delayed/startrate',
new lang_string('quizaccess_delayed_startrate', 'quizaccess_delayed'),
'',
'25',
$vals
));
$settings->add(new admin_setting_configselect(
'quizaccess_delayed/maxdelay',
new lang_string('quizaccess_delayed_maxdelay', 'quizaccess_delayed'),
'',
'10',
$vals
));
$vals = [0 => get_string('none')];
foreach (range(10, 100, 10) as $val) {
$vals[$val] = "$val %";
}
$settings->add(new admin_setting_configselect(
'quizaccess_delayed/timelimitpercent',
new lang_string('quizaccess_delayed_timelimitpercent', 'quizaccess_delayed'),
'',
'10',
$vals
));
$settings->add(new admin_setting_configselect(
'quizaccess_delayed/countertype',
new lang_string('quizaccess_delayed_countertype', 'quizaccess_delayed'),
'',
'flipdown',
[
'flipdown' => new lang_string('flipdowncounter', 'quizaccess_delayed'),
'text' => new lang_string('plaintextcounter', 'quizaccess_delayed')
]
));
// Show the teacher a warning in some circunstances.
$settings->add(new admin_setting_configcheckbox(
'quizaccess_delayed/showdangerousquiznotice',
new lang_string('quizaccess_delayed_showdangerousquiznotice', 'quizaccess_delayed'),
'',
1
));
$settings->add(new admin_setting_confightmleditor(
'quizaccess_delayed/dangerousquiznotice',
new lang_string('quizaccess_delayed_dangerousquiznotice', 'quizaccess_delayed'),
new lang_string('quizaccess_delayed_dangerousquiznotice_desc', 'quizaccess_delayed'),
'',
PARAM_RAW,
'60',
'8'
));
$settings->add(new admin_setting_confightmleditor(
'quizaccess_delayed/notice',
new lang_string('quizaccess_delayed_notice', 'quizaccess_delayed'),
new lang_string('quizaccess_delayed_notice_desc', 'quizaccess_delayed'),
'',
PARAM_RAW,
'60',
'8'
));
}