You are here

function _get_date_vs_takeup_count_chart in Quiz 6.6

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

File

includes/quiz_dashboard/quiz_dashboard.admin.inc, line 173

Code

function _get_date_vs_takeup_count_chart($nid = 0, $uid = 0) {
  $start = 0;
  $end = 10;
  $takeup = array();
  $sql = "SELECT COUNT(result_id) AS count,\n            DATE(FROM_UNIXTIME(time_start)) AS date\n            FROM {quiz_node_results}";
  if ($uid != 0) {
    $sql .= " WHERE uid = %d";
  }
  $sql .= " GROUP BY date ORDER BY date DESC";
  $results = db_query_range($sql, $uid, $start, $end);
  while ($result = db_fetch_array($results)) {
    $takeup[] = $result;
  }
  if (count($takeup) < 3) {
    return;

    //t('insufficient data to generate graph');
  }
  $output = '<div id="date_vs_takeup_count" class="quiz-dashboard-chart-space">';

  // wrapping the chart output with div for custom theming.
  $output .= theme('date_vs_takeup_count', $takeup);

  // generate date vs takeup count line chart
  $output .= '</div>';
  return $output;
}