Skip to content

Commit

Permalink
MDL-34257 quiz 'secure' mode: PAGE initialisation order issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt authored and Aparup Banerjee committed Sep 4, 2012
1 parent 8f8e28c commit 0e708c3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions mod/quiz/attempt.php
Expand Up @@ -76,8 +76,9 @@


// Check the access rules. // Check the access rules.
$accessmanager = $attemptobj->get_access_manager(time()); $accessmanager = $attemptobj->get_access_manager(time());
$messages = $accessmanager->prevent_access(); $accessmanager->setup_attempt_page($PAGE);
$output = $PAGE->get_renderer('mod_quiz'); $output = $PAGE->get_renderer('mod_quiz');
$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) { if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $attemptobj->view_url(), print_error('attempterror', 'quiz', $attemptobj->view_url(),
$output->access_messages($messages)); $output->access_messages($messages));
Expand Down Expand Up @@ -120,7 +121,6 @@
$headtags = $attemptobj->get_html_head_contributions($page); $headtags = $attemptobj->get_html_head_contributions($page);
$PAGE->set_title(format_string($attemptobj->get_quiz_name())); $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname); $PAGE->set_heading($attemptobj->get_course()->fullname);
$accessmanager->setup_attempt_page($PAGE);


if ($attemptobj->is_last_page($page)) { if ($attemptobj->is_last_page($page)) {
$nextpage = -1; $nextpage = -1;
Expand Down
3 changes: 2 additions & 1 deletion mod/quiz/review.php
Expand Up @@ -52,6 +52,8 @@


// Create an object to manage all the other (non-roles) access rules. // Create an object to manage all the other (non-roles) access rules.
$accessmanager = $attemptobj->get_access_manager(time()); $accessmanager = $attemptobj->get_access_manager(time());
$accessmanager->setup_attempt_page($PAGE);

$options = $attemptobj->get_display_options(true); $options = $attemptobj->get_display_options(true);


// Check permissions. // Check permissions.
Expand Down Expand Up @@ -103,7 +105,6 @@
$headtags = $attemptobj->get_html_head_contributions($page, $showall); $headtags = $attemptobj->get_html_head_contributions($page, $showall);
$PAGE->set_title(format_string($attemptobj->get_quiz_name())); $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname); $PAGE->set_heading($attemptobj->get_course()->fullname);
$accessmanager->setup_attempt_page($PAGE);


// Summary table start. ============================================================================ // Summary table start. ============================================================================


Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/summary.php
Expand Up @@ -52,8 +52,9 @@


// Check access. // Check access.
$accessmanager = $attemptobj->get_access_manager(time()); $accessmanager = $attemptobj->get_access_manager(time());
$messages = $accessmanager->prevent_access(); $accessmanager->setup_attempt_page($PAGE);
$output = $PAGE->get_renderer('mod_quiz'); $output = $PAGE->get_renderer('mod_quiz');
$messages = $accessmanager->prevent_access();
if (!$attemptobj->is_preview_user() && $messages) { if (!$attemptobj->is_preview_user() && $messages) {
print_error('attempterror', 'quiz', $attemptobj->view_url(), print_error('attempterror', 'quiz', $attemptobj->view_url(),
$output->access_messages($messages)); $output->access_messages($messages));
Expand Down Expand Up @@ -89,7 +90,6 @@
$PAGE->navbar->add(get_string('summaryofattempt', 'quiz')); $PAGE->navbar->add(get_string('summaryofattempt', 'quiz'));
$PAGE->set_title(format_string($attemptobj->get_quiz_name())); $PAGE->set_title(format_string($attemptobj->get_quiz_name()));
$PAGE->set_heading($attemptobj->get_course()->fullname); $PAGE->set_heading($attemptobj->get_course()->fullname);
$accessmanager->setup_attempt_page($PAGE);


// Display the page. // Display the page.
echo $output->summary_page($attemptobj, $displayoptions); echo $output->summary_page($attemptobj, $displayoptions);
3 changes: 2 additions & 1 deletion theme/base/config.php
Expand Up @@ -162,7 +162,8 @@
// The pagelayout used for safebrowser and securewindow. // The pagelayout used for safebrowser and securewindow.
'secure' => array( 'secure' => array(
'file' => 'general.php', 'file' => 'general.php',
'regions' => array(), 'regions' => array('side-pre'),
'defaultregion' => 'side-pre',
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologinlinks'=>true), 'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nologinlinks'=>true),
), ),
); );
Expand Down

0 comments on commit 0e708c3

Please sign in to comment.