You are here

function _quiz_get_questions in Quiz 5

Same name and namespace in other branches
  1. 5.2 quiz.module \_quiz_get_questions()
  2. 6.6 quiz.module \_quiz_get_questions()
  3. 6.2 quiz.module \_quiz_get_questions()
  4. 6.3 quiz.module \_quiz_get_questions()
  5. 6.5 quiz.module \_quiz_get_questions()

Retrieve list of questions assigned to quiz

Return value

Array of questions

2 calls to _quiz_get_questions()
quiz_questions_form in ./quiz.module
Handles "Manage questions" tab
theme_quiz_view in ./quiz.module
Theme the node view for quizzes

File

./quiz.module, line 1032
Quiz Module

Code

function _quiz_get_questions() {
  $quiz = node_load(arg(1));
  $questions = array();
  if (!empty($quiz->nid)) {

    // Retrieve list of questions
    $result = db_query("\n    SELECT n.nid, n.type, nr.body, nr.format, q.question_status\n    FROM {node} n, {node_revisions} nr, {quiz_questions} q\n    WHERE n.nid = q.question_nid\n    AND n.nid = nr.nid\n    AND q.quiz_nid = %d", $quiz->nid);

    // Create questions array
    while ($node = db_fetch_object($result)) {
      $questions[] = quiz_node_map($node);
    }
  }
  return $questions;
}