function theme_get_quiz_status_chart in Quiz 7
Same name and namespace in other branches
- 8.6 modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 8.4 modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 8.5 modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 6.6 includes/quiz_dashboard/quiz_dashboard.admin.inc \theme_get_quiz_status_chart()
- 6.4 includes/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 7.6 modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 7.4 includes/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 7.5 modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
- 6.x modules/quiz_stats/quiz_stats.admin.inc \theme_get_quiz_status_chart()
generates quiz status chart number of pass, fail, incomplete
Parameters
$quiz: array of quiz data structure
Return value
HTML to render quiz status chart
1 theme call to theme_get_quiz_status_chart()
- _get_quiz_status_chart in includes/
quiz_stats/ quiz_stats.admin.inc - Generates a chart showing the status for all registered responses to a quiz
File
- includes/
quiz_stats/ quiz_stats.admin.inc, line 372 - Administration file for Quiz stats Module
Code
function theme_get_quiz_status_chart($variables) {
$quiz = $variables['quiz'];
$quiz['total'] = $quiz['no_pass'] + $quiz['no_fail'] + $quiz['no_incomplete'];
$chart = array(
'#chart_id' => 'quiz_status_chart',
'#title' => t('Quiz Status Chart'),
'#type' => CHART_TYPE_PIE_3D,
'#size' => chart_size(500, 200),
'#adjust_resolution' => TRUE,
);
$chart['#data'] = array(
'pass' => $quiz['no_pass'],
'incomplete' => $quiz['no_incomplete'],
'fail' => $quiz['no_fail'],
);
$chart['#data_colors'] = array(
'pass' => '00ff00',
'incomplete' => 'ffff00',
'fail' => 'ff0000',
);
ini_set('precision', '3');
$chart['#legends'] = array(
'pass' => $quiz['no_pass'] / $quiz['total'] * 100 . t('% pass'),
'incomplete' => $quiz['no_incomplete'] / $quiz['total'] * 100 . t('% incomplete'),
'fail' => $quiz['no_fail'] / $quiz['total'] * 100 . t('% fail'),
);
return theme('chart', array(
'chart' => $chart,
));
}