function _get_quiz_status_chart in Quiz 6.4
Same name and namespace in other branches
- 8.6 modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 8.4 modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 8.5 modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 6.6 includes/quiz_dashboard/quiz_dashboard.admin.inc \_get_quiz_status_chart()
- 7.6 modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 7 includes/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 7.4 includes/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 7.5 modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
- 6.x modules/quiz_stats/quiz_stats.admin.inc \_get_quiz_status_chart()
Generates a chart showing the status for all registered responses to a quiz
Parameters
$vid: revision id of quiz node
$uid: User id
Return value
HTML to render to chart/graph
1 call to _get_quiz_status_chart()
- quiz_stats_get_adv_stats in includes/
quiz_stats/ quiz_stats.admin.inc - Get stats for a single quiz. Maybe also for a single user.
File
- includes/
quiz_stats/ quiz_stats.admin.inc, line 172
Code
function _get_quiz_status_chart($vid, $uid = 0) {
// get the pass rate of the given quiz by vid
$pass_rate = db_result(db_query("SELECT pass_rate FROM {quiz_node_properties} WHERE vid = %d", $vid));
if (!$pass_rate) {
return;
}
// get the count value of results row above and below pass rate
$sql = "SELECT SUM(score > {$pass_rate}) AS no_pass, SUM(score < {$pass_rate}) AS no_fail, SUM(score = 0) AS no_incomplete FROM {quiz_node_results} WHERE vid = %d";
$quiz = db_fetch_array(db_query($sql, intval($vid)));
if ($quiz['no_pass'] + $quiz['no_fail'] + $quiz['no_incomplete'] < 3) {
return FALSE;
// no sufficient data
}
// generates quiz status chart 3D pie chart
$chart = '<div id="get_quiz_status_chart" class="quiz-stats-chart-space">';
$chart .= theme('get_quiz_status_chart', $quiz);
$chart .= '</div>';
return array(
'chart' => $chart,
'title' => t('Status'),
'explanation' => t('This chart shows the status for all attempts made to answer this revision of the quiz.'),
);
}