Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / mod / quiz / grade.php
blob04e802344652cd1268013a9848c941759fbe60b5
1 <?php // $Id$
3 require_once("../../config.php");
5 $id = required_param('id', PARAM_INT); // Course module ID
7 if (! $cm = get_coursemodule_from_id('quiz', $id)) {
8 error('Course Module ID was incorrect');
11 if (! $quiz = get_record('quiz', 'id', $cm->instance)) {
12 error('quiz ID was incorrect');
15 if (! $course = get_record('course', 'id', $quiz->course)) {
16 error('Course is misconfigured');
19 require_login($course->id, false, $cm);
21 if (has_capability('mod/quiz:viewreports', get_context_instance(CONTEXT_MODULE, $cm->id))) {
22 redirect('report.php?id='.$cm->id);
23 } else {
24 redirect('view.php?id='.$cm->id);