MDL-26523 grade: fixed a called to addHelpButton() that was asking for a non-existent...
[moodle.git] / mod / quiz / grade.php
blobdd2b22cbebc7c120060a2ae351eacc59b23b7e65
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.
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/>.
17 /**
18 * This page is the entry page into the quiz UI. Displays information about the
19 * quiz to students and teachers, and lets students see their previous attempts.
21 * @package mod
22 * @subpackage quiz
23 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28 require_once(dirname(__FILE__) . '/../../config.php');
29 require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php');
32 $id = required_param('id', PARAM_INT);
34 if (!$cm = get_coursemodule_from_id('quiz', $id)) {
35 print_error('invalidcoursemodule');
37 if (!$quiz = $DB->get_record('quiz', array('id' => $cm->instance))) {
38 print_error('invalidquizid');
40 if (!$course = $DB->get_record('course', array('id' => $quiz->course))) {
41 print_error('coursemisconf');
44 require_login($course, false, $cm);
46 $reportlist = quiz_report_list(get_context_instance(CONTEXT_MODULE, $cm->id));
47 if (!empty($reportlist)) {
48 redirect(new moodle_url('/mod/quiz/report.php', array(
49 'id' => $cm->id, 'mode' => reset($reportlist))));
50 } else {
51 redirect(new moodle_url('/mod/quiz/view.php', array('id' => $cm->id)));