function quiz_get_number_of_questions in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.module \quiz_get_number_of_questions()
- 5.2 quiz.module \quiz_get_number_of_questions()
- 5 quiz.module \quiz_get_number_of_questions()
- 6.6 quiz.module \quiz_get_number_of_questions()
- 6.2 quiz.module \quiz_get_number_of_questions()
- 6.3 quiz.module \quiz_get_number_of_questions()
- 6.4 quiz.module \quiz_get_number_of_questions()
- 6.5 quiz.module \quiz_get_number_of_questions()
- 7.6 quiz.module \quiz_get_number_of_questions()
- 7.4 quiz.module \quiz_get_number_of_questions()
- 7.5 quiz.module \quiz_get_number_of_questions()
Finds out the number of questions for the quiz.
Good example of usage could be to calculate the % of score.
Parameters
$nid: Quiz ID.
Return value
Returns the number of quiz questions.
Related topics
2 calls to quiz_get_number_of_questions()
- quiz_take_quiz in ./
quiz.module - Handles quiz taking.
- theme_quiz_stats_get_basic_stats in includes/
quiz_stats/ quiz_stats.admin.inc - Generates table of results from quiz data structure.
File
- ./
quiz.module, line 1676 - Quiz Module
Code
function quiz_get_number_of_questions($vid) {
$always_count = _quiz_get_num_always_questions($vid);
$rand_count = db_query('SELECT number_of_random_questions FROM {quiz_node_properties} WHERE vid = :vid', array(
':vid' => $vid,
))
->fetchField();
return $always_count + (int) $rand_count;
}