public function MultichoiceResponse::getFeedbackValues in Quiz 7.6
Same name and namespace in other branches
- 7.5 question_types/multichoice/multichoice.classes.inc \MultichoiceResponse::getFeedbackValues()
Implementation of getReportFormResponse
Overrides QuizQuestionResponse::getFeedbackValues
File
- question_types/
multichoice/ multichoice.classes.inc, line 965 - The main classes for the multichoice question type.
Class
- MultichoiceResponse
- Extension of QuizQuestionResponse
Code
public function getFeedbackValues() {
$this
->orderAlternatives($this->question->alternatives);
$simple_scoring = $this->question->choice_boolean;
$data = array();
foreach ($this->question->alternatives as $alternative) {
$chosen = in_array($alternative['id'], $this->user_answer_ids);
$not = $chosen ? '' : 'not_';
$data[] = array(
'choice' => check_markup($alternative['answer']['value'], $alternative['answer']['format']),
'attempt' => $chosen ? quiz_icon('selected') : '',
'correct' => $chosen ? $alternative['score_if_chosen'] > 0 ? quiz_icon('correct') : quiz_icon('incorrect') : '',
'score' => $alternative["score_if_{$not}chosen"],
'answer_feedback' => check_markup($alternative["feedback_if_{$not}chosen"]['value'], $alternative["feedback_if_{$not}chosen"]['format'], FALSE),
'question_feedback' => 'Question feedback',
'solution' => $alternative['score_if_chosen'] > 0 ? quiz_icon('should') : ($simple_scoring ? quiz_icon('should-not') : ''),
'quiz_feedback' => "Quiz feedback",
);
}
return $data;
}