function question_get_feedback_image in Quiz 6.5
Same name and namespace in other branches
- 6.6 includes/moodle/lib/questionlib.php \question_get_feedback_image()
Returns the html for question feedback image.
Parameters
float $fraction value representing the correctness of the user's: response to a question.
boolean $selected whether or not the answer is the one that the: user picked.
Return value
string
File
- includes/
moodle/ lib/ questionlib.php, line 1118
Code
function question_get_feedback_image($fraction, $selected = true) {
global $CFG;
if ($fraction >= 1.0) {
if ($selected) {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/tick_green_big.gif" ' . 'alt="' . get_string('correct', 'quiz') . '" class="icon" />';
}
else {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/tick_green_small.gif" ' . 'alt="' . get_string('correct', 'quiz') . '" class="icon" />';
}
}
else {
if ($fraction > 0.0 && $fraction < 1.0) {
if ($selected) {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/tick_amber_big.gif" ' . 'alt="' . get_string('partiallycorrect', 'quiz') . '" class="icon" />';
}
else {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/tick_amber_small.gif" ' . 'alt="' . get_string('partiallycorrect', 'quiz') . '" class="icon" />';
}
}
else {
if ($selected) {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/cross_red_big.gif" ' . 'alt="' . get_string('incorrect', 'quiz') . '" class="icon" />';
}
else {
$feedbackimg = '<img src="' . $CFG->pixpath . '/i/cross_red_small.gif" ' . 'alt="' . get_string('incorrect', 'quiz') . '" class="icon" />';
}
}
}
return $feedbackimg;
}