quiz: Check this is the users own attempt before sending them to the attempt.php page.

This commit is contained in:
tjhunt 2009-07-22 09:25:46 +00:00
parent 1ddfb914fd
commit 82fd2e8bfb

View File

@ -27,14 +27,14 @@
/// Permissions checks for normal users who do not have quiz:viewreports capability.
if (!$attemptobj->has_capability('mod/quiz:viewreports')) {
/// Can't review other users' attempts.
if (!$attemptobj->is_own_attempt()) {
quiz_error($attemptobj->get_quiz(), 'notyourattempt');
}
/// Can't review during the attempt - send them back to the attempt page.
if (!$attemptobj->is_finished()) {
redirect($attemptobj->attempt_url(0, $page));
}
/// Can't review other users' attempts.
if (!$attemptobj->is_own_attempt()) {
quiz_error($quiz, 'notyourattempt');
}
/// Can't review unless Students may review -> Responses option is turned on.
if (!$options->responses) {
$accessmanager->back_to_view_page($attemptobj->is_preview_user(),
@ -99,7 +99,6 @@
}
/// Print heading.
print_heading(format_string($attemptobj->get_quiz_name()));
if ($attemptobj->is_preview_user() && $attemptobj->is_own_attempt()) {
$attemptobj->print_restart_preview_button();
}