You are here

function quiz_get_user_results in Quiz 5

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

Displays all the quizs the user has taken part in

Return value

HTML output for page

1 string reference to 'quiz_get_user_results'
quiz_menu in ./quiz.module
Implementation of hook_menu().

File

./quiz.module, line 575
Quiz Module

Code

function quiz_get_user_results() {
  global $user;
  $results = array();
  $dbresult = db_query("SELECT\n                          n.nid nid,\n                          n.title title,\n                          u.name name,\n                          qr.rid rid,\n                          qr.time_start,\n                          qr.time_end\n                        FROM {node} n, {quiz} q, {quiz_result} qr, {users} u\n                        WHERE\n                          n.type = 'quiz'\n                            AND\n                          n.nid = q.nid\n                            AND\n                          qr.quiz_nid = q.nid\n                            AND\n                          u.uid = qr.uid\n                            AND\n                          u.uid = " . $user->uid . "\n                        ORDER BY qr.rid ASC");

  //Create results array
  while ($line = db_fetch_array($dbresult)) {
    $results[$line['rid']] = $line;
  }
  return theme('quiz_get_user_results', $results);
}