MDL-46093 quiz review should default to showing everything on one page

... as long as the quiz is not too big. At the moment, that limit is
set to 50 questions.
This commit is contained in:
Tim Hunt 2014-06-22 11:03:03 +01:00
parent 7a4832ecb9
commit 097dbfe11a
3 changed files with 337 additions and 19 deletions

View file

@ -32,13 +32,12 @@ require_once($CFG->dirroot . '/mod/quiz/report/reportlib.php');
$attemptid = required_param('attempt', PARAM_INT);
$page = optional_param('page', 0, PARAM_INT);
$showall = optional_param('showall', 0, PARAM_BOOL);
$showall = optional_param('showall', null, PARAM_BOOL);
$url = new moodle_url('/mod/quiz/review.php', array('attempt'=>$attemptid));
if ($page !== 0) {
$url->param('page', $page);
}
if ($showall !== 0) {
} else if ($showall) {
$url->param('showall', $showall);
}
$PAGE->set_url($url);
@ -46,6 +45,12 @@ $PAGE->set_url($url);
$attemptobj = quiz_attempt::create($attemptid);
$page = $attemptobj->force_page_number_into_range($page);
// Now we can validate the params better, re-genrate the page URL.
if ($showall === null) {
$showall = $page == 0 && $attemptobj->get_default_show_all('review');
}
$PAGE->set_url($attemptobj->review_url(null, $page, $showall));
// Check login.
require_login($attemptobj->get_course(), false, $attemptobj->get_cm());
$attemptobj->check_review_capability();