-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathsettings.php
More file actions
203 lines (182 loc) · 7.44 KB
/
settings.php
File metadata and controls
203 lines (182 loc) · 7.44 KB
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
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Settings for the qtype_formulas plugin
*
* @package qtype_formulas
* @copyright 2013 Jean-Michel Vedrine
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
$settings->add(new admin_setting_heading(
'qtype_formulas/settings',
new lang_string('settings_heading_general', 'qtype_formulas'),
new lang_string('settings_heading_general_desc', 'qtype_formulas'),
));
// Whether students are allowed to use the comma as decimal separator.
$settings->add(new admin_setting_configcheckbox(
'qtype_formulas/allowdecimalcomma',
new lang_string('settingallowdecimalcomma', 'qtype_formulas'),
new lang_string('settingallowdecimalcomma_desc', 'qtype_formulas'),
0
));
// Whether the tooltip for answer type "Number" should be shown.
$settings->add(new admin_setting_configcheckbox(
'qtype_formulas/shownumbertooltip',
new lang_string('settingshownumbertooltip', 'qtype_formulas'),
new lang_string('settingshownumbertooltip_desc', 'qtype_formulas'),
1
));
// Default delay for the on-the-fly validation's debounce timer.
$settings->add(new admin_setting_configselect(
'qtype_formulas/debouncedelay',
new lang_string('settingdebouncedelay', 'qtype_formulas'),
new lang_string('settingdebouncedelay_desc', 'qtype_formulas'),
300,
[300 => '300 ms', 400 => '400 ms', 500 => '500 ms', 600 => '600 ms', 750 => '750 ms', 1000 => '1 s'],
));
// Whether we should omit the check the model answer's correctness during imports.
$settings->add(new admin_setting_configcheckbox(
'qtype_formulas/lenientimport',
new lang_string('settinglenientimport', 'qtype_formulas'),
new lang_string('settinglenientimport_desc', 'qtype_formulas'),
0
));
// Default answer type.
$settings->add(new admin_setting_configselect(
'qtype_formulas/defaultanswertype',
new lang_string('defaultanswertype', 'qtype_formulas'),
new lang_string('defaultanswertype_desc', 'qtype_formulas'),
0,
[
0 => new lang_string('number', 'qtype_formulas'),
10 => new lang_string('numeric', 'qtype_formulas'),
100 => new lang_string('numerical_formula', 'qtype_formulas'),
1000 => new lang_string('algebraic_formula', 'qtype_formulas'),
]
));
// Default correctness.
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultcorrectness',
new lang_string('defaultcorrectness', 'qtype_formulas'),
new lang_string('defaultcorrectness_desc', 'qtype_formulas'),
'_relerr < 0.01'
));
// Default answermark.
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultanswermark',
new lang_string('defaultanswermark', 'qtype_formulas'),
new lang_string('defaultanswermark_desc', 'qtype_formulas'),
1,
PARAM_FLOAT,
4
));
// Default unit penalty.
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultunitpenalty',
new lang_string('defaultunitpenalty', 'qtype_formulas'),
new lang_string('defaultunitpenalty_desc', 'qtype_formulas'),
1,
PARAM_FLOAT,
4
));
$settings->add(new admin_setting_heading(
'qtype_formulas/defaultwidths',
new lang_string('settings_heading_width', 'qtype_formulas'),
new lang_string('settings_heading_width_desc', 'qtype_formulas'),
));
// Unit for default widths.
$settings->add(new admin_setting_configselect(
'qtype_formulas/defaultwidthunit',
new lang_string('defaultwidthunit', 'qtype_formulas'),
new lang_string('defaultwidthunit_desc', 'qtype_formulas'),
'px',
['px' => 'px', 'em' => 'em', 'rem' => 'rem'],
));
// Default width for answer type "Number".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_number',
new lang_string('defaultwidth_number', 'qtype_formulas'),
new lang_string('defaultwidth_number_desc', 'qtype_formulas'),
55,
PARAM_FLOAT,
6
));
// Default width for combined answer field of type "Number".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_number_unit',
new lang_string('defaultwidth_number_unit', 'qtype_formulas'),
new lang_string('defaultwidth_number_unit_desc', 'qtype_formulas'),
80,
PARAM_FLOAT,
6
));
// Default width for answer type "Numeric".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_numeric',
new lang_string('defaultwidth_numeric', 'qtype_formulas'),
new lang_string('defaultwidth_numeric_desc', 'qtype_formulas'),
100,
PARAM_FLOAT,
6
));
// Default width for combined answer field of type "Numeric".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_numeric_unit',
new lang_string('defaultwidth_numeric_unit', 'qtype_formulas'),
new lang_string('defaultwidth_numeric_unit_desc', 'qtype_formulas'),
200,
PARAM_FLOAT,
6
));
// Default width for answer type "Numerical formula".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_numerical_formula',
new lang_string('defaultwidth_numerical_formula', 'qtype_formulas'),
new lang_string('defaultwidth_numerical_formula_desc', 'qtype_formulas'),
200,
PARAM_FLOAT,
6
));
// Default width for combined answer field of type "Numerical formula".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_numerical_formula_unit',
new lang_string('defaultwidth_numerical_formula_unit', 'qtype_formulas'),
new lang_string('defaultwidth_numerical_formula_unit_desc', 'qtype_formulas'),
300,
PARAM_FLOAT,
6
));
// Default width for answer type "Algebraic formula".
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_algebraic_formula',
new lang_string('defaultwidth_algebraic_formula', 'qtype_formulas'),
new lang_string('defaultwidth_algebraic_formula_desc', 'qtype_formulas'),
200,
PARAM_FLOAT,
6
));
// Default width for separate unit field; not to be confused with the unit for the width (px, em, rem).
$settings->add(new admin_setting_configtext(
'qtype_formulas/defaultwidth_unit',
new lang_string('defaultwidth_unit', 'qtype_formulas'),
new lang_string('defaultwidth_unit_desc', 'qtype_formulas'),
55,
PARAM_FLOAT,
6
));
}