You are here

function quiz_node_map in Quiz 7.4

Same name and namespace in other branches
  1. 8.4 quiz.module \quiz_node_map()
  2. 5.2 quiz.module \quiz_node_map()
  3. 5 quiz.module \quiz_node_map()
  4. 6.6 quiz.module \quiz_node_map()
  5. 6.2 quiz.module \quiz_node_map()
  6. 6.3 quiz.module \quiz_node_map()
  7. 6.4 quiz.module \quiz_node_map()
  8. 6.5 quiz.module \quiz_node_map()
  9. 7 quiz.module \quiz_node_map()

Map node properties to a question object.

Parameters

$node: The question node.

$include_question: Should the question(the question nodes body) be included?

Return value

Question object.

Related topics

1 call to quiz_node_map()
quiz_get_questions in ./quiz.module
Retrieve list of published questions assigned to quiz.

File

./quiz.module, line 3174
Quiz Module

Code

function quiz_node_map($node, $include_question = TRUE) {
  $new_question = new stdClass();
  if ($include_question) {
    $quiz_format = isset($node->body[LANGUAGE_NONE][0]['format']) ? $node->body[LANGUAGE_NONE][0]['format'] : NULL;
    $new_question->question = check_markup($node->body, $quiz_format);
  }
  $new_question->title = $node->title;
  $new_question->nid = $node->nid;
  $new_question->vid = $node->vid;
  $new_question->type = $node->type;
  $new_question->latest_vid = $node->latest_vid;
  $new_question->question_status = isset($node->question_status) ? $node->question_status : QUESTION_NEVER;
  if (isset($node->max_score)) {
    $new_question->max_score = $node->max_score;
  }
  if (isset($node->auto_update_max_score)) {
    $new_question->auto_update_max_score = $node->auto_update_max_score;
  }
  $new_question->weight = $node->weight;
  return $new_question;
}