public function ShortAnswerResponse::getFeedbackValues in Quiz 7.5
Same name and namespace in other branches
- 7.6 question_types/short_answer/short_answer.classes.inc \ShortAnswerResponse::getFeedbackValues()
Implementation of getFeedbackValues().
Overrides QuizQuestionResponse::getFeedbackValues
See also
QuizQuestionResponse::getFeedbackValues()
File
- question_types/
short_answer/ short_answer.classes.inc, line 384 - Short answer classes.
Class
- ShortAnswerResponse
- Extension of QuizQuestionResponse.
Code
public function getFeedbackValues() {
$data = array();
$score = $this
->score();
$max = $this
->getMaxScore(FALSE);
if ($this->evaluated) {
// Question has been graded.
if ($score == 0) {
$icon = quiz_icon('incorrect');
}
if ($score > 0) {
$icon = quiz_icon('almost');
}
if ($score == $max) {
$icon = quiz_icon('correct');
}
}
else {
$icon = quiz_icon('unknown');
}
$data[] = array(
// Hide this column. Does not make sense for short answer as there are no
// choices.
'choice' => NULL,
'attempt' => $this->answer,
'correct' => $icon,
'score' => !$this->evaluated ? t('This answer has not yet been scored.') : $this
->getScore(),
'answer_feedback' => check_markup($this->answer_feedback, $this->answer_feedback_format),
'solution' => $this->question->correct_answer,
);
return $data;
}