mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-48829' of git://github.com/timhunt/moodle
This commit is contained in:
commit
cde9fece2f
@ -1683,12 +1683,21 @@ class quiz_attempt {
|
||||
* @since Moodle 2.1
|
||||
*/
|
||||
class quiz_nav_question_button implements renderable {
|
||||
/** @var string id="..." to add to the HTML for this button. */
|
||||
public $id;
|
||||
/** @var string number to display in this button. Either the question number of 'i'. */
|
||||
public $number;
|
||||
/** @var string class to add to the class="" attribute to represnt the question state. */
|
||||
public $stateclass;
|
||||
/** @var string Textual description of the question state, e.g. to use as a tool tip. */
|
||||
public $statestring;
|
||||
/** @var int the page number this question is on. */
|
||||
public $page;
|
||||
/** @var bool true if this question is on the current page. */
|
||||
public $currentpage;
|
||||
/** @var bool true if this question has been flagged. */
|
||||
public $flagged;
|
||||
/** @var moodle_url the link this button goes to, or null if there should not be a link. */
|
||||
public $url;
|
||||
}
|
||||
|
||||
@ -1734,7 +1743,8 @@ abstract class quiz_nav_panel_base {
|
||||
$button->stateclass = 'complete';
|
||||
}
|
||||
$button->statestring = $this->get_state_string($qa, $showcorrectness);
|
||||
$button->currentpage = $this->showall || $this->attemptobj->get_question_page($slot) == $this->page;
|
||||
$button->page = $this->attemptobj->get_question_page($slot);
|
||||
$button->currentpage = $this->showall || $button->page == $this->page;
|
||||
$button->flagged = $qa->is_flagged();
|
||||
$button->url = $this->get_question_url($slot);
|
||||
$buttons[] = $button;
|
||||
|
@ -335,11 +335,11 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
protected function render_quiz_nav_question_button(quiz_nav_question_button $button) {
|
||||
$classes = array('qnbutton', $button->stateclass, $button->navmethod);
|
||||
$attributes = array();
|
||||
$extrainfo = array();
|
||||
|
||||
if ($button->currentpage) {
|
||||
$classes[] = 'thispage';
|
||||
$attributes[] = get_string('onthispage', 'quiz');
|
||||
$extrainfo[] = get_string('onthispage', 'quiz');
|
||||
}
|
||||
|
||||
// Flagged?
|
||||
@ -349,7 +349,7 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$flaglabel = '';
|
||||
}
|
||||
$attributes[] = html_writer::tag('span', $flaglabel, array('class' => 'flagstate'));
|
||||
$extrainfo[] = html_writer::tag('span', $flaglabel, array('class' => 'flagstate'));
|
||||
|
||||
if (is_numeric($button->number)) {
|
||||
$qnostring = 'questionnonav';
|
||||
@ -359,12 +359,12 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
|
||||
$a = new stdClass();
|
||||
$a->number = $button->number;
|
||||
$a->attributes = implode(' ', $attributes);
|
||||
$a->attributes = implode(' ', $extrainfo);
|
||||
$tagcontents = html_writer::tag('span', '', array('class' => 'thispageholder')) .
|
||||
html_writer::tag('span', '', array('class' => 'trafficlight')) .
|
||||
get_string($qnostring, 'quiz', $a);
|
||||
$tagattributes = array('class' => implode(' ', $classes), 'id' => $button->id,
|
||||
'title' => $button->statestring);
|
||||
'title' => $button->statestring, 'data-quiz-page' => $button->page);
|
||||
|
||||
if ($button->url) {
|
||||
return html_writer::link($button->url, $tagcontents, $tagattributes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user