Skip to content

Commit

Permalink
MDL-29427 quiz nav: information items should should have a state tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
timhunt committed Sep 22, 2011
1 parent dab8148 commit 79a4662
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mod/quiz/attemptlib.php
Expand Up @@ -1236,7 +1236,7 @@ public function get_question_buttons() {
if (!$showcorrectness && $button->stateclass == 'notanswered') {
$button->stateclass = 'complete';
}
$button->statestring = $qa->get_state_string($showcorrectness);
$button->statestring = $this->get_state_string($qa, $showcorrectness);
$button->currentpage = $qa->get_question()->_page == $this->page;
$button->flagged = $qa->is_flagged();
$button->url = $this->get_question_url($slot);
Expand All @@ -1246,6 +1246,19 @@ public function get_question_buttons() {
return $buttons;
}

protected function get_state_string(question_attempt $qa, $showcorrectness) {
if ($qa->get_question()->length > 0) {
return $qa->get_state_string($showcorrectness);
}

// Special case handling for 'information' items.
if ($qa->get_state() == question_state::$todo) {
return get_string('notyetviewed', 'quiz');
} else {
return get_string('viewed', 'quiz');
}
}

public function render_before_button_bits(mod_quiz_renderer $output) {
return '';
}
Expand Down
2 changes: 2 additions & 0 deletions mod/quiz/lang/en/quiz.php
Expand Up @@ -453,6 +453,7 @@
$string['notenoughsubquestions'] = 'Not enough sub-questions have been defined!<br />Do you want to go back and fix this question?';
$string['notimedependentitems'] = 'Time dependent items are not currently supported by the quiz module. As a work around, set a time limit for the whole quiz. Do you wish to choose a different item (or use the current item regardless)?';
$string['notyetgraded'] = 'Not yet graded';
$string['notyetviewed'] = 'Not yet viewed';
$string['notyourattempt'] = 'This is not your attempt!';
$string['noview'] = 'Logged-in user is not allowed to view this quiz';
$string['numattempts'] = '{$a->studentnum} {$a->studentstring} have made {$a->attemptnum} attempts';
Expand Down Expand Up @@ -775,6 +776,7 @@
$string['validate'] = 'Validate';
$string['viewallanswers'] = 'View {$a} quiz attempts';
$string['viewallreports'] = 'View reports for {$a} attempts';
$string['viewed'] = 'Viewed';
$string['warningmissingtype'] = '<b>This question is of a type that has not been installed on your Moodle yet.<br />Please alert your Moodle administrator.</b>';
$string['wheregrade'] = 'Where\'s my grade?';
$string['wildcard'] = 'Wild card';
Expand Down

0 comments on commit 79a4662

Please sign in to comment.