function quiz_get_user_results in Quiz 7
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.4 quiz.pages.inc \quiz_get_user_results()
- 6.5 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 - Implements hook_menu().
File
- ./
quiz.pages.inc, line 258 - User pages.
Code
function quiz_get_user_results($uid) {
$results = array();
$dbresult = db_query('SELECT DISTINCT(n.nid), n.title, qnp.pass_rate, qnrs.result_id, qnrs.time_start, qnrs.time_end, qnrs.score, qnrs.is_evaluated
FROM {node} n
INNER JOIN {quiz_node_properties} qnp ON n.nid = qnp.nid
INNER JOIN {quiz_node_results} qnrs ON qnrs.nid = qnp.nid
INNER JOIN {users} u ON u.uid = qnrs.uid
WHERE n.type = :type
AND u.uid = :uid
ORDER BY qnrs.result_id ASC', array(
':type' => 'quiz',
':uid' => $uid,
));
// Create an array out of the results.
foreach ($dbresult as $result) {
$result = (array) $result;
$results[$result['result_id']] = $result;
}
return theme('quiz_get_user_results', array(
'results' => $results,
));
}