See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 402] [Versions 39 and 403]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 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. 8 // 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. 13 // 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/>. 16 17 /** 18 * This file defines the setting form for the quiz responses report. 19 * 20 * @package quiz_responses 21 * @copyright 2008 Jean-Michel Vedrine 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 26 defined('MOODLE_INTERNAL') || die(); 27 28 require_once($CFG->dirroot . '/mod/quiz/report/attemptsreport_form.php'); 29 30 31 /** 32 * Quiz responses report settings form. 33 * 34 * @copyright 2008 Jean-Michel Vedrine 35 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 36 */ 37 class quiz_responses_settings_form extends mod_quiz_attempts_report_form { 38 39 protected function other_preference_fields(MoodleQuickForm $mform) { 40 $mform->addGroup(array( 41 $mform->createElement('advcheckbox', 'qtext', '', 42 get_string('questiontext', 'quiz_responses')), 43 $mform->createElement('advcheckbox', 'resp', '', 44 get_string('response', 'quiz_responses')), 45 $mform->createElement('advcheckbox', 'right', '', 46 get_string('rightanswer', 'quiz_responses')), 47 ), 'coloptions', get_string('showthe', 'quiz_responses'), array(' '), false); 48 $mform->disabledIf('qtext', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT); 49 $mform->disabledIf('resp', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT); 50 $mform->disabledIf('right', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT); 51 } 52 53 public function validation($data, $files) { 54 $errors = parent::validation($data, $files); 55 56 if ($data['attempts'] != quiz_attempts_report::ENROLLED_WITHOUT && !( 57 $data['qtext'] || $data['resp'] || $data['right'])) { 58 $errors['coloptions'] = get_string('reportmustselectstate', 'quiz'); 59 } 60 61 return $errors; 62 } 63 64 protected function other_attempt_fields(MoodleQuickForm $mform) { 65 parent::other_attempt_fields($mform); 66 if (quiz_allows_multiple_tries($this->_customdata['quiz'])) { 67 $mform->addElement('select', 'whichtries', get_string('whichtries', 'question'), array( 68 question_attempt::FIRST_TRY => get_string('firsttry', 'question'), 69 question_attempt::LAST_TRY => get_string('lasttry', 'question'), 70 question_attempt::ALL_TRIES => get_string('alltries', 'question')) 71 ); 72 $mform->setDefault('whichtries', question_attempt::LAST_TRY); 73 $mform->disabledIf('whichtries', 'attempts', 'eq', quiz_attempts_report::ENROLLED_WITHOUT); 74 } 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body