You are here

function quiz_get_all_version_titles in Quiz 7

Same name and namespace in other branches
  1. 6.4 quiz.module \quiz_get_all_version_titles()
  2. 7.4 quiz.module \quiz_get_all_version_titles()

Returns the titles for all quizzes the user has access to.

Return value

quizzes Array with nids as keys and (array with vid as key and title as value) as values. Like this: array($nid => array($vid => $title))

Related topics

File

./quiz.module, line 1579
Quiz Module

Code

function quiz_get_all_version_titles() {
  $query = db_select('node', 'n');
  $query
    ->join('node_revision', 'nr', 'nr.nid = n.nid');
  $query
    ->fields('nr', array(
    'nid',
    'vid',
    'title',
  ))
    ->condition('n.type', 'quiz')
    ->execute();
  $to_return = array();
  while ($res_o = $query
    ->fetch()) {
    $to_return[$res_o->nid][$res_o->vid] = $res_o->title;
  }
  return $to_return;
}