function _quiz_get_quizzes in Quiz 7
Same name and namespace in other branches
- 8.6 quiz.module \_quiz_get_quizzes()
- 8.4 quiz.module \_quiz_get_quizzes()
- 8.5 quiz.module \_quiz_get_quizzes()
- 6.6 quiz.module \_quiz_get_quizzes()
- 6.3 quiz.module \_quiz_get_quizzes()
- 6.4 quiz.module \_quiz_get_quizzes()
- 6.5 quiz.module \_quiz_get_quizzes()
- 7.6 quiz.module \_quiz_get_quizzes()
- 7.4 quiz.module \_quiz_get_quizzes()
- 7.5 quiz.module \_quiz_get_quizzes()
- 6.x quiz.module \_quiz_get_quizzes()
Get a list of all available quizzes.
Parameters
$uid: An optional user ID. If supplied, only quizzes created by that user will be returned.
Return value
A list of 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_stats_get_basic_stats in includes/
quiz_stats/ quiz_stats.admin.inc - Returns statistics for all available quizzes
File
- ./
quiz.module, line 3531 - Quiz Module
Code
function _quiz_get_quizzes($uid = 0) {
$results = array();
$args = array();
$query = db_select('node', 'n')
->fields('n', array(
'nid',
'vid',
'title',
'uid',
'created',
))
->fields('u', array(
'name',
));
$query
->leftJoin('users', 'u', 'u.uid = n.uid');
$query
->condition('n.type', 'quiz');
if ($uid != 0) {
$query
->condition('n.uid', $uid);
}
$query
->orderBy('n.nid');
$quizzes = $query
->execute();
foreach ($quizzes as $quiz) {
$results[$quiz->nid] = (array) $quiz;
}
return $results;
}