function opigno_lrs_stats_dashboard_empty_values_per_unit_between in Opigno TinCan API 7
Generates empty time entries for morris.js
Output example for days: array( '2015-01-01' => 0, '2015-01-02' => 0, '2015-01-03' => 0, '2015-01-04' => 0, '2015-01-05' => 0 )
Output example for months: array( '2015-01' => 0, '2015-02' => 0, '2015-03' => 0, '2015-04' => 0, '2015-05' => 0 )
Output example for years: array( '2015' => 0, '2016' => 0, '2017' => 0 )
Parameters
DateTime $start_date:
DateTime $end_date:
string $unit:
string $format:
Return value
array
3 calls to opigno_lrs_stats_dashboard_empty_values_per_unit_between()
- opigno_lrs_stats_dashboard_current_week_total_number_of_page_view_per_day_between in modules/
opigno_tincan_api_stats/ includes/ dashboard/ model.inc - Aggregate total number of page per day between two dates for the given statements
- opigno_lrs_stats_dashboard_current_week_total_number_of_page_view_per_month_between in modules/
opigno_tincan_api_stats/ includes/ dashboard/ model.inc - Aggregate total number of page per month between two dates for the given statements
- opigno_lrs_stats_dashboard_current_week_total_number_of_page_view_per_year_between in modules/
opigno_tincan_api_stats/ includes/ dashboard/ model.inc - Aggregate total number of page per year between two dates for the given statements
File
- modules/
opigno_tincan_api_stats/ includes/ dashboard/ model.inc, line 139 - Dashboard model functions
Code
function opigno_lrs_stats_dashboard_empty_values_per_unit_between($start_date, $end_date, $unit, $format) {
$empty_values_per_unit = array();
$current_date = $start_date;
while ($current_date <= $end_date) {
$empty_values_per_unit[$current_date
->format($format)] = array();
$current_date
->modify("+1 {$unit}");
}
return $empty_values_per_unit;
}