instance)) { error('quiz ID was incorrect'); } if (! $course = get_record('course', 'id', $quiz->course)) { error('Course is misconfigured'); } require_login($course->id, false, $cm); if (has_capability('mod/quiz:viewreports', get_context_instance(CONTEXT_MODULE, $cm->id))) { redirect('report.php?id='.$cm->id); } else { redirect('view.php?id='.$cm->id); } ?>