Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-34257 quiz 'secure' mode: PAGE initialisation order issues.

  • Loading branch information...
commit e65f54f289f8debb5e78d59cd20b949b239351fd 1 parent c5575c6
@timhunt timhunt authored
View
4 mod/quiz/attempt.php
@@ -75,8 +75,9 @@
// Check the access rules.
$accessmanager = $attemptobj->get_access_manager(time());
-$messages = $accessmanager->prevent_access();
+$accessmanager->setup_attempt_page($PAGE);
$output = $PAGE->get_renderer('mod_quiz');
+$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $attemptobj->view_url(),
$output->access_messages($messages));
@@ -110,7 +111,6 @@
$headtags = $attemptobj->get_html_head_contributions($page);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname);
-$accessmanager->setup_attempt_page($PAGE);
if ($attemptobj->is_last_page($page)) {
$nextpage = -1;
View
3  mod/quiz/review.php
@@ -53,6 +53,8 @@
// Create an object to manage all the other (non-roles) access rules.
$accessmanager = $attemptobj->get_access_manager(time());
+$accessmanager->setup_attempt_page($PAGE);
+
$options = $attemptobj->get_display_options(true);
// Check permissions.
@@ -104,7 +106,6 @@
$headtags = $attemptobj->get_html_head_contributions($page, $showall);
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname);
-$accessmanager->setup_attempt_page($PAGE);
// Summary table start ============================================================================
View
4 mod/quiz/summary.php
@@ -57,8 +57,9 @@
// Check access.
$accessmanager = $attemptobj->get_access_manager(time());
-$messages = $accessmanager->prevent_access();
+$accessmanager->setup_attempt_page($PAGE);
$output = $PAGE->get_renderer('mod_quiz');
+$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $attemptobj->view_url(),
$output->access_messages($messages));
@@ -86,7 +87,6 @@
$PAGE->navbar->add(get_string('summaryofattempt', 'quiz'));
$PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname);
-$accessmanager->setup_attempt_page($PAGE);
// Display the page.
Please sign in to comment.
Something went wrong with that request. Please try again.