You are here

function AbstractQuizQuestionResponse::toBareObject in Quiz 6.3

Same name and namespace in other branches
  1. 6.6 question_types/quiz_question/quiz_question.core.inc \AbstractQuizQuestionResponse::toBareObject()
  2. 6.5 question_types/quiz_question/quiz_question.core.inc \AbstractQuizQuestionResponse::toBareObject()

Repesent the response as a stdClass object.

Convert data to an object that has the following properties:

  • $score
  • $rid
  • $nid
  • $vid
  • $is_correct

Overrides QuizQuestionResponse::toBareObject

File

question_types/quiz_question/quiz_question.core.inc, line 252
Classes used in the Quiz Question module.

Class

AbstractQuizQuestionResponse
A base implementation of QuizQuestionResponse.

Code

function toBareObject() {
  $obj = new stdClass();
  $obj->score = $this->score;

  // This can be 0 for unscored.
  $obj->nid = $this->question->nid;
  $obj->vid = $this->question->vid;
  $obj->rid = $this->rid;
  $obj->is_correct = $this
    ->isCorrect();
  $obj->is_evaluated = $this
    ->isEvaluated();
  $obj->is_skipped = FALSE;
  return $obj;
}