|
46 | 46 | $context = context_system::instance();
|
47 | 47 | $PAGE->set_context($context);
|
48 | 48 | require_capability('qtype/stack:usediagnostictools', $context);
|
49 |
| - $urlparams = array(); |
| 49 | + $urlparams = []; |
50 | 50 | } else {
|
51 | 51 | // Load the necessary data.
|
52 | 52 | if ($qubaid !== '') {
|
|
57 | 57 | } else {
|
58 | 58 | $question = question_bank::load_question($questionid);
|
59 | 59 | }
|
60 |
| - $questiondata = $DB->get_record('question', array('id' => $questionid), '*', MUST_EXIST); |
| 60 | + $questiondata = $DB->get_record('question', ['id' => $questionid], '*', MUST_EXIST); |
61 | 61 |
|
62 | 62 | // Process any other URL parameters, and do require_login.
|
63 | 63 | list($context, $seed, $urlparams) = qtype_stack_setup_question_test_page($question);
|
|
73 | 73 | $displaytext = '';
|
74 | 74 | $debuginfo = '';
|
75 | 75 | $errs = '';
|
76 |
| -$varerrs = array(); |
| 76 | +$varerrs = []; |
77 | 77 |
|
78 | 78 | if ($qubaid !== '' && optional_param('initialise', '', PARAM_RAW)) {
|
79 | 79 | // ISS-1110 Handle calls from questiontestrun.php.
|
|
124 | 124 | $options->set_site_defaults();
|
125 | 125 | $options->set_option('simplify', $simp);
|
126 | 126 |
|
127 |
| - $session = new stack_cas_session2(array(), $options); |
| 127 | + $session = new stack_cas_session2([], $options); |
128 | 128 | if ($vars || $inps) {
|
129 | 129 | $keyvals = new stack_cas_keyval($vars . "\n" . $inps, $options, 0);
|
130 | 130 | $keyvals->get_valid();
|
131 | 131 | $varerrs = $keyvals->get_errors();
|
132 | 132 | if ($keyvals->get_valid()) {
|
133 | 133 | $kvcode = $keyvals->compile('test');
|
134 |
| - $statements = array(); |
| 134 | + $statements = []; |
135 | 135 | if ($kvcode['contextvariables']) {
|
136 | 136 | $statements[] = new stack_secure_loader($kvcode['contextvariables'], 'caschat');
|
137 | 137 | }
|
|
155 | 155 | $errs = array_merge($errs, $session->get_errors(false));
|
156 | 156 | if ($errs) {
|
157 | 157 | $errs = stack_string_error('errors') . ': ' . implode(' ', array_unique($errs));
|
158 |
| - $errs = html_writer::tag('div', $errs, array('class' => 'error')); |
| 158 | + $errs = html_writer::tag('div', $errs, ['class' => 'error']); |
159 | 159 | } else {
|
160 | 160 | $errs = '';
|
161 | 161 | }
|
|
164 | 164 | // Save updated data in the DB when everything is valid.
|
165 | 165 | if ($questionid && $savedb) {
|
166 | 166 | $DB->set_field('question', 'generalfeedback', $string,
|
167 |
| - array('id' => $questionid)); |
| 167 | + ['id' => $questionid]); |
168 | 168 | $DB->set_field('qtype_stack_options', 'questionvariables', $vars,
|
169 |
| - array('questionid' => $questionid)); |
170 |
| - $DB->set_field('qtype_stack_options', 'compiledcache', null, array('questionid' => $questionid)); |
| 169 | + ['questionid' => $questionid]); |
| 170 | + $DB->set_field('qtype_stack_options', 'compiledcache', null, ['questionid' => $questionid]); |
171 | 171 | // Invalidate the question definition cache.
|
172 | 172 | stack_clear_vle_question_cache($questionid);
|
173 | 173 |
|
|
184 | 184 |
|
185 | 185 | $qtype = new qtype_stack();
|
186 | 186 | $qtestlink = html_writer::link($qtype->get_question_test_url($question), stack_string('runquestiontests'),
|
187 |
| - array('class' => 'nav-link')); |
188 |
| - echo html_writer::tag('nav', $qtestlink, array('class' => 'nav')); |
| 187 | + ['class' => 'nav-link']); |
| 188 | + echo html_writer::tag('nav', $qtestlink, ['class' => 'nav']); |
189 | 189 |
|
190 | 190 | if ($savedmsg) {
|
191 |
| - echo html_writer::tag('p', $savedmsg, array('class' => 'overallresult pass')); |
| 191 | + echo html_writer::tag('p', $savedmsg, ['class' => 'overallresult pass']); |
192 | 192 | }
|
193 | 193 |
|
194 | 194 | $out = html_writer::tag('summary', stack_string('questiontext'));
|
195 |
| - $out .= html_writer::tag('pre', $question->questiontext, array('class' => 'questiontext')); |
| 195 | + $out .= html_writer::tag('pre', $question->questiontext, ['class' => 'questiontext']); |
196 | 196 | echo html_writer::tag('details', $out);
|
197 | 197 | }
|
198 | 198 |
|
|
207 | 207 | $fout .= html_writer::tag('p', implode($varerrs));
|
208 | 208 | $varlen = substr_count($vars, "\n") + 3;
|
209 | 209 | $fout .= html_writer::tag('p', html_writer::tag('textarea', $vars,
|
210 |
| - array('cols' => 100, 'rows' => $varlen, 'name' => 'maximavars'))); |
| 210 | + ['cols' => 100, 'rows' => $varlen, 'name' => 'maximavars'])); |
211 | 211 | if ($questionid) {
|
212 | 212 | $inplen = substr_count($inps, "\n");
|
213 | 213 | $fout .= html_writer::tag('p', html_writer::tag('textarea', $inps,
|
214 |
| - array('cols' => 100, 'rows' => $inplen, 'name' => 'inputs'))); |
| 214 | + ['cols' => 100, 'rows' => $inplen, 'name' => 'inputs'])); |
215 | 215 | }
|
216 | 216 | if ($simp) {
|
217 | 217 | $fout .= stack_string('autosimplify').' '.
|
218 |
| - html_writer::empty_tag('input', array('type' => 'checkbox', 'checked' => $simp, 'name' => 'simp')); |
| 218 | + html_writer::empty_tag('input', ['type' => 'checkbox', 'checked' => $simp, 'name' => 'simp']); |
219 | 219 | } else {
|
220 |
| - $fout .= stack_string('autosimplify').' '.html_writer::empty_tag('input', array('type' => 'checkbox', 'name' => 'simp')); |
| 220 | + $fout .= stack_string('autosimplify').' '.html_writer::empty_tag('input', ['type' => 'checkbox', 'name' => 'simp']); |
221 | 221 | }
|
222 | 222 | if ($questionid) {
|
223 | 223 | $fout .= html_writer::tag('h2', stack_string('generalfeedback'));
|
|
227 | 227 | $fout .= html_writer::tag('p', $errs);
|
228 | 228 | $stringlen = max(substr_count($string, "\n") + 3, 8);
|
229 | 229 | $fout .= html_writer::tag('p', html_writer::tag('textarea', $string,
|
230 |
| - array('cols' => 100, 'rows' => $stringlen, 'name' => 'cas'))); |
| 230 | + ['cols' => 100, 'rows' => $stringlen, 'name' => 'cas'])); |
231 | 231 | $fout .= html_writer::start_tag('p');
|
232 | 232 | $fout .= html_writer::empty_tag('input',
|
233 |
| - array('type' => 'submit', 'name' => 'action', 'value' => stack_string('chat'))); |
| 233 | + ['type' => 'submit', 'name' => 'action', 'value' => stack_string('chat')]); |
234 | 234 | if ($questionid && !$varerrs) {
|
235 | 235 | $fout .= html_writer::empty_tag('input',
|
236 |
| - array('type' => 'submit', 'name' => 'action', 'value' => stack_string('savechat'))); |
| 236 | + ['type' => 'submit', 'name' => 'action', 'value' => stack_string('savechat')]); |
237 | 237 | }
|
238 | 238 | $fout .= html_writer::end_tag('p');
|
239 |
| -echo html_writer::tag('form', $fout, array('action' => $PAGE->url, 'method' => 'post')); |
| 239 | +echo html_writer::tag('form', $fout, ['action' => $PAGE->url, 'method' => 'post']); |
240 | 240 |
|
241 | 241 | if ('' != trim($debuginfo)) {
|
242 | 242 | echo $OUTPUT->box($debuginfo);
|
|
0 commit comments