You are here

public function ClozeResponse::getReportFormResponse in Cloze 7

Same name and namespace in other branches
  1. 6 cloze.classes.inc \ClozeResponse::getReportFormResponse()

Implementation of getReportFormResponse()

See also

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

File

./cloze.classes.inc, line 407
The main classes for the cloze question type. These inherit or implement code found in quiz_question.classes.inc.

Class

ClozeResponse
Extension of QuizQuestionResponse

Code

public function getReportFormResponse($showpoints = TRUE, $showfeedback = TRUE, $allow_scoring = FALSE) {
  $form = array();
  $form['#theme'] = 'cloze_response_form';
  $form['#attached']['css'] = array(
    drupal_get_path('module', 'cloze') . '/theme/cloze.css',
  );
  if ($this->question && !empty($this->question->answers)) {
    $answer = (object) current($this->question->answers);
  }
  else {
    return $form;
  }
  $this->question = node_load($this->question->nid);
  $question = $this->question->body[LANGUAGE_NONE][0]['value'];
  $correct_answer = _cloze_get_correct_answer($question);
  $user_answer = _cloze_get_user_answer($question, $this->answer);
  $form['answer'] = array(
    '#markup' => theme('cloze_user_answer', array(
      'answer' => $user_answer,
      'correct' => $correct_answer,
    )),
  );
  return $form;
}