You are here

function _uc_reports_subreport_intervals in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_reports/uc_reports.module \_uc_reports_subreport_intervals()

Returns a list of timespans for subreports over that report's time span.

To be used with a given time span for a report and specified interval for subreports.

Parameters

$start: A UNIX time stamp representing the time to start the report.

$end: A UNIX time stamp representing the time to end the report.

$granularity: Text representing the amount of time for the subreport (e.g. 'day', 'week')

Return value

An array of keyed arrays with the following values:

  • "start": The starting point of the sub report
  • "end": The ending point of the sub report
1 call to _uc_reports_subreport_intervals()
uc_reports_sales_custom in uc_reports/uc_reports.admin.inc
Display the custom sales report form and table.

File

uc_reports/uc_reports.module, line 363
Displays reports on sales, customers, and products to store admin

Code

function _uc_reports_subreport_intervals($report_start, $report_end, $interval) {
  $subreports = array();
  for ($start = $report_start, $end = _uc_reports_end_interval($report_start, $interval); $start < $report_end; $start = $end + 1, $end = _uc_reports_end_interval($start, $interval)) {
    $subreports[] = array(
      'start' => $start,
      'end' => $end > $report_end ? $report_end : $end,
    );
  }
  return $subreports;
}