Permalink
Browse files

Merge branch 'MDL-42181_24' of git://github.com/mkassaei/moodle into …

…MOODLE_24_STABLE
  • Loading branch information...
2 parents 199e644 + 00d737b commit b6ebf8d77054599957b72f61388b6d3c72095660 @danpoltawski danpoltawski committed Nov 19, 2013
Showing with 17 additions and 2 deletions.
  1. +15 −1 mod/quiz/attemptlib.php
  2. +2 −1 mod/quiz/renderer.php
@@ -1626,7 +1626,7 @@ public function get_question_buttons() {
$button->stateclass = 'complete';
}
$button->statestring = $this->get_state_string($qa, $showcorrectness);
- $button->currentpage = $this->attemptobj->get_question_page($slot) == $this->page;
+ $button->currentpage = $this->showall || $this->attemptobj->get_question_page($slot) == $this->page;
$button->flagged = $qa->is_flagged();
$button->url = $this->get_question_url($slot);
$buttons[] = $button;
@@ -1676,6 +1676,20 @@ public function user_picture() {
$userpicture->courseid = $this->attemptobj->get_courseid();
return $userpicture;
}
+
+ /**
+ * Return 'allquestionsononepage' as CSS class name when $showall is set,
+ * otherwise, return 'multipages' as CSS class name.
+ * @return string, CSS class name
+ */
+ public function get_button_container_class() {
+ // Quiz navigation is set on 'Show all questions on one page'.
+ if ($this->showall) {
+ return 'allquestionsononepage';
+ }
+ // Quiz navigation is set on 'Show one page at a time'.
+ return 'multipages';
+ }
}
@@ -311,7 +311,8 @@ public function navigation_panel(quiz_nav_panel_base $panel) {
}
$output .= $panel->render_before_button_bits($this);
- $output .= html_writer::start_tag('div', array('class' => 'qn_buttons'));
+ $bcc = $panel->get_button_container_class();
+ $output .= html_writer::start_tag('div', array('class' => "qn_buttons $bcc"));
foreach ($panel->get_question_buttons() as $button) {
$output .= $this->render($button);
}

0 comments on commit b6ebf8d

Please sign in to comment.