mirror of
https://github.com/moodle/moodle.git
synced 2025-03-18 22:50:19 +01:00
MDL-36916 quiz/questions: simplify code after MDL-36638.
This commit is contained in:
parent
e4d7ec6b3b
commit
6e4a2acf93
@ -272,16 +272,8 @@ abstract class quiz_attempts_report_table extends table_sql {
|
||||
protected function icon_for_fraction($fraction) {
|
||||
global $OUTPUT;
|
||||
|
||||
$state = question_state::graded_state_for_fraction($fraction);
|
||||
if ($state == question_state::$gradedright) {
|
||||
$icon = 'i/grade_correct';
|
||||
} else if ($state == question_state::$gradedpartial) {
|
||||
$icon = 'i/grade_partiallycorrect';
|
||||
} else {
|
||||
$icon = 'i/grade_incorrect';
|
||||
}
|
||||
|
||||
return $OUTPUT->pix_icon($icon, get_string($state->get_feedback_class(), 'question'),
|
||||
$feedbackclass = question_state::graded_state_for_fraction($fraction)->get_feedback_class();
|
||||
return $OUTPUT->pix_icon('i/grade_' . $feedbackclass, get_string($feedbackclass, 'question'),
|
||||
'moodle', array('class' => 'icon'));
|
||||
}
|
||||
|
||||
|
@ -226,19 +226,11 @@ abstract class qtype_renderer extends plugin_renderer_base {
|
||||
* @return string html fragment.
|
||||
*/
|
||||
protected function feedback_image($fraction, $selected = true) {
|
||||
$state = question_state::graded_state_for_fraction($fraction);
|
||||
|
||||
if ($state == question_state::$gradedright) {
|
||||
$icon = 'grade_correct';
|
||||
} else if ($state == question_state::$gradedpartial) {
|
||||
$icon = 'grade_partiallycorrect';
|
||||
} else {
|
||||
$icon = 'grade_incorrect';
|
||||
}
|
||||
$feedbackclass = question_state::graded_state_for_fraction($fraction)->get_feedback_class();
|
||||
|
||||
$attributes = array(
|
||||
'src' => $this->output->pix_url('i/' . $icon),
|
||||
'alt' => get_string($state->get_feedback_class(), 'question'),
|
||||
'src' => $this->output->pix_url('i/grade_' . $feedbackclass),
|
||||
'alt' => get_string($feedbackclass, 'question'),
|
||||
'class' => 'questioncorrectnessicon',
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user