You are here

public function LongAnswerResponse::getReportFormResponse in OG Quiz 7

Implementation of getReportFormResponse

Overrides QuizQuestionResponse::getReportFormResponse

See also

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

File

includes/og_long_answer.php, line 341
Long answer classes.

Class

LongAnswerResponse
Extension of QuizQuestionResponse

Code

public function getReportFormResponse($showpoints = TRUE, $showfeedback = TRUE, $allow_scoring = FALSE) {
  $form = array();
  $form['#theme'] = 'long_answer_response_form';
  if ($this->question && !empty($this->question->answers)) {
    $answer = (object) current($this->question->answers);
  }
  else {
    return $form;
  }
  $form['answer'] = array(
    '#markup' => check_markup($answer->answer),
  );
  if ($answer->is_evaluated == 1) {

    // Show feedback, if any.
    if ($showfeedback && !empty($answer->feedback)) {
      $feedback = check_markup($answer->feedback);
    }
  }
  else {
    $feedback = t('This answer has not yet been scored.') . '<br/>' . t('Until the answer is scored, the total score will not be correct.');
  }
  if ($allow_scoring) {
    $form['rubric'] = array(
      '#type' => 'item',
      '#title' => t('Rubric'),
      '#markup' => check_markup($this->question->rubric),
    );
  }
  if (!$allow_scoring && !empty($this->answer_feedback)) {
    $form['answer_feedback'] = array(
      '#title' => t('Feedback'),
      '#type' => 'item',
      '#markup' => '<span class="quiz_answer_feedback">' . $this->answer_feedback . '</span>',
    );
  }
  if (!empty($feedback)) {
    $form['feedback'] = array(
      '#markup' => '<span class="quiz_answer_feedback">' . $feedback . '</span>',
    );
  }
  return $form;
}