@@ -45,19 +45,19 @@ protected function definition_inner($mform) {
45
45
46
46
$ answersoption = '' ;
47
47
48
- $ typemenu = array ( 0 => get_string ('vartypecalculated ' , 'qtype_varnumericset ' ),
49
- 1 => get_string ('vartypepredefined ' , 'qtype_varnumericset ' )) ;
48
+ $ typemenu = [ 0 => get_string ('vartypecalculated ' , 'qtype_varnumericset ' ),
49
+ 1 => get_string ('vartypepredefined ' , 'qtype_varnumericset ' )] ;
50
50
51
- $ repeated = array () ;
52
- $ repeatedoptions = array () ;
51
+ $ repeated = [] ;
52
+ $ repeatedoptions = [] ;
53
53
$ mform ->addElement ('header ' , 'variables ' ,
54
54
get_string ('variables ' , 'qtype_varnumericset ' ));
55
55
$ repeated [] = $ mform ->createElement ('select ' , 'vartype ' , '' , $ typemenu );
56
56
$ repeated [] = $ mform ->createElement ('text ' , 'varname ' ,
57
- get_string ('varheader ' , 'qtype_varnumericset ' ), array ( 'size ' => 40 ) );
57
+ get_string ('varheader ' , 'qtype_varnumericset ' ), [ 'size ' => 40 ] );
58
58
59
59
$ mform ->setType ('varname ' , PARAM_RAW_TRIMMED );
60
- $ repeatedoptions ['varname ' ]['helpbutton ' ] = array ( 'varname ' , 'qtype_varnumericset ' ) ;
60
+ $ repeatedoptions ['varname ' ]['helpbutton ' ] = [ 'varname ' , 'qtype_varnumericset ' ] ;
61
61
62
62
list ($ repeated , $ repeatedoptions ) =
63
63
$ this ->add_value_form_fields ($ mform , $ repeated , $ repeatedoptions );
@@ -147,11 +147,11 @@ protected function add_value_form_fields($mform, $repeated, $repeatedoptions) {
147
147
}
148
148
for ($ i = 0 ; $ i < $ noofvariants ; $ i ++) {
149
149
$ repeated [] = $ mform ->createElement ('text ' , "variant $ i " ,
150
- get_string ('variant ' , 'qtype_varnumericset ' , $ i + 1 ), array ( 'size ' => 40 ) );
151
- $ repeatedoptions ["variant $ i " ]['disabledif ' ] = array ( 'vartype ' , 'eq ' , 0 ) ;
150
+ get_string ('variant ' , 'qtype_varnumericset ' , $ i + 1 ), [ 'size ' => 40 ] );
151
+ $ repeatedoptions ["variant $ i " ]['disabledif ' ] = [ 'vartype ' , 'eq ' , 0 ] ;
152
152
if ($ i == 0 ) {
153
153
$ repeatedoptions ["variant $ i " ]['helpbutton ' ]
154
- = array ( 'variants ' , 'qtype_varnumericset ' ) ;
154
+ = [ 'variants ' , 'qtype_varnumericset ' ] ;
155
155
}
156
156
$ mform ->setType ("variant $ i " , PARAM_RAW_TRIMMED );
157
157
}
@@ -160,7 +160,7 @@ protected function add_value_form_fields($mform, $repeated, $repeatedoptions) {
160
160
$ mform ->addElement ('hidden ' , 'noofvariants ' , $ noofvariants );
161
161
$ mform ->setConstant ('noofvariants ' , $ noofvariants );
162
162
$ mform ->setType ('noofvariants ' , PARAM_INT );
163
- return array ( $ repeated , $ repeatedoptions) ;
163
+ return [ $ repeated , $ repeatedoptions] ;
164
164
}
165
165
166
166
protected function add_value_form_last_field ($ mform , &$ repeated , &$ repeatedoptions ) {
@@ -173,22 +173,22 @@ protected function add_value_form_last_field($mform, &$repeated, &$repeatedoptio
173
173
* the start of the form.
174
174
*/
175
175
$ repeated [] = $ mform ->createElement ('text ' , "variant_last " ,
176
- 'last variant ' , '' , array ( 'class ' => 'last ' ) );
176
+ 'last variant ' , '' , [ 'class ' => 'last ' ] );
177
177
$ mform ->setType ('variant_last ' , PARAM_TEXT );
178
178
}
179
179
180
180
protected function get_per_answer_fields ($ mform , $ label , $ gradeoptions ,
181
181
&$ repeatedoptions , &$ answersoption ) {
182
- $ repeated = array () ;
183
- $ answeroptions = array () ;
182
+ $ repeated = [] ;
183
+ $ answeroptions = [] ;
184
184
185
185
// For this question type we are using a per answer header, a header for all answers won't really work.
186
186
$ mform ->removeElement ('answerhdr ' );
187
187
188
- $ answeroptions [] = $ mform ->createElement ('text ' , 'answer ' , '' , array ( 'size ' => 8 ) );
189
- $ answeroptions [] = $ mform ->createElement ('text ' , 'error ' , get_string ('error ' , 'qtype_varnumericset ' ), array ( 'size ' => 8 ) );
190
- $ sigfigsoptions = array ( 0 => get_string ('unspecified ' , 'qtype_varnumericset ' ),
191
- 1 => 1 , 2 => 2 , 3 => 3 , 4 => 4 , 5 => 5 , 6 => 6 ) ;
188
+ $ answeroptions [] = $ mform ->createElement ('text ' , 'answer ' , '' , [ 'size ' => 8 ] );
189
+ $ answeroptions [] = $ mform ->createElement ('text ' , 'error ' , get_string ('error ' , 'qtype_varnumericset ' ), [ 'size ' => 8 ] );
190
+ $ sigfigsoptions = [ 0 => get_string ('unspecified ' , 'qtype_varnumericset ' ),
191
+ 1 => 1 , 2 => 2 , 3 => 3 , 4 => 4 , 5 => 5 , 6 => 6 ] ;
192
192
$ answeroptions [] = $ mform ->createElement ('select ' , 'sigfigs ' , get_string ('sigfigs ' , 'qtype_varnumericset ' ),
193
193
$ sigfigsoptions );
194
194
@@ -197,29 +197,29 @@ protected function get_per_answer_fields($mform, $label, $gradeoptions,
197
197
$ label , $ answeroptions , null , false );
198
198
199
199
$ repeated [] = $ mform ->createElement ('editor ' , 'feedback ' ,
200
- get_string ('feedback ' , 'question ' ), array ( 'rows ' => 5 ) , $ this ->editoroptions );
200
+ get_string ('feedback ' , 'question ' ), [ 'rows ' => 5 ] , $ this ->editoroptions );
201
201
$ repeated [] = $ mform ->createElement ('static ' , 'autofirehdr ' , '' ,
202
202
get_string ('autofirehdr ' , 'qtype_varnumericset ' , '' ));
203
- $ autofirerow1 = array () ;
203
+ $ autofirerow1 = [] ;
204
204
$ autofirerow1 [] = $ mform ->createElement ('selectyesno ' , 'checknumerical ' ,
205
205
get_string ('checknumerical ' , 'qtype_varnumericset ' ));
206
- $ checkpowerof10options = array ( 0 => get_string ('no ' ),
206
+ $ checkpowerof10options = [ 0 => get_string ('no ' ),
207
207
1 => '+/- 1 ' , 2 => '+/- 2 ' , 3 => '+/- 3 ' ,
208
- 4 => '+/- 4 ' , 5 => '+/- 5 ' , 6 => '+/- 6 ' ) ;
208
+ 4 => '+/- 4 ' , 5 => '+/- 5 ' , 6 => '+/- 6 ' ] ;
209
209
$ autofirerow1 [] = $ mform ->createElement ('selectyesno ' , 'checkscinotation ' ,
210
210
get_string ('checkscinotation ' , 'qtype_varnumericset ' ));
211
211
$ repeated [] = $ mform ->createElement ('group ' , 'autofirerow1 ' , '' ,
212
212
$ autofirerow1 , null , false );
213
213
214
- $ autofirerow2 = array () ;
214
+ $ autofirerow2 = [] ;
215
215
$ autofirerow2 [] = $ mform ->createElement ('selectyesno ' , 'checkscinotationformat ' ,
216
216
get_string ('checkscinotationformat ' , 'qtype_varnumericset ' ));
217
217
$ autofirerow2 [] = $ mform ->createElement ('select ' , 'checkpowerof10 ' ,
218
218
get_string ('checkpowerof10 ' , 'qtype_varnumericset ' ), $ checkpowerof10options );
219
219
$ repeated [] = $ mform ->createElement ('group ' , 'autofirerow2 ' , '' ,
220
220
$ autofirerow2 , null , false );
221
221
222
- $ autofirerow3 = array () ;
222
+ $ autofirerow3 = [] ;
223
223
$ autofirerow3 [] = $ mform ->createElement ('selectyesno ' , 'checkrounding ' ,
224
224
get_string ('checkrounding ' , 'qtype_varnumericset ' ));
225
225
$ autofirerow3 [] = $ mform ->createElement ('select ' , 'syserrorpenalty ' ,
@@ -242,10 +242,10 @@ protected function get_hint_fields($withclearwrong = false, $withshownumpartscor
242
242
parent ::get_hint_fields (false , false );
243
243
$ repeated [] = $ mform ->createElement ('advcheckbox ' , 'hintclearwrong ' ,
244
244
get_string ('options ' , 'qtype_varnumericset ' ),
245
- get_string ('hintoverride ' , 'qtype_varnumericset ' ), null , array ( 0 , 1 ) );
245
+ get_string ('hintoverride ' , 'qtype_varnumericset ' ), null , [ 0 , 1 ] );
246
246
$ repeatedoptions ['hintclearwrong ' ]['type ' ] = PARAM_BOOL ;
247
247
248
- return array ( $ repeated , $ repeatedoptions) ;
248
+ return [ $ repeated , $ repeatedoptions] ;
249
249
}
250
250
251
251
protected function data_preprocessing ($ question ) {
0 commit comments