MDL-42181 quiz nav: highight all buttons when all Qs on one page

This commit is contained in:
M Kassaei 2013-10-17 14:46:58 +01:00
parent 5e6da548d7
commit 0328341f97
2 changed files with 17 additions and 2 deletions

View File

@ -1664,7 +1664,7 @@ abstract class quiz_nav_panel_base {
$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;
@ -1715,6 +1715,20 @@ abstract class quiz_nav_panel_base {
}
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';
}
}

View File

@ -313,7 +313,8 @@ class mod_quiz_renderer extends plugin_renderer_base {
}
$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);
}