MDL-10210 Updated the admin settings page for the grader report.
[moodle.git] / mod / quiz / mod_form.php
CommitLineData
a23f0aaf 1<?php
23a7718b 2require_once ($CFG->dirroot.'/course/moodleform_mod.php');
a23f0aaf 3
4require_once("$CFG->dirroot/mod/quiz/locallib.php");
5
f07b9627 6class mod_quiz_mod_form extends moodleform_mod {
a23f0aaf 7 var $_feedbacks;
8
2ee60b49 9 function definition() {
a23f0aaf 10
2ee60b49 11 global $COURSE, $CFG, $QUIZ_GRADE_METHOD;
12 $mform =& $this->_form;
a23f0aaf 13
a23f0aaf 14//-------------------------------------------------------------------------------
15 $mform->addElement('header', 'general', get_string('general', 'form'));
16
26de8d35 17 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
2ee60b49 18 $mform->setType('name', PARAM_TEXT);
a23f0aaf 19
2ee60b49 20 $mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
21 $mform->setType('intro', PARAM_RAW);
18a77361 22 $mform->setHelpButton('intro', array('richtext', get_string('helprichtext')));
a23f0aaf 23
24//-------------------------------------------------------------------------------
25 $mform->addElement('header', 'timinghdr', get_string('timing', 'form'));
f5efac7b 26 $mform->addElement('date_time_selector', 'timeopen', get_string("quizopen", "quiz"), array('optional'=>true));
2ee60b49 27 $mform->setHelpButton('timeopen', array('timeopen', get_string('quizopens', 'quiz'), 'quiz'));
a23f0aaf 28
f5efac7b 29 $mform->addElement('date_time_selector', 'timeclose', get_string("quizcloses", "quiz"), array('optional'=>true));
2ee60b49 30 $mform->setHelpButton('timeclose', array('timeopen', get_string('quizcloses', 'quiz'), 'quiz'));
a23f0aaf 31
32
33 $timelimitgrp=array();
34 $timelimitgrp[] = &$mform->createElement('text', 'timelimit');
35 $timelimitgrp[] = &$mform->createElement('checkbox', 'timelimitenable', '', get_string('enable'));
bb4598fc 36 $mform->addGroup($timelimitgrp, 'timelimitgrp', get_string('timelimitmin', 'quiz'), array(' '), false);
2ee60b49 37 $mform->setType('timelimit', PARAM_TEXT);
38 $timelimitgrprules = array();
39 $timelimitgrprules['timelimit'][] = array(null, 'numeric', null, 'client');
40 $mform->addGroupRule('timelimitgrp', $timelimitgrprules);
a23f0aaf 41 $mform->disabledIf('timelimitgrp', 'timelimitenable');
2ee60b49 42 $mform->setAdvanced('timelimitgrp', $CFG->quiz_fix_timelimit);
43 $mform->setHelpButton('timelimitgrp', array("timelimit", get_string("quiztimer","quiz"), "quiz"));
a23f0aaf 44 $mform->setDefault('timelimit', $CFG->quiz_timelimit);
45
46
47 //enforced time delay between quiz attempts add-on
48 $timedelayoptions = array();
49 $timedelayoptions[0] = get_string('none');
50 $timedelayoptions[1800] = get_string('numminutes', '', 30);
51 $timedelayoptions[3600] = get_string('numminutes', '', 60);
52 for($i=2; $i<=23; $i++) {
53 $seconds = $i*3600;
54 $timedelayoptions[$seconds] = get_string('numhours', '', $i);
55 }
56 $timedelayoptions[86400] = get_string('numhours', '', 24);
57 for($i=2; $i<=7; $i++) {
58 $seconds = $i*86400;
59 $timedelayoptions[$seconds] = get_string('numdays', '', $i);
60 }
61 $mform->addElement('select', 'delay1', get_string("delay1", "quiz"), $timedelayoptions);
2ee60b49 62 $mform->setHelpButton('delay1', array("timedelay1", get_string("delay1", "quiz"), "quiz"));
63 $mform->setAdvanced('delay1', $CFG->quiz_fix_delay1);
a23f0aaf 64 $mform->setDefault('delay1', $CFG->quiz_delay1);
65
66 $mform->addElement('select', 'delay2', get_string("delay2", "quiz"), $timedelayoptions);
2ee60b49 67 $mform->setHelpButton('delay2', array("timedelay2", get_string("delay2", "quiz"), "quiz"));
68 $mform->setAdvanced('delay2', $CFG->quiz_fix_delay2);
a23f0aaf 69 $mform->setDefault('delay2', $CFG->quiz_delay2);
70
71//-------------------------------------------------------------------------------
72 $mform->addElement('header', 'displayhdr', get_string('display', 'form'));
2ee60b49 73 $perpage = array();
a23f0aaf 74 for ($i = 0; $i <= 50; ++$i) {
75 $perpage[$i] = $i;
76 }
77 $perpage[0] = get_string('allinone', 'quiz');
2ee60b49 78 $mform->addElement('select', 'questionsperpage', get_string('questionsperpage', 'quiz'), $perpage);
79 $mform->setHelpButton('questionsperpage', array('questionsperpage', get_string('questionsperpage', 'quiz'), 'quiz'));
80 $mform->setAdvanced('questionsperpage', $CFG->quiz_fix_questionsperpage);
a23f0aaf 81 $mform->setDefault('questionsperpage', $CFG->quiz_questionsperpage);
82
2ee60b49 83 $mform->addElement('selectyesno', 'shufflequestions', get_string("shufflequestions", "quiz"));
84 $mform->setHelpButton('shufflequestions', array("shufflequestions", get_string("shufflequestions","quiz"), "quiz"));
85 $mform->setAdvanced('shufflequestions', $CFG->quiz_fix_shufflequestions);
a23f0aaf 86 $mform->setDefault('shufflequestions', $CFG->quiz_shufflequestions);
87
2ee60b49 88 $mform->addElement('selectyesno', 'shuffleanswers', get_string("shufflewithin", "quiz"));
89 $mform->setHelpButton('shuffleanswers', array("shufflewithin", get_string("shufflewithin","quiz"), "quiz"));
90 $mform->setAdvanced('shuffleanswers', $CFG->quiz_fix_shuffleanswers);
a23f0aaf 91 $mform->setDefault('shuffleanswers', $CFG->quiz_shuffleanswers);
92
93//-------------------------------------------------------------------------------
94 $mform->addElement('header', 'attemptshdr', get_string('attempts', 'quiz'));
2ee60b49 95 $attemptoptions = array();
a23f0aaf 96 $attemptoptions[0] = get_string("attemptsunlimited", "quiz");
97 $attemptoptions[1] = "1 ".moodle_strtolower(get_string("attempt", "quiz"));
98 for ($i=2;$i<=6;$i++) {
99 $attemptoptions[$i] = "$i ".moodle_strtolower(get_string("attempts", "quiz"));
100 }
2ee60b49 101 $mform->addElement('select', 'attempts', get_string("attemptsallowed", "quiz"), $attemptoptions);
102 $mform->setHelpButton('attempts', array("attempts", get_string("attemptsallowed","quiz"), "quiz"));
103 $mform->setAdvanced('attempts', $CFG->quiz_fix_attempts);
a23f0aaf 104 $mform->setDefault('attempts', $CFG->quiz_attempts);
105
2ee60b49 106 $mform->addElement('selectyesno', 'attemptonlast', get_string("eachattemptbuildsonthelast", "quiz"));
107 $mform->setHelpButton('attemptonlast', array("repeatattempts", get_string("eachattemptbuildsonthelast", "quiz"), "quiz"));
108 $mform->setAdvanced('attemptonlast', $CFG->quiz_fix_attemptonlast);
a23f0aaf 109 $mform->setDefault('attemptonlast', $CFG->quiz_attemptonlast);
110
2ee60b49 111 $mform->addElement('selectyesno', 'adaptive', get_string("adaptive", "quiz"));
112 $mform->setHelpButton('adaptive', array("adaptive", get_string("adaptive","quiz"), "quiz"));
113 $mform->setAdvanced('adaptive', $CFG->quiz_fix_adaptive);
114 $mform->setDefault('adaptive', $CFG->quiz_optionflags & QUESTION_ADAPTIVE);
a23f0aaf 115
116
117//-------------------------------------------------------------------------------
118 $mform->addElement('header', 'gradeshdr', get_string('grades', 'grades'));
2ee60b49 119 $mform->addElement('select', 'grademethod', get_string("grademethod", "quiz"), $QUIZ_GRADE_METHOD);
120 $mform->setHelpButton('grademethod', array("grademethod", get_string("grademethod","quiz"), "quiz"));
121 $mform->setAdvanced('grademethod', $CFG->quiz_fix_grademethod);
a23f0aaf 122 $mform->setDefault('grademethod', $CFG->quiz_grademethod);
123
2ee60b49 124 $mform->addElement('selectyesno', 'penaltyscheme', get_string("penaltyscheme", "quiz"));
125 $mform->setHelpButton('penaltyscheme', array("penaltyscheme", get_string("penaltyscheme","quiz"), "quiz"));
126 $mform->setAdvanced('penaltyscheme', $CFG->quiz_fix_penaltyscheme);
a23f0aaf 127 $mform->setDefault('penaltyscheme', $CFG->quiz_penaltyscheme);
128
2ee60b49 129 $options = array(
a23f0aaf 130 0 => '0',
131 1 => '1',
132 2 => '2',
133 3 => '3');
2ee60b49 134 $mform->addElement('select', 'decimalpoints', get_string("decimaldigits", "quiz"), $options);
135 $mform->setHelpButton('decimalpoints', array("decimalpoints", get_string("decimaldigits","quiz"), "quiz"));
136 $mform->setAdvanced('decimalpoints', $CFG->quiz_fix_decimalpoints);
09f7fa11 137 $mform->setDefault('decimalpoints', $CFG->quiz_decimalpoints);
a23f0aaf 138
2ee60b49 139 $mform->addElement('hidden', 'grade', $CFG->quiz_maximumgrade);
a23f0aaf 140
141//-------------------------------------------------------------------------------
142 $mform->addElement('header', 'reviewoptionshdr', get_string("reviewoptions", "quiz"));
2ee60b49 143 $mform->setHelpButton('reviewoptionshdr', array("review2", get_string("allowreview","quiz"), "quiz"));
144 $mform->setAdvanced('reviewoptionshdr', $CFG->quiz_fix_review);
a23f0aaf 145
2ee60b49 146 $immediatelyoptionsgrp=array();
a23f0aaf 147 $immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'responsesimmediately', '', get_string('responses', 'quiz'));
148 $immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'scoreimmediately', '', get_string('scores', 'quiz'));
149 $immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackimmediately', '', get_string('feedback', 'quiz'));
150 $immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'answersimmediately', '', get_string('answers', 'quiz'));
151 $immediatelyoptionsgrp[] = &$mform->createElement('checkbox', 'generalfeedbackimmediately', '', get_string('generalfeedback', 'quiz'));
152 $mform->addGroup($immediatelyoptionsgrp, 'immediatelyoptionsgrp', get_string("reviewimmediately", "quiz"), null, false);
153 $mform->setDefault('responsesimmediately', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_IMMEDIATELY);
154 $mform->setDefault('scoreimmediately', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_IMMEDIATELY);
155 $mform->setDefault('feedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
156 $mform->setDefault('answersimmediately', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY);
157 $mform->setDefault('generalfeedbackimmediately', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY);
158
2ee60b49 159 $openoptionsgrp=array();
a23f0aaf 160 $openoptionsgrp[] = &$mform->createElement('checkbox', 'responsesopen', '', get_string('responses', 'quiz'));
161 $openoptionsgrp[] = &$mform->createElement('checkbox', 'scoreopen', '', get_string('scores', 'quiz'));
162 $openoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackopen', '', get_string('feedback', 'quiz'));
163 $openoptionsgrp[] = &$mform->createElement('checkbox', 'answersopen', '', get_string('answers', 'quiz'));
164 $openoptionsgrp[] = &$mform->createElement('checkbox', 'generalfeedbackopen', '', get_string('generalfeedback', 'quiz'));
165 $mform->addGroup($openoptionsgrp, 'openoptionsgrp', get_string("reviewopen", "quiz"), array(' '), false);
166 $mform->setDefault('responsesopen', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_OPEN);
167 $mform->setDefault('scoreopen', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN);
168 $mform->setDefault('feedbackopen', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN);
169 $mform->setDefault('answersopen', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_OPEN);
170 $mform->setDefault('generalfeedbackopen', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN);
171
172
2ee60b49 173 $closedoptionsgrp=array();
a23f0aaf 174 $closedoptionsgrp[] = &$mform->createElement('checkbox', 'responsesclosed', '', get_string('responses', 'quiz'));
175 $closedoptionsgrp[] = &$mform->createElement('checkbox', 'scoreclosed', '', get_string('scores', 'quiz'));
176 $closedoptionsgrp[] = &$mform->createElement('checkbox', 'feedbackclosed', '', get_string('feedback', 'quiz'));
177 $closedoptionsgrp[] = &$mform->createElement('checkbox', 'answersclosed', '', get_string('answers', 'quiz'));
178 $closedoptionsgrp[] = &$mform->createElement('checkbox', 'generalfeedbackclosed', '', get_string('generalfeedback', 'quiz'));
179 $mform->addGroup($closedoptionsgrp, 'closedoptionsgrp', get_string("reviewclosed", "quiz"), array(' '), false);
180 $mform->setDefault('responsesclosed', $CFG->quiz_review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_CLOSED);
181 $mform->setDefault('scoreclosed', $CFG->quiz_review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED);
182 $mform->setDefault('feedbackclosed', $CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED);
183 $mform->setDefault('answersclosed', $CFG->quiz_review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_CLOSED);
184 $mform->setDefault('generalfeedbackclosed', $CFG->quiz_review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED);
185
186//-------------------------------------------------------------------------------
187 $mform->addElement('header', 'security', get_string('security', 'form'));
188
189 $mform->addElement('selectyesno', 'popup', get_string("popup", "quiz"));
2ee60b49 190 $mform->setHelpButton('popup', array("popup", get_string("popup", "quiz"), "quiz"));
191 $mform->setAdvanced('popup', $CFG->quiz_fix_popup);
a23f0aaf 192 $mform->setDefault('popup', $CFG->quiz_popup);
193
54bb33eb 194 $mform->addElement('passwordunmask', 'quizpassword', get_string("requirepassword", "quiz"));
2ee60b49 195 $mform->setType('quizpassword', PARAM_TEXT);
196 $mform->setHelpButton('quizpassword', array("requirepassword", get_string("requirepassword", "quiz"), "quiz"));
197 $mform->setAdvanced('quizpassword', $CFG->quiz_fix_password);
ab0a8ff2 198 $mform->setDefault('quizpassword', $CFG->quiz_password);
a23f0aaf 199
2ee60b49 200 $mform->addElement('text', 'subnet', get_string("requiresubnet", "quiz"));
201 $mform->setType('subnet', PARAM_TEXT);
202 $mform->setHelpButton('subnet', array("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"));
203 $mform->setAdvanced('subnet', $CFG->quiz_fix_subnet);
a23f0aaf 204 $mform->setDefault('subnet', $CFG->quiz_subnet);
205
206//-------------------------------------------------------------------------------
2ee60b49 207 $this->standard_coursemodule_elements();
a23f0aaf 208//-------------------------------------------------------------------------------
08224df1 209 $mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'quiz'));
2ee60b49 210 $mform->setHelpButton('overallfeedbackhdr', array('overallfeedback', get_string('overallfeedback', 'quiz'), 'quiz'));
a23f0aaf 211
2ee60b49 212 $mform->addElement('static', 'gradeboundarystatic1', get_string('gradeboundary', 'quiz'), '100%');
a23f0aaf 213
214 $repeatarray=array();
215 $repeatarray[] = &MoodleQuickForm::createElement('text', 'feedbacktext', get_string('feedback', 'quiz'));
216 $repeatarray[] = &MoodleQuickForm::createElement('text', 'feedbackboundaries', get_string('gradeboundary', 'quiz'));
217
218 if (!empty($this->_instance)) {
219 $this->_feedbacks = get_records('quiz_feedback', 'quizid', $this->_instance, 'mingrade DESC');
220 } else {
221 $this->_feedbacks = array();
222 }
223 $numfeedbacks = max(count($this->_feedbacks) * 1.5, 5);
ebff6e2c 224
3a298174 225 $mform->setType('feedbacktext', PARAM_TEXT);
226 $mform->setType('feedbackboundaries', PARAM_NOTAGS);
ebff6e2c 227
a23f0aaf 228 $nextel=$this->repeat_elements($repeatarray, $numfeedbacks-1,
3a298174 229 array(), 'boundary_repeats', 'boundary_add_fields', 3);
a23f0aaf 230
231 //put some extra elements in before the button
232 $insertEl = &MoodleQuickForm::createElement('text', "feedbacktext[$nextel]", get_string('feedback', 'quiz'));
233 $mform->insertElementBefore($insertEl, 'boundary_add_fields');
a23f0aaf 234
235 $insertEl = &MoodleQuickForm::createElement('static', 'gradeboundarystatic2', get_string('gradeboundary', 'quiz'), '0%');
236 $mform->insertElementBefore($insertEl, 'boundary_add_fields');
237
238//-------------------------------------------------------------------------------
239 // buttons
240 $this->add_action_buttons();
2ee60b49 241 }
a23f0aaf 242
2ee60b49 243 function data_preprocessing(&$default_values){
a23f0aaf 244 if (count($this->_feedbacks)) {
245 $key = 0;
246 foreach ($this->_feedbacks as $feedback){
247 $default_values['feedbacktext['.$key.']'] = $feedback->feedbacktext;
248 if ($feedback->mingrade > 0) {
249 $default_values['feedbackboundaries['.$key.']'] = (100.0 * $feedback->mingrade / $default_values['grade']) . '%';
250 }
251 $key++;
252 }
253
254 }
255 if (empty($default_values['timelimit'])) {
256 $default_values['timelimitenable'] = 0;
257 } else {
258 $default_values['timelimitenable'] = 1;
259 }
260
261 if (isset($default_values['review'])){
262 $review = (int)$default_values['review'];
263 unset($default_values['review']);
264
265 $default_values['responsesimmediately'] = $review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_IMMEDIATELY;
266 $default_values['scoreimmediately'] = $review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_IMMEDIATELY;
267 $default_values['feedbackimmediately'] = $review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY;
268 $default_values['answersimmediately'] = $review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_IMMEDIATELY;
269 $default_values['generalfeedbackimmediately'] = $review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_IMMEDIATELY;
270
271 $default_values['responsesopen'] = $review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_OPEN;
272 $default_values['scoreopen'] = $review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_OPEN;
273 $default_values['feedbackopen'] = $review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN;
274 $default_values['answersopen'] = $review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_OPEN;
275 $default_values['generalfeedbackopen'] = $review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_OPEN;
276
277 $default_values['responsesclosed'] = $review & QUIZ_REVIEW_RESPONSES & QUIZ_REVIEW_CLOSED;
278 $default_values['scoreclosed'] = $review & QUIZ_REVIEW_SCORES & QUIZ_REVIEW_CLOSED;
279 $default_values['feedbackclosed'] = $review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED;
280 $default_values['answersclosed'] = $review & QUIZ_REVIEW_ANSWERS & QUIZ_REVIEW_CLOSED;
281 $default_values['generalfeedbackclosed'] = $review & QUIZ_REVIEW_GENERALFEEDBACK & QUIZ_REVIEW_CLOSED;
282 }
283
284 if (isset($default_values['optionflags'])){
285 $default_values['adaptive'] = $default_values['optionflags'] & QUESTION_ADAPTIVE;
286 unset($default_values['optionflags']);
287 }
ab0a8ff2 288
289 // Password field - different in form to stop browsers that remember passwords
290 // getting confused.
2ee60b49 291 if (isset($default_values['password'])) {
ab0a8ff2 292 $default_values['quizpassword'] = $default_values['password'];
293 unset($default_values['password']);
294 }
2ee60b49 295 }
a23f0aaf 296
2ee60b49 297 function validation($data){
298 $errors = array();
a23f0aaf 299 // Check open and close times are consistent.
300 if ($data['timeopen'] != 0 && $data['timeclose'] != 0 && $data['timeclose'] < $data['timeopen']) {
301 $errors['timeclose'] = get_string('closebeforeopen', 'quiz');
302 }
303
304 // Check the boundary value is a number or a percentage, and in range.
305 $i = 0;
306 while (!empty($data['feedbackboundaries'][$i] )) {
307 $boundary = trim($data['feedbackboundaries'][$i]);
308 if (strlen($boundary) > 0 && $boundary[strlen($boundary) - 1] == '%') {
309 $boundary = trim(substr($boundary, 0, -1));
310 if (is_numeric($boundary)) {
311 $boundary = $boundary * $data['grade'] / 100.0;
312 } else {
313 $errors["feedbackboundaries[$i]"] = get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
314 }
315 }
316 if (is_numeric($boundary) && $boundary <= 0 || $boundary >= $data['grade'] ) {
317 $errors["feedbackboundaries[$i]"] = get_string('feedbackerrorboundaryoutofrange', 'quiz', $i + 1);
318 }
319 if (is_numeric($boundary) && $i > 0 && $boundary >= $data['feedbackboundaries'][$i - 1]) {
320 $errors["feedbackboundaries[$i]"] = get_string('feedbackerrororder', 'quiz', $i + 1);
321 }
322 $data['feedbackboundaries'][$i] = $boundary;
323 $i += 1;
324 }
325 $numboundaries = $i;
326
327 // Check there is nothing in the remaining unused fields.
328 for ($i = $numboundaries; $i < count($data['feedbackboundaries'] ); $i += 1) {
329 if (!empty($data['feedbackboundaries'][$i] ) && trim($data['feedbackboundaries'][$i] ) != '') {
330 $errors["feedbackboundaries[$i]"] = get_string('feedbackerrorjunkinboundary', 'quiz', $i + 1);
331 }
332 }
333 for ($i = $numboundaries + 1; $i < count($data['feedbacktext'] ); $i += 1) {
334 if (!empty($data['feedbacktext'][$i] ) && trim($data['feedbacktext'][$i] ) != '') {
335 $errors["feedbacktext[$i]"] = get_string('feedbackerrorjunkinfeedback', 'quiz', $i + 1);
336 }
337 }
338 return $errors;
2ee60b49 339 }
a23f0aaf 340
341}
2ee60b49 342?>