mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
28 lines
722 B
PHP
28 lines
722 B
PHP
<?php
|
|
|
|
require_once("../../config.php");
|
|
|
|
$id = required_param('id', PARAM_INT); // Course module ID
|
|
|
|
if (! $cm = get_coursemodule_from_id('quiz', $id)) {
|
|
print_error('invalidcoursemodule');
|
|
}
|
|
|
|
if (! $quiz = $DB->get_record('quiz', array('id' => $cm->instance))) {
|
|
print_error('invalidquizid');
|
|
}
|
|
|
|
if (! $course = $DB->get_record('course', array('id' => $quiz->course))) {
|
|
print_error('coursemisconf');
|
|
}
|
|
|
|
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);
|
|
}
|
|
|
|
|