You are here

public function MatchingResponse::getFeedbackValues in Quiz 7.6

Same name and namespace in other branches
  1. 7.5 question_types/matching/matching.classes.inc \MatchingResponse::getFeedbackValues()

Implementation of getReportFormResponse

Overrides QuizQuestionResponse::getFeedbackValues

File

question_types/matching/matching.classes.inc, line 527
matching.classes

Class

MatchingResponse
Extension of QuizQuestionResponse

Code

public function getFeedbackValues() {
  $data = array();
  $answers = $this->question->answers[0]['answer'];
  $solution = $this->quizQuestion
    ->getSubquestions();
  foreach ($this->question->match as $match) {
    $data[] = array(
      'choice' => $match['question'],
      'attempt' => !empty($answers[$match['match_id']]) ? $solution[1][$answers[$match['match_id']]] : '',
      'correct' => $answers[$match['match_id']] == $match['match_id'] ? theme('quiz_answer_result', array(
        'type' => 'correct',
      )) : theme('quiz_answer_result', array(
        'type' => 'incorrect',
      )),
      'score' => $answers[$match['match_id']] == $match['match_id'] ? 1 : 0,
      'answer_feedback' => $match['feedback'],
      'question_feedback' => 'Question feedback',
      'solution' => $solution[1][$match['match_id']],
      'quiz_feedback' => "Quiz feedback",
    );
  }
  return $data;
}