forked from maths/moodle-qtype_stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
272 lines (225 loc) · 14 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
<?php
// This file is part of Stack - http://stack.maths.ed.ac.uk/
//
// Stack 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.
//
// Stack 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 Stack. If not, see <http://www.gnu.org/licenses/>.
/**
* Configuration settings declaration information for the Stack question type.
*
* @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/settingslib.php');
require_once(__DIR__ . '/stack/options.class.php');
require_once(__DIR__ . '/stack/potentialresponsetree.class.php');
// Useful links.
$links = array(
get_string('stackDoc_docs_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/doc/doc.php/'))),
get_string('healthcheck_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/healthcheck.php'))),
get_string('chat_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/caschat.php'))),
get_string('stackInstall_testsuite_title_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/answertests.php'))),
get_string('stackInstall_input_title_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/studentinputs.php'))),
get_string('bulktestindexintro_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/bulktestindex.php'))),
get_string('stackInstall_replace_dollars_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/adminui/replacedollarsindex.php'))),
);
$settings->add(new admin_setting_heading('docs',
get_string('settingusefullinks', 'qtype_stack'),
'* ' . implode("\n* ", $links)));
// Options for connection to Maxima.
// Note that any settings here where we try to set the default
// intelligently in install.php, the default here must be null.
// Otherwise, the default here will overwrite anything set in install.php.
$settings->add(new admin_setting_heading('maixmasettingsheading',
get_string('settingsmaximasettings', 'qtype_stack'), ''));
$settings->add(new admin_setting_configselect('qtype_stack/platform',
get_string('settingplatformtype', 'qtype_stack'),
// Note, install.php tries to auto-detect Windows installs, and set the default appropriately.
get_string('settingplatformtype_desc', 'qtype_stack'), null, array(
'linux' => get_string('settingplatformtypelinux', 'qtype_stack'),
'linux-optimised' => get_string('settingplatformtypelinuxoptimised', 'qtype_stack'),
'win' => get_string('settingplatformtypewin', 'qtype_stack'),
'server' => get_string('settingplatformtypeserver', 'qtype_stack'))));
$settings->add(new admin_setting_configselect('qtype_stack/maximaversion',
get_string('settingcasmaximaversion', 'qtype_stack'),
get_string('settingcasmaximaversion_desc', 'qtype_stack'), null,
array('5.38.1' => '5.38.1', '5.39.0' => '5.39.0',
'5.40.0' => '5.40.0', '5.41.0' => '5.41.0', '5.42.0' => '5.42.0',
'5.42.1' => '5.42.1', '5.42.2' => '5.42.2',
'5.43.0' => '5.43.0', '5.43.1' => '5.43.1', '5.43.2' => '5.43.2',
'5.44.0' => '5.44.0', 'default' => 'default')));
$settings->add(new admin_setting_configtext('qtype_stack/castimeout',
get_string('settingcastimeout', 'qtype_stack'),
get_string('settingcastimeout_desc', 'qtype_stack'), 10, PARAM_INT, 3));
$settings->add(new admin_setting_configselect('qtype_stack/casresultscache',
get_string('settingcasresultscache', 'qtype_stack'),
get_string('settingcasresultscache_desc', 'qtype_stack'), 'db', array(
'none' => get_string('settingcasresultscache_none', 'qtype_stack'),
'db' => get_string('settingcasresultscache_db', 'qtype_stack'),
)));
$settings->add(new admin_setting_configselect('qtype_stack/caspreparse',
get_string('settingcaspreparse', 'qtype_stack'),
get_string('settingcaspreparse_desc', 'qtype_stack'), 'true', array(
'true' => get_string('settingcaspreparse_true', 'qtype_stack'),
'false' => get_string('settingcaspreparse_false', 'qtype_stack'),
)));
$settings->add(new admin_setting_configtext('qtype_stack/maximacommand',
get_string('settingplatformmaximacommand', 'qtype_stack'),
get_string('settingplatformmaximacommand_desc', 'qtype_stack'), null));
$settings->add(new admin_setting_configtext('qtype_stack/maximacommandopt',
get_string('settingplatformmaximacommandopt', 'qtype_stack'),
get_string('settingplatformmaximacommandopt_desc', 'qtype_stack'), null));
$settings->add(new admin_setting_configtext('qtype_stack/maximacommandserver',
get_string('settingplatformmaximacommandserver', 'qtype_stack'),
get_string('settingplatformmaximacommandserver_desc', 'qtype_stack'), null));
$settings->add(new admin_setting_configtext('qtype_stack/serveruserpass',
get_string('settingserveruserpass', 'qtype_stack'),
get_string('settingserveruserpass_desc', 'qtype_stack'), ''));
$settings->add(new admin_setting_configtext('qtype_stack/plotcommand',
get_string('settingplatformplotcommand', 'qtype_stack'),
get_string('settingplatformplotcommand_desc', 'qtype_stack'), ''));
// The supported libraries are defined by public static $maximalibraries in installhelper.php.
$settings->add(new admin_setting_configtext('qtype_stack/maximalibraries',
get_string('settingmaximalibraries', 'qtype_stack'),
get_string('settingmaximalibraries_desc', 'qtype_stack'), null));
$settings->add(new admin_setting_configcheckbox('qtype_stack/casdebugging',
get_string('settingcasdebugging', 'qtype_stack'),
get_string('settingcasdebugging_desc', 'qtype_stack'), 0));
// @codingStandardsIgnoreStart
// ILIAS: will need to replicate this cache.
// The Moodle cache API is quite simple, so to replicate it we need only implement
// $cache = cache::make('qtype_stack', 'parsercache');
// $ast = $cache->get($cachekey); // Returns null/false or something if key not present.
// $cache->set($cachekey, $ast);
// Or, it is already possible to disable this, because there is a config variable that can be set to 0 to disable.
// @codingStandardsIgnoreEnd
$settings->add(new admin_setting_configtext('qtype_stack/parsercacheinputlength',
get_string('settingparsercacheinputlength', 'qtype_stack'),
get_string('settingparsercacheinputlength_desc', 'qtype_stack'), 50, PARAM_INT, 3));
// Options for maths display.
$settings->add(new admin_setting_heading('mathsdisplayheading',
get_string('settingsmathsdisplayheading', 'qtype_stack'), ''));
$settings->add(new admin_setting_configcheckbox('qtype_stack/ajaxvalidation',
get_string('settingajaxvalidation', 'qtype_stack'),
get_string('settingajaxvalidation_desc', 'qtype_stack'), 1));
$settings->add(new qtype_stack_admin_setting_maths_display_method('qtype_stack/mathsdisplay',
get_string('settingmathsdisplay', 'qtype_stack'),
get_string('settingmathsdisplay_desc', 'qtype_stack'), 'mathjax', null));
$settings->add(new admin_setting_configcheckbox('qtype_stack/replacedollars',
get_string('settingreplacedollars', 'qtype_stack'),
get_string('settingreplacedollars_desc', 'qtype_stack'), false));
// Options for new inputs.
$settings->add(new admin_setting_heading('inputoptionsheading',
get_string('settingdefaultinputoptions', 'qtype_stack'),
get_string('settingdefaultinputoptions_desc', 'qtype_stack')));
$settings->add(new qtype_stack_admin_setting_input_types('qtype_stack/inputtype',
get_string('inputtype', 'qtype_stack'),
get_string('inputtype_help', 'qtype_stack'), 'algebraic', null));
$settings->add(new admin_setting_configtext('qtype_stack/inputboxsize',
get_string('boxsize', 'qtype_stack'),
get_string('boxsize_help', 'qtype_stack'), '15', PARAM_INT));
$settings->add(new admin_setting_configselect('qtype_stack/inputstrictsyntax',
get_string('strictsyntax', 'qtype_stack'),
get_string('strictsyntax_help', 'qtype_stack'), '1',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inputinsertstars',
get_string('insertstars', 'qtype_stack'),
get_string('insertstars_help', 'qtype_stack'), '0',
stack_options::get_insert_star_options()));
$settings->add(new admin_setting_configtext('qtype_stack/inputforbidwords',
get_string('forbidwords', 'qtype_stack'),
get_string('forbidwords_help', 'qtype_stack'), '', PARAM_RAW));
$settings->add(new admin_setting_configselect('qtype_stack/inputforbidfloat',
get_string('forbidfloat', 'qtype_stack'),
get_string('forbidfloat_help', 'qtype_stack'), '1',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inputrequirelowestterms',
get_string('requirelowestterms', 'qtype_stack'),
get_string('requirelowestterms_help', 'qtype_stack'), '0',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inputcheckanswertype',
get_string('checkanswertype', 'qtype_stack'),
get_string('checkanswertype_help', 'qtype_stack'), '0',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inputmustverify',
get_string('mustverify', 'qtype_stack'),
get_string('mustverify_help', 'qtype_stack'), '1',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inputshowvalidation',
get_string('showvalidation', 'qtype_stack'),
get_string('showvalidation_help', 'qtype_stack'), '1',
stack_options::get_showvalidation_options()));
// Options for new questions.
$settings->add(new admin_setting_heading('questionoptionsheading',
get_string('settingdefaultquestionoptions', 'qtype_stack'),
get_string('settingdefaultquestionoptions_desc', 'qtype_stack')));
$settings->add(new admin_setting_configselect('qtype_stack/questionsimplify',
get_string('questionsimplify', 'qtype_stack'),
get_string('autosimplify_help', 'qtype_stack'), '1',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/assumepositive',
get_string('assumepositive', 'qtype_stack'),
get_string('assumepositive_help', 'qtype_stack'), '0',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/assumereal',
get_string('assumereal', 'qtype_stack'),
get_string('assumereal_help', 'qtype_stack'), '0',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/feedbackstyle',
get_string('feedbackstyle', 'qtype_stack'),
get_string('feedbackstyle', 'qtype_stack'), '1',
stack_potentialresponse_tree::get_feedbackstyle_options()));
$settings->add(new admin_setting_configtextarea('qtype_stack/prtcorrect',
get_string('prtcorrectfeedback', 'qtype_stack'), '',
get_string('symbolicprtcorrectfeedback', 'qtype_stack') . ' ' .
get_string('defaultprtcorrectfeedback', 'qtype_stack'), PARAM_RAW, 60, 3));
$settings->add(new admin_setting_configtextarea('qtype_stack/prtpartiallycorrect',
get_string('prtpartiallycorrectfeedback', 'qtype_stack'), '',
get_string('symbolicprtpartiallycorrectfeedback', 'qtype_stack') . ' ' .
get_string('defaultprtpartiallycorrectfeedback', 'qtype_stack'), PARAM_RAW, 60, 3));
$settings->add(new admin_setting_configtextarea('qtype_stack/prtincorrect',
get_string('prtincorrectfeedback', 'qtype_stack'), '',
get_string('symbolicprtincorrectfeedback', 'qtype_stack') . ' ' .
get_string('defaultprtincorrectfeedback', 'qtype_stack'), PARAM_RAW, 60, 3));
$settings->add(new admin_setting_configselect('qtype_stack/multiplicationsign',
get_string('multiplicationsign', 'qtype_stack'),
get_string('multiplicationsign_help', 'qtype_stack'), 'dot',
stack_options::get_multiplication_sign_options()));
$settings->add(new admin_setting_configselect('qtype_stack/sqrtsign',
get_string('sqrtsign', 'qtype_stack'),
get_string('sqrtsign_help', 'qtype_stack'), '1',
stack_options::get_yes_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/complexno',
get_string('complexno', 'qtype_stack'),
get_string('complexno_help', 'qtype_stack'), 'i',
stack_options::get_complex_no_options()));
$settings->add(new admin_setting_configselect('qtype_stack/inversetrig',
get_string('inversetrig', 'qtype_stack'),
get_string('inversetrig_help', 'qtype_stack'), 'cos-1',
stack_options::get_inverse_trig_options()));
$settings->add(new admin_setting_configselect('qtype_stack/logicsymbol',
get_string('logicsymbol', 'qtype_stack'),
get_string('logicsymbol_help', 'qtype_stack'), 'lang',
stack_options::get_logic_options()));
$settings->add(new admin_setting_configselect('qtype_stack/matrixparens',
get_string('matrixparens', 'qtype_stack'),
get_string('matrixparens_help', 'qtype_stack'), '[',
stack_options::get_matrix_parens_options()));