protected function other_attempt_fields(MoodleQuickForm $mform) { parent::other_attempt_fields($mform); if (quiz_allows_multiple_tries($this->_customdata['quiz'])) { $mform->addElement('select', 'whichtries', get_string('whichtries', 'question'), array(question_attempt::FIRST_TRY => get_string('firsttry', 'question'), question_attempt::LAST_TRY => get_string('lasttry', 'question'), question_attempt::ALL_TRIES => get_string('alltries', 'question'))); $mform->setDefault('whichtries', question_attempt::LAST_TRY); } }
public function validation($data, $files) { $errors = parent::validation($data, $files); if ($data['attempts'] != quiz_attempts_report::ENROLLED_WITHOUT && !($data['qtext'] || $data['resp'] || $data['right'])) { $errors['coloptions'] = get_string('reportmustselectstate', 'quiz'); } return $errors; }