MDL-72010 quiz: prevent session timeouts during attempts

This commit is contained in:
Tim Hunt 2021-06-24 11:42:33 +01:00
parent 338b60f43b
commit 8f20d1627b
2 changed files with 3 additions and 0 deletions

View File

@ -116,6 +116,7 @@ if (!$attemptobj->set_currentpage($page)) {
// Initialise the JavaScript.
$headtags = $attemptobj->get_html_head_contributions($page);
$PAGE->requires->js_init_call('M.mod_quiz.init_attempt_form', null, false, quiz_get_js_module());
\core\session\manager::keepalive(); // Try to prevent sessions expiring during quiz attempts.
// Arrange for the navigation to be displayed in the first region on the page.
$navbc = $attemptobj->get_navigation_panel($output, 'quiz_attempt_nav_panel', $page);

View File

@ -79,6 +79,8 @@ if ($attemptobj->is_finished()) {
redirect($attemptobj->review_url());
}
\core\session\manager::keepalive(); // Try to prevent sessions expiring during quiz attempts.
// Arrange for the navigation to be displayed.
if (empty($attemptobj->get_quiz()->showblocks)) {
$PAGE->blocks->show_only_fake_blocks();