function quiz_get_user_results in Quiz 6.4
Same name and namespace in other branches
- 8.4 quiz.pages.inc \quiz_get_user_results()
- 5.2 quiz.module \quiz_get_user_results()
- 5 quiz.module \quiz_get_user_results()
- 6.6 quiz.pages.inc \quiz_get_user_results()
- 6.2 quiz.pages.inc \quiz_get_user_results()
- 6.3 quiz.pages.inc \quiz_get_user_results()
- 6.5 quiz.pages.inc \quiz_get_user_results()
- 7 quiz.pages.inc \quiz_get_user_results()
- 7.4 quiz.pages.inc \quiz_get_user_results()
Displays all the quizzes the user has taken part in.
Parameters
$user_id: User id
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.pages.inc, line 232 - User pages.
Code
function quiz_get_user_results($user_id) {
$results = array();
$sql = "SELECT n.nid, n.title, qnp.pass_rate, qnrs.result_id, qnrs.time_start, qnrs.time_end, qnrs.score, qnrs.is_evaluated\n FROM {node} n\n INNER JOIN {quiz_node_properties} qnp ON n.nid = qnp.nid\n INNER JOIN {quiz_node_results} qnrs ON qnrs.vid = qnp.vid\n INNER JOIN {users} u ON u.uid = qnrs.uid\n WHERE n.type = 'quiz'\n AND u.uid = %d\n AND qnrs.time_end > 0\n ORDER BY qnrs.result_id ASC";
$dbresult = db_query($sql, $user_id);
// Create an array out of the results.
while ($line = db_fetch_array($dbresult)) {
$results[$line['result_id']] = $line;
}
return theme('quiz_get_user_results', $results);
}