You are here

function theme_quiz_top_scorers in Quiz 6.4

Same name and namespace in other branches
  1. 8.6 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  2. 8.4 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  3. 8.5 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  4. 6.6 includes/quiz_dashboard/quiz_dashboard.admin.inc \theme_quiz_top_scorers()
  5. 7.6 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  6. 7 includes/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  7. 7.4 includes/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  8. 7.5 modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()
  9. 6.x modules/quiz_stats/quiz_stats.admin.inc \theme_quiz_top_scorers()

generates a chart of quiz top scorers

Parameters

$attendees: array containing quiz data structure

Return value

HTML to render quiz top scorers chart

1 theme call to theme_quiz_top_scorers()
_get_quiz_top_scorers_chart in includes/quiz_stats/quiz_stats.admin.inc
Generates the top scorers chart

File

includes/quiz_stats/quiz_stats.admin.inc, line 326

Code

function theme_quiz_top_scorers($attendees) {
  $chart = array(
    '#chart_id' => 'quiz_top_scorers',
    //'#title' => t('Quiz Top Scorers'),
    '#type' => CHART_TYPE_BAR_V_GROUPED,
    '#size' => chart_size(600, 400),
    '#grid_lines' => chart_grid_lines(10, 10),
    '#bar_size' => chart_bar_size(20, 15),
  );
  foreach ($attendees as $attendee) {
    $chart['#data'][][] = $attendee['score'];
    $chart['#data_colors'][] = chart_unique_color(count($chart['#data']));
    $chart['#mixed_axis_labels'][CHART_AXIS_X_BOTTOM][2][] = chart_mixed_axis_label(t('Quiz Attendees'), 50);
    $chart['#legends'][] = $attendee['name'] . ' ' . $attendee['score'] . ' %';
  }
  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][1][] = chart_mixed_axis_label(t('Score') . ' (%)', 100);
  $chart['#mixed_axis_labels'][CHART_AXIS_Y_LEFT][0][] = chart_mixed_axis_range_label(0, 100);
  return chart_render($chart);
}