You are here

function uc_reports_subreport_intervals in Ubercart 7.3

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 timestamp representing the time to start the report.

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

$interval: Text representing the time span of 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
Displays the custom sales report form and table.

File

uc_reports/uc_reports.admin.inc, line 1394
Reports administration menu items.

Code

function uc_reports_subreport_intervals($start, $report_end, $interval) {
  $subreports = array();
  while ($start < $report_end) {
    $end = strtotime('+1 ' . $interval, $start) - 1;
    $subreports[] = array(
      'start' => $start,
      'end' => min($end, $report_end),
    );
    $start = $end + 1;
  }
  return $subreports;
}