You are here

public function TrueFalseResponse::getFeedbackValues in Quiz 7.5

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

Implementation of getFeedbackValues().

Overrides QuizQuestionResponse::getFeedbackValues

See also

QuizQuestionResponse::getFeedbackValues()

File

question_types/truefalse/truefalse.classes.inc, line 283
TrueFalse classes.

Class

TrueFalseResponse
Extension of QuizQuestionResponse.

Code

public function getFeedbackValues() {
  $answer = $this->question->answers[0]['answer'];
  if (!is_null($answer)) {
    $answer = intval($answer);
  }
  $correct_answer = intval($this->question->correct_answer);
  $data = array();
  $data[] = array(
    'choice' => t('True'),
    'attempt' => $answer === 1 ? 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 === 0 ? 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;
}