You are here

public function LongAnswerResponse::getFeedbackValues in Quiz 7.5

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

Implementation of getFeedbackValues().

Overrides QuizQuestionResponse::getFeedbackValues

See also

QuizQuestionResponse::getFeedbackValues()

File

question_types/long_answer/long_answer.classes.inc, line 304
Long answer classes.

Class

LongAnswerResponse
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 long answer as there are no
    // choices.
    'choice' => NULL,
    'attempt' => check_markup($this->answer, $this->answer_format),
    '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' => check_markup($this->question->rubric['value'], $this->question->rubric['format']),
  );
  return $data;
}