2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Defines the quiz module ettings form.
22 * @copyright 2006 Jamie Pratt
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') || die();
29 require_once($CFG->dirroot . '/course/moodleform_mod.php');
30 require_once($CFG->dirroot . '/mod/quiz/locallib.php');
34 * Settings form for the quiz module.
36 * @copyright 2006 Jamie Pratt
37 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39 class mod_quiz_mod_form extends moodleform_mod {
40 protected $_feedbacks;
41 protected static $reviewfields = array(); // Initialised in the constructor.
43 public function __construct($current, $section, $cm, $course) {
44 self::$reviewfields = array(
45 'attempt' => array('theattempt', 'quiz'),
46 'correctness' => array('whethercorrect', 'question'),
47 'marks' => array('marks', 'quiz'),
48 'specificfeedback' => array('specificfeedback', 'question'),
49 'generalfeedback' => array('generalfeedback', 'question'),
50 'rightanswer' => array('rightanswer', 'question'),
51 'overallfeedback' => array('reviewoverallfeedback', 'quiz'),
53 parent::__construct($current, $section, $cm, $course);
56 protected function definition() {
57 global $COURSE, $CFG, $DB, $PAGE;
58 $quizconfig = get_config('quiz');
59 $mform = $this->_form;
61 // -------------------------------------------------------------------------------
62 $mform->addElement('header', 'general', get_string('general', 'form'));
65 $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
66 if (!empty($CFG->formatstringstriptags)) {
67 $mform->setType('name', PARAM_TEXT);
69 $mform->setType('name', PARAM_CLEANHTML);
71 $mform->addRule('name', null, 'required', null, 'client');
74 $this->add_intro_editor(false, get_string('introduction', 'quiz'));
76 // -------------------------------------------------------------------------------
77 $mform->addElement('header', 'timing', get_string('timing', 'quiz'));
79 // Open and close dates.
80 $mform->addElement('date_time_selector', 'timeopen', get_string('quizopen', 'quiz'),
81 array('optional' => true, 'step' => 1));
82 $mform->addHelpButton('timeopen', 'quizopenclose', 'quiz');
84 $mform->addElement('date_time_selector', 'timeclose', get_string('quizclose', 'quiz'),
85 array('optional' => true, 'step' => 1));
88 $mform->addElement('duration', 'timelimit', get_string('timelimit', 'quiz'),
89 array('optional' => true));
90 $mform->addHelpButton('timelimit', 'timelimit', 'quiz');
91 $mform->setAdvanced('timelimit', $quizconfig->timelimit_adv);
92 $mform->setDefault('timelimit', $quizconfig->timelimit);
94 // What to do with overdue attempts.
95 $mform->addElement('select', 'overduehandling', get_string('overduehandling', 'quiz'),
96 quiz_get_overdue_handling_options());
97 $mform->setAdvanced('overduehandling', $quizconfig->overduehandling_adv);
98 $mform->setDefault('overduehandling', $quizconfig->overduehandling);
99 // TODO Formslib does OR logic on disableif, and we need AND logic here.
100 // $mform->disabledIf('overduehandling', 'timelimit', 'eq', 0);
101 // $mform->disabledIf('overduehandling', 'timeclose', 'eq', 0);
103 // Grace period time.
104 $mform->addElement('duration', 'graceperiod', get_string('graceperiod', 'quiz'),
105 array('optional' => true));
106 $mform->addHelpButton('graceperiod', 'graceperiod', 'quiz');
107 $mform->setAdvanced('graceperiod', $quizconfig->graceperiod_adv);
108 $mform->setDefault('graceperiod', $quizconfig->graceperiod);
109 $mform->disabledIf('graceperiod', 'overduehandling', 'neq', 'graceperiod');
111 // -------------------------------------------------------------------------------
113 $this->standard_grading_coursemodule_elements();
115 $mform->removeElement('grade');
116 $mform->addElement('hidden', 'grade', $quizconfig->maximumgrade);
117 $mform->setType('grade', PARAM_NUMBER);
119 // Number of attempts.
120 $attemptoptions = array('0' => get_string('unlimited'));
121 for ($i = 1; $i <= QUIZ_MAX_ATTEMPT_OPTION; $i++) {
122 $attemptoptions[$i] = $i;
124 $mform->addElement('select', 'attempts', get_string('attemptsallowed', 'quiz'),
126 $mform->setAdvanced('attempts', $quizconfig->attempts_adv);
127 $mform->setDefault('attempts', $quizconfig->attempts);
130 $mform->addElement('select', 'grademethod', get_string('grademethod', 'quiz'),
131 quiz_get_grading_options());
132 $mform->addHelpButton('grademethod', 'grademethod', 'quiz');
133 $mform->setAdvanced('grademethod', $quizconfig->grademethod_adv);
134 $mform->setDefault('grademethod', $quizconfig->grademethod);
135 $mform->disabledIf('grademethod', 'attempts', 'eq', 1);
137 // -------------------------------------------------------------------------------
138 $mform->addElement('header', 'layouthdr', get_string('layout', 'quiz'));
140 // Shuffle questions.
141 $shuffleoptions = array(
142 0 => get_string('asshownoneditscreen', 'quiz'),
143 1 => get_string('shuffledrandomly', 'quiz')
145 $mform->addElement('select', 'shufflequestions', get_string('questionorder', 'quiz'),
146 $shuffleoptions, array('id' => 'id_shufflequestions'));
147 $mform->setAdvanced('shufflequestions', $quizconfig->shufflequestions_adv);
148 $mform->setDefault('shufflequestions', $quizconfig->shufflequestions);
150 // Questions per page.
151 $pageoptions = array();
152 $pageoptions[0] = get_string('neverallononepage', 'quiz');
153 $pageoptions[1] = get_string('everyquestion', 'quiz');
154 for ($i = 2; $i <= QUIZ_MAX_QPP_OPTION; ++$i) {
155 $pageoptions[$i] = get_string('everynquestions', 'quiz', $i);
158 $pagegroup = array();
159 $pagegroup[] = $mform->createElement('select', 'questionsperpage',
160 get_string('newpage', 'quiz'), $pageoptions, array('id' => 'id_questionsperpage'));
161 $mform->setDefault('questionsperpage', $quizconfig->questionsperpage);
163 if (!empty($this->_cm)) {
164 $pagegroup[] = $mform->createElement('checkbox', 'repaginatenow', '',
165 get_string('repaginatenow', 'quiz'), array('id' => 'id_repaginatenow'));
166 $mform->disabledIf('repaginatenow', 'shufflequestions', 'eq', 1);
167 $PAGE->requires->yui2_lib('event');
168 $PAGE->requires->js('/mod/quiz/edit.js');
169 $PAGE->requires->js_init_call('quiz_settings_init');
172 $mform->addGroup($pagegroup, 'questionsperpagegrp',
173 get_string('newpage', 'quiz'), null, false);
174 $mform->addHelpButton('questionsperpagegrp', 'newpage', 'quiz');
175 $mform->setAdvanced('questionsperpagegrp', $quizconfig->questionsperpage_adv);
177 // Navigation method.
178 $mform->addElement('select', 'navmethod', get_string('navmethod', 'quiz'),
179 quiz_get_navigation_options());
180 $mform->addHelpButton('navmethod', 'navmethod', 'quiz');
181 $mform->setAdvanced('navmethod', $quizconfig->navmethod_adv);
182 $mform->setDefault('navmethod', $quizconfig->navmethod);
184 // -------------------------------------------------------------------------------
185 $mform->addElement('header', 'interactionhdr', get_string('questionbehaviour', 'quiz'));
187 // Shuffle within questions.
188 $mform->addElement('selectyesno', 'shuffleanswers', get_string('shufflewithin', 'quiz'));
189 $mform->addHelpButton('shuffleanswers', 'shufflewithin', 'quiz');
190 $mform->setAdvanced('shuffleanswers', $quizconfig->shuffleanswers_adv);
191 $mform->setDefault('shuffleanswers', $quizconfig->shuffleanswers);
193 // How questions behave (question behaviour).
194 if (!empty($this->current->preferredbehaviour)) {
195 $currentbehaviour = $this->current->preferredbehaviour;
197 $currentbehaviour = '';
199 $behaviours = question_engine::get_behaviour_options($currentbehaviour);
200 $mform->addElement('select', 'preferredbehaviour',
201 get_string('howquestionsbehave', 'question'), $behaviours);
202 $mform->addHelpButton('preferredbehaviour', 'howquestionsbehave', 'question');
203 $mform->setDefault('preferredbehaviour', $quizconfig->preferredbehaviour);
205 // Each attempt builds on last.
206 $mform->addElement('selectyesno', 'attemptonlast',
207 get_string('eachattemptbuildsonthelast', 'quiz'));
208 $mform->addHelpButton('attemptonlast', 'eachattemptbuildsonthelast', 'quiz');
209 $mform->setAdvanced('attemptonlast', $quizconfig->attemptonlast_adv);
210 $mform->setDefault('attemptonlast', $quizconfig->attemptonlast);
211 $mform->disabledIf('attemptonlast', 'attempts', 'eq', 1);
213 // -------------------------------------------------------------------------------
214 $mform->addElement('header', 'reviewoptionshdr',
215 get_string('reviewoptionsheading', 'quiz'));
216 $mform->addHelpButton('reviewoptionshdr', 'reviewoptionsheading', 'quiz');
219 $this->add_review_options_group($mform, $quizconfig, 'during',
220 mod_quiz_display_options::DURING, true);
221 $this->add_review_options_group($mform, $quizconfig, 'immediately',
222 mod_quiz_display_options::IMMEDIATELY_AFTER);
223 $this->add_review_options_group($mform, $quizconfig, 'open',
224 mod_quiz_display_options::LATER_WHILE_OPEN);
225 $this->add_review_options_group($mform, $quizconfig, 'closed',
226 mod_quiz_display_options::AFTER_CLOSE);
228 foreach ($behaviours as $behaviour => $notused) {
229 $unusedoptions = question_engine::get_behaviour_unused_display_options($behaviour);
230 foreach ($unusedoptions as $unusedoption) {
231 $mform->disabledIf($unusedoption . 'during', 'preferredbehaviour',
235 $mform->disabledIf('attemptduring', 'preferredbehaviour',
237 $mform->disabledIf('overallfeedbackduring', 'preferredbehaviour',
240 // -------------------------------------------------------------------------------
241 $mform->addElement('header', 'display', get_string('display', 'form'));
243 // Show user picture.
244 $mform->addElement('selectyesno', 'showuserpicture',
245 get_string('showuserpicture', 'quiz'));
246 $mform->addHelpButton('showuserpicture', 'showuserpicture', 'quiz');
247 $mform->setAdvanced('showuserpicture', $quizconfig->showuserpicture_adv);
248 $mform->setDefault('showuserpicture', $quizconfig->showuserpicture);
250 // Overall decimal points.
252 for ($i = 0; $i <= QUIZ_MAX_DECIMAL_OPTION; $i++) {
255 $mform->addElement('select', 'decimalpoints', get_string('decimalplaces', 'quiz'),
257 $mform->addHelpButton('decimalpoints', 'decimalplaces', 'quiz');
258 $mform->setAdvanced('decimalpoints', $quizconfig->decimalpoints_adv);
259 $mform->setDefault('decimalpoints', $quizconfig->decimalpoints);
261 // Question decimal points.
262 $options = array(-1 => get_string('sameasoverall', 'quiz'));
263 for ($i = 0; $i <= QUIZ_MAX_Q_DECIMAL_OPTION; $i++) {
266 $mform->addElement('select', 'questiondecimalpoints',
267 get_string('decimalplacesquestion', 'quiz'), $options);
268 $mform->addHelpButton('questiondecimalpoints', 'decimalplacesquestion', 'quiz');
269 $mform->setAdvanced('questiondecimalpoints', $quizconfig->questiondecimalpoints_adv);
270 $mform->setDefault('questiondecimalpoints', $quizconfig->questiondecimalpoints);
272 // Show blocks during quiz attempt.
273 $mform->addElement('selectyesno', 'showblocks', get_string('showblocks', 'quiz'));
274 $mform->addHelpButton('showblocks', 'showblocks', 'quiz');
275 $mform->setAdvanced('showblocks', $quizconfig->showblocks_adv);
276 $mform->setDefault('showblocks', $quizconfig->showblocks);
278 // -------------------------------------------------------------------------------
279 $mform->addElement('header', 'security', get_string('extraattemptrestrictions', 'quiz'));
281 // Require password to begin quiz attempt.
282 $mform->addElement('passwordunmask', 'quizpassword', get_string('requirepassword', 'quiz'));
283 $mform->setType('quizpassword', PARAM_TEXT);
284 $mform->addHelpButton('quizpassword', 'requirepassword', 'quiz');
285 $mform->setAdvanced('quizpassword', $quizconfig->password_adv);
286 $mform->setDefault('quizpassword', $quizconfig->password);
289 $mform->addElement('text', 'subnet', get_string('requiresubnet', 'quiz'));
290 $mform->setType('subnet', PARAM_TEXT);
291 $mform->addHelpButton('subnet', 'requiresubnet', 'quiz');
292 $mform->setAdvanced('subnet', $quizconfig->subnet_adv);
293 $mform->setDefault('subnet', $quizconfig->subnet);
295 // Enforced time delay between quiz attempts.
296 $mform->addElement('duration', 'delay1', get_string('delay1st2nd', 'quiz'),
297 array('optional' => true));
298 $mform->addHelpButton('delay1', 'delay1st2nd', 'quiz');
299 $mform->setAdvanced('delay1', $quizconfig->delay1_adv);
300 $mform->setDefault('delay1', $quizconfig->delay1);
301 $mform->disabledIf('delay1', 'attempts', 'eq', 1);
303 $mform->addElement('duration', 'delay2', get_string('delaylater', 'quiz'),
304 array('optional' => true));
305 $mform->addHelpButton('delay2', 'delaylater', 'quiz');
306 $mform->setAdvanced('delay2', $quizconfig->delay2_adv);
307 $mform->setDefault('delay2', $quizconfig->delay2);
308 $mform->disabledIf('delay2', 'attempts', 'eq', 1);
309 $mform->disabledIf('delay2', 'attempts', 'eq', 2);
311 // Browser security choices.
312 $mform->addElement('select', 'browsersecurity', get_string('browsersecurity', 'quiz'),
313 quiz_access_manager::get_browser_security_choices());
314 $mform->addHelpButton('browsersecurity', 'browsersecurity', 'quiz');
315 $mform->setAdvanced('browsersecurity', $quizconfig->browsersecurity_adv);
316 $mform->setDefault('browsersecurity', $quizconfig->browsersecurity);
318 // Any other rule plugins.
319 quiz_access_manager::add_settings_form_fields($this, $mform);
321 // -------------------------------------------------------------------------------
322 $mform->addElement('header', 'overallfeedbackhdr', get_string('overallfeedback', 'quiz'));
323 $mform->addHelpButton('overallfeedbackhdr', 'overallfeedback', 'quiz');
325 if (isset($this->current->grade)) {
326 $needwarning = $this->current->grade === 0;
328 $needwarning = $quizconfig->maximumgrade == 0;
331 $mform->addElement('static', 'nogradewarning', '',
332 get_string('nogradewarning', 'quiz'));
335 $mform->addElement('static', 'gradeboundarystatic1',
336 get_string('gradeboundary', 'quiz'), '100%');
338 $repeatarray = array();
339 $repeatedoptions = array();
340 $repeatarray[] = $mform->createElement('editor', 'feedbacktext',
341 get_string('feedback', 'quiz'), null, array('maxfiles' => EDITOR_UNLIMITED_FILES,
342 'noclean' => true, 'context' => $this->context));
343 $repeatarray[] = $mform->createElement('text', 'feedbackboundaries',
344 get_string('gradeboundary', 'quiz'), array('size' => 10));
345 $repeatedoptions['feedbacktext']['type'] = PARAM_RAW;
346 $repeatedoptions['feedbackboundaries']['type'] = PARAM_RAW;
348 if (!empty($this->_instance)) {
349 $this->_feedbacks = $DB->get_records('quiz_feedback',
350 array('quizid' => $this->_instance), 'mingrade DESC');
352 $this->_feedbacks = array();
354 $numfeedbacks = max(count($this->_feedbacks) * 1.5, 5);
356 $nextel = $this->repeat_elements($repeatarray, $numfeedbacks - 1,
357 $repeatedoptions, 'boundary_repeats', 'boundary_add_fields', 3,
358 get_string('addmoreoverallfeedbacks', 'quiz'), true);
360 // Put some extra elements in before the button.
361 $mform->insertElementBefore($mform->createElement('editor',
362 "feedbacktext[$nextel]", get_string('feedback', 'quiz'), null,
363 array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true,
364 'context' => $this->context)),
365 'boundary_add_fields');
366 $mform->insertElementBefore($mform->createElement('static',
367 'gradeboundarystatic2', get_string('gradeboundary', 'quiz'), '0%'),
368 'boundary_add_fields');
370 // Add the disabledif rules. We cannot do this using the $repeatoptions parameter to
371 // repeat_elements because we don't want to dissable the first feedbacktext.
372 for ($i = 0; $i < $nextel; $i++) {
373 $mform->disabledIf('feedbackboundaries[' . $i . ']', 'grade', 'eq', 0);
374 $mform->disabledIf('feedbacktext[' . ($i + 1) . ']', 'grade', 'eq', 0);
377 // -------------------------------------------------------------------------------
378 $this->standard_coursemodule_elements();
380 // -------------------------------------------------------------------------------
381 $this->add_action_buttons();
384 protected function add_review_options_group($mform, $quizconfig, $whenname,
385 $when, $withhelp = false) {
389 foreach (self::$reviewfields as $field => $string) {
390 list($identifier, $component) = $string;
392 $label = get_string($identifier, $component);
394 $label .= ' ' . $OUTPUT->help_icon($identifier, $component);
397 $group[] = $mform->createElement('checkbox', $field . $whenname, '', $label);
399 $mform->addGroup($group, $whenname . 'optionsgrp',
400 get_string('review' . $whenname, 'quiz'), null, false);
402 foreach (self::$reviewfields as $field => $notused) {
403 $cfgfield = 'review' . $field;
404 if ($quizconfig->$cfgfield & $when) {
405 $mform->setDefault($field . $whenname, 1);
407 $mform->setDefault($field . $whenname, 0);
411 $mform->disabledIf('correctness' . $whenname, 'attempt' . $whenname);
412 $mform->disabledIf('specificfeedback' . $whenname, 'attempt' . $whenname);
413 $mform->disabledIf('generalfeedback' . $whenname, 'attempt' . $whenname);
414 $mform->disabledIf('rightanswer' . $whenname, 'attempt' . $whenname);
417 protected function preprocessing_review_settings(&$toform, $whenname, $when) {
418 foreach (self::$reviewfields as $field => $notused) {
419 $fieldname = 'review' . $field;
420 if (array_key_exists($fieldname, $toform)) {
421 $toform[$field . $whenname] = $toform[$fieldname] & $when;
426 public function data_preprocessing(&$toform) {
427 if (isset($toform['grade'])) {
428 // Convert to a real number, so we don't get 0.0000.
429 $toform['grade'] = $toform['grade'] + 0;
432 if (count($this->_feedbacks)) {
434 foreach ($this->_feedbacks as $feedback) {
435 $draftid = file_get_submitted_draft_itemid('feedbacktext['.$key.']');
436 $toform['feedbacktext['.$key.']']['text'] = file_prepare_draft_area(
437 $draftid, // Draftid.
438 $this->context->id, // Context.
439 'mod_quiz', // Component.
440 'feedback', // Filarea.
441 !empty($feedback->id) ? (int) $feedback->id : null, // Itemid.
443 $feedback->feedbacktext // Text.
445 $toform['feedbacktext['.$key.']']['format'] = $feedback->feedbacktextformat;
446 $toform['feedbacktext['.$key.']']['itemid'] = $draftid;
448 if ($toform['grade'] == 0) {
449 // When a quiz is un-graded, there can only be one lot of
450 // feedback. If the quiz previously had a maximum grade and
451 // several lots of feedback, we must now avoid putting text
452 // into input boxes that are disabled, but which the
453 // validation will insist are blank.
457 if ($feedback->mingrade > 0) {
458 $toform['feedbackboundaries['.$key.']'] =
459 (100.0 * $feedback->mingrade / $toform['grade']) . '%';
465 if (isset($toform['timelimit'])) {
466 $toform['timelimitenable'] = $toform['timelimit'] > 0;
469 $this->preprocessing_review_settings($toform, 'during',
470 mod_quiz_display_options::DURING);
471 $this->preprocessing_review_settings($toform, 'immediately',
472 mod_quiz_display_options::IMMEDIATELY_AFTER);
473 $this->preprocessing_review_settings($toform, 'open',
474 mod_quiz_display_options::LATER_WHILE_OPEN);
475 $this->preprocessing_review_settings($toform, 'closed',
476 mod_quiz_display_options::AFTER_CLOSE);
477 $toform['attemptduring'] = true;
478 $toform['overallfeedbackduring'] = false;
480 // Password field - different in form to stop browsers that remember
481 // passwords from getting confused.
482 if (isset($toform['password'])) {
483 $toform['quizpassword'] = $toform['password'];
484 unset($toform['password']);
487 // Load any settings belonging to the access rules.
488 if (!empty($toform['instance'])) {
489 $accesssettings = quiz_access_manager::load_settings($toform['instance']);
490 foreach ($accesssettings as $name => $value) {
491 $toform[$name] = $value;
496 public function validation($data, $files) {
497 $errors = parent::validation($data, $files);
499 // Check open and close times are consistent.
500 if ($data['timeopen'] != 0 && $data['timeclose'] != 0 &&
501 $data['timeclose'] < $data['timeopen']) {
502 $errors['timeclose'] = get_string('closebeforeopen', 'quiz');
505 // Check that the grace period is not too short.
506 if ($data['overduehandling'] == 'graceperiod') {
507 $graceperiodmin = get_config('quiz', 'graceperiodmin');
508 if ($data['graceperiod'] <= $graceperiodmin) {
509 $errors['graceperiod'] = get_string('graceperiodtoosmall', 'quiz', format_time($graceperiodmin));
513 // Check the boundary value is a number or a percentage, and in range.
515 while (!empty($data['feedbackboundaries'][$i] )) {
516 $boundary = trim($data['feedbackboundaries'][$i]);
517 if (strlen($boundary) > 0 && $boundary[strlen($boundary) - 1] == '%') {
518 $boundary = trim(substr($boundary, 0, -1));
519 if (is_numeric($boundary)) {
520 $boundary = $boundary * $data['grade'] / 100.0;
522 $errors["feedbackboundaries[$i]"] =
523 get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
526 if (is_numeric($boundary) && $boundary <= 0 || $boundary >= $data['grade'] ) {
527 $errors["feedbackboundaries[$i]"] =
528 get_string('feedbackerrorboundaryoutofrange', 'quiz', $i + 1);
530 if (is_numeric($boundary) && $i > 0 &&
531 $boundary >= $data['feedbackboundaries'][$i - 1]) {
532 $errors["feedbackboundaries[$i]"] =
533 get_string('feedbackerrororder', 'quiz', $i + 1);
535 $data['feedbackboundaries'][$i] = $boundary;
540 // Check there is nothing in the remaining unused fields.
541 if (!empty($data['feedbackboundaries'])) {
542 for ($i = $numboundaries; $i < count($data['feedbackboundaries']); $i += 1) {
543 if (!empty($data['feedbackboundaries'][$i] ) &&
544 trim($data['feedbackboundaries'][$i] ) != '') {
545 $errors["feedbackboundaries[$i]"] =
546 get_string('feedbackerrorjunkinboundary', 'quiz', $i + 1);
550 for ($i = $numboundaries + 1; $i < count($data['feedbacktext']); $i += 1) {
551 if (!empty($data['feedbacktext'][$i]['text']) &&
552 trim($data['feedbacktext'][$i]['text'] ) != '') {
553 $errors["feedbacktext[$i]"] =
554 get_string('feedbackerrorjunkinfeedback', 'quiz', $i + 1);