You are here

public function LongAnswerResponse::getReportFormScore in Quiz 6.4

Same name and namespace in other branches
  1. 7 question_types/long_answer/long_answer.classes.inc \LongAnswerResponse::getReportFormScore()
  2. 7.4 question_types/long_answer/long_answer.classes.inc \LongAnswerResponse::getReportFormScore()

Implementation of getReportFormScore

Overrides QuizQuestionResponse::getReportFormScore

See also

QuizQuestionResponse#getReportFormScore($showpoints, $showfeedback, $allow_scoring)

File

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

Class

LongAnswerResponse
Extension of QuizQuestionResponse

Code

public function getReportFormScore($showfeedback = TRUE, $showpoints = TRUE, $allow_scoring = FALSE) {

  // The score will be shown as a questionmark if the question haven't been scored already
  $score = $this
    ->isEvaluated() ? $this
    ->getScore() : '?';

  // We show a textfield if the quiz shall be scored. Markup otherwise
  if (quiz_access_to_score() && $allow_scoring) {
    return array(
      '#type' => 'textfield',
      '#default_value' => $score,
      '#size' => 3,
      '#maxlength' => 3,
      '#attributes' => array(
        'class' => 'quiz-report-score',
      ),
    );
  }
  else {
    return array(
      '#type' => 'markup',
      '#value' => $score,
    );
  }
}