You are here

function quiz_my_results in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 quiz.pages.inc \quiz_my_results()
  2. 7 quiz.pages.inc \quiz_my_results()
  3. 7.4 quiz.pages.inc \quiz_my_results()

Show results for the current quiz

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

File

./quiz.pages.inc, line 255
User pages.

Code

function quiz_my_results($node) {
  global $user;
  $results = array();
  $res = db_query("\n    SELECT qnp.nid, qnp.pass_rate, qnrs.result_id, qnrs.time_start, qnrs.time_end, qnrs.score\n    FROM {quiz_node_properties} qnp\n    INNER JOIN {quiz_node_results} qnrs ON qnrs.nid = qnp.nid\n    WHERE qnrs.uid = %d AND qnrs.nid = %d AND qnrs.is_evaluated = 1\n    ORDER BY qnrs.result_id DESC\n  ", $user->uid, $node->nid);

  // Create an array out of the results.
  while ($line = db_fetch_array($res)) {
    $results[$line['result_id']] = $line;
  }
  return theme('quiz_my_results_for_quiz', $results);
}