You are here

function _quiz_get_quizzes in Quiz 6.6

Same name and namespace in other branches
  1. 8.6 quiz.module \_quiz_get_quizzes()
  2. 8.4 quiz.module \_quiz_get_quizzes()
  3. 8.5 quiz.module \_quiz_get_quizzes()
  4. 6.3 quiz.module \_quiz_get_quizzes()
  5. 6.4 quiz.module \_quiz_get_quizzes()
  6. 6.5 quiz.module \_quiz_get_quizzes()
  7. 7.6 quiz.module \_quiz_get_quizzes()
  8. 7 quiz.module \_quiz_get_quizzes()
  9. 7.4 quiz.module \_quiz_get_quizzes()
  10. 7.5 quiz.module \_quiz_get_quizzes()
  11. 6.x quiz.module \_quiz_get_quizzes()

Get a full list of the quizzes.

Parameters

$uid: An optional user ID. If supplied, only quizzes created by that user will be returned.

Return value

A list of all quizzes.

2 calls to _quiz_get_quizzes()
quiz_admin_quizzes in ./quiz.admin.inc
Displays the quizzes by title with a link to the appropriate results for that specific quiz.
quiz_dashboard_get_basic_stats in includes/quiz_dashboard/quiz_dashboard.admin.inc

File

./quiz.module, line 2561
Quiz Module

Code

function _quiz_get_quizzes($uid = 0) {
  $results = array();
  $args = array();

  /* Not sure what the first inner join is supposed to do here. But as a negative
     * side effect, it returns duplicates of every quiz that has multiple vids.
    $sql = "SELECT n.nid, n.title, u.name, n.created
            FROM {node} n
            INNER JOIN {quiz_node_properties} qnp
            INNER JOIN {users} u
            WHERE n.type = 'quiz'
              AND n.nid = qnp.nid
              AND u.uid = n.uid";
    */
  $sql = "SELECT n.nid, n.title, n.uid, u.name, n.created\n          FROM {node} n\n          INNER JOIN {users} u\n          ON u.uid = n.uid\n          WHERE n.type = 'quiz'";
  if ($uid != 0) {
    $sql .= " AND n.uid = %d";
    $args[] = $uid;
  }
  $sql .= " ORDER BY n.nid DESC";
  $dbresult = db_query($sql, $args);
  while ($line = db_fetch_array($dbresult)) {
    $results[$line['nid']] = $line;
  }
  return $results;
}