You are here

public function TrueFalseResponse::getFeedbackValues in Quiz 7.6

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

Implementation of getReportFormResponse

Overrides QuizQuestionResponse::getFeedbackValues

File

question_types/truefalse/truefalse.classes.inc, line 282
Defines the classes necessary for a True/False quiz.

Class

TrueFalseResponse
Extension of QuizQuestionResponse

Code

public function getFeedbackValues() {
  $answer = $this->question->answers[0]['answer'];
  $correct_answer = $this->question->correct_answer;
  $data = array();
  $data[] = array(
    'choice' => t('True'),
    'attempt' => $answer ? quiz_icon('selected') : '',
    'correct' => $answer == 1 ? quiz_icon($correct_answer ? 'correct' : 'incorrect') : '',
    'score' => intval($correct_answer == 1 && $answer == 1),
    'answer_feedback' => '',
    'solution' => $correct_answer == 1 ? quiz_icon('should') : '',
  );
  $data[] = array(
    'choice' => t('False'),
    'attempt' => !$answer ? quiz_icon('selected') : '',
    'correct' => $answer == 0 ? quiz_icon(!$correct_answer ? 'correct' : 'incorrect') : '',
    'score' => intval($correct_answer == 0 && $answer == 0),
    'answer_feedback' => '',
    'solution' => $correct_answer == 0 ? quiz_icon('should') : '',
  );
  return $data;
}