You are here

function _quiz_get_last_days in Quiz 7

Same name and namespace in other branches
  1. 8.4 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_last_days()
  2. 6.4 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_last_days()
  3. 7.4 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_last_days()

Get the timestamps for the last days

Parameters

$num_days: How many of the last days we need timestamps for

Return value

Array of objects with timestamp and value. The value has '0' as its default value.

1 call to _quiz_get_last_days()
_get_date_vs_takeup_count_chart in includes/quiz_stats/quiz_stats.admin.inc
Generates chart showing how often the quiz has been taken the last days

File

includes/quiz_stats/quiz_stats.admin.inc, line 494
Administration file for Quiz stats Module

Code

function _quiz_get_last_days($num_days) {
  $to_return = array();
  $now = REQUEST_TIME;
  $one_day = 86400;
  for ($i = 0; $i < $num_days; $i++) {
    $timestamp = $now - $one_day * $i;
    $to_add = new stdClass();
    $to_add->timestamp = $timestamp;
    $to_add->value = '0';
    $to_return[date('Y.m.j', $timestamp)] = $to_add;
  }
  return $to_return;
}