MDL-52738 quiz: fix handling of showall by review prev link

This commit is contained in:
Tim Hunt
2016-01-20 11:42:06 +00:00
parent d60bf9f1dd
commit 190fbfb60d
3 changed files with 20 additions and 4 deletions
+8 -4
View File
@@ -56,7 +56,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
$this->questions($attemptobj, true, $slots, $page, $showall, $displayoptions),
$attemptobj);
$output .= $this->review_next_navigation($attemptobj, $page, $lastpage);
$output .= $this->review_next_navigation($attemptobj, $page, $lastpage, $showall);
$output .= $this->footer();
return $output;
}
@@ -256,18 +256,22 @@ class mod_quiz_renderer extends plugin_renderer_base {
* @param quiz_attempt $attemptobj instance of quiz_attempt
* @param int $page the current page
* @param bool $lastpage if true current page is the last page
* @param bool|null $showall if true, the URL will be to review the entire attempt on one page,
* and $page will be ignored. If null, a sensible default will be chosen.
*
* @return string HTML fragment.
*/
public function review_next_navigation(quiz_attempt $attemptobj, $page, $lastpage) {
public function review_next_navigation(quiz_attempt $attemptobj, $page, $lastpage, $showall = null) {
$nav = '';
if ($page > 0) {
$nav .= link_arrow_left(get_string('navigateprevious', 'quiz'),
$attemptobj->review_url(null, $page - 1), false, 'mod_quiz-prev-nav');
$attemptobj->review_url(null, $page - 1, $showall), false, 'mod_quiz-prev-nav');
}
if ($lastpage) {
$nav .= $this->finish_review_link($attemptobj);
} else {
$nav .= link_arrow_right(get_string('navigatenext', 'quiz'),
$attemptobj->review_url(null, $page + 1), false, 'mod_quiz-next-nav');
$attemptobj->review_url(null, $page + 1, $showall), false, 'mod_quiz-next-nav');
}
return html_writer::tag('div', $nav, array('class' => 'submitbtns'));
}
@@ -115,20 +115,29 @@ Feature: Attemp a quiz where some questions require that the previous question h
And I follow "Quiz 1"
And I press "Attempt quiz now"
Then I should see "Text of the first question"
And I should not see "Text of the second question"
And I press "Next page"
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I click on "Finish attempt ..." "button" in the "region-main" "region"
And I should see "Summary of attempt"
And I press "Return to attempt"
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I press "Previous page"
And I should see "Text of the first question"
And I should not see "Text of the second question"
And I follow "Finish attempt ..."
And I press "Submit all and finish"
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
And I should see "Text of the first question"
And I should see "Text of the second question"
And I follow "Show one page at a time"
And I should see "Text of the first question"
And I should not see "Text of the second question"
And I follow "Next page"
And I should see "Text of the second question"
And I should not see "Text of the first question"
And I follow "Previous page"
And I should see "Text of the first question"
And I should not see "Text of the second question"
+3
View File
@@ -12,6 +12,9 @@ This files describes API changes in the quiz code.
* The third argument to mod_quiz_renderer::start_attempt_button has been changed
from a warning string to a mod_quiz_preflight_check_form.
* mod_quiz_renderer::review_next_navigation has a new optional argument. If you
have overridden that method, consider updating your code to match.
=== 2.9 ===