Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-36897 quiz: redirect teachers from summary to review page.

There is already logic like this at the top of attempt.php. If the
teacher arrives at one of these pages for a student's attempt, for
example by clicking a link in the logs, then they should be redirected
to the review page to see the students attempt in its current state.
  • Loading branch information...
commit 7192907607c318ceb1e4da2ded5ad803c282183c 1 parent 15b3a43
@timhunt timhunt authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 mod/quiz/summary.php
View
8 mod/quiz/summary.php
@@ -36,9 +36,13 @@
// 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.
Please sign in to comment.
Something went wrong with that request. Please try again.