Merge branch 'MDL-36897_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE

This commit is contained in:
Dan Poltawski
2012-12-11 13:54:23 +08:00
+6 -2
View File
@@ -36,9 +36,13 @@ $attemptobj = quiz_attempt::create($attemptid);
// Check login.
require_login($attemptobj->get_course(), false, $attemptobj->get_cm());
// If this is not our own attempt, display an error.
// Check that this attempt belongs to this user.
if ($attemptobj->get_userid() != $USER->id) {
print_error('notyourattempt', 'quiz', $attemptobj->view_url());
if ($attemptobj->has_capability('mod/quiz:viewreports')) {
redirect($attemptobj->review_url(null, $page));
} else {
throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'notyourattempt');
}
}
// Check capabilites.