You are here

function _quiz_get_terms in Quiz 6.4

Same name and namespace in other branches
  1. 7.6 quiz.module \_quiz_get_terms()
  2. 7 quiz.module \_quiz_get_terms()
  3. 7.4 quiz.module \_quiz_get_terms()
  4. 7.5 quiz.module \_quiz_get_terms()

Get data for all terms belonging to a Quiz with categorized random questions

Parameters

int $vid: version id for the quiz

Return value

array Array with all terms that belongs to the quiz as objects

Related topics

2 calls to _quiz_get_terms()
_quiz_build_categorized_question_list in ./quiz.module
Builds the questionlist for quizzes with categorized random questions
_quiz_categorized_existing_terms_form in ./quiz.admin.inc

File

./quiz.module, line 2774
Quiz Module

Code

function _quiz_get_terms($vid) {
  $sql = 'SELECT td.name, qt.*
          FROM {quiz_terms} qt
          JOIN {term_data} td ON qt.tid = td.tid
          WHERE qt.vid = %d
          ORDER BY qt.weight';
  $res = db_query($sql, $vid);
  $to_return = array();
  while ($res_o = db_fetch_object($res)) {
    $to_return[] = $res_o;
  }
  return $to_return;
}