You are here

function opigno_lrs_stats_aggregate_statements_by_month in Opigno TinCan API 7

Aggregate statements by month

Output example: array( '2015-01' => statements, '2015-02' => statements, '2015-03' => statements )

Return value

array

1 call to opigno_lrs_stats_aggregate_statements_by_month()
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

File

modules/opigno_tincan_api_stats/includes/model/aggregations.inc, line 40
Implements functions to aggregate statements

Code

function opigno_lrs_stats_aggregate_statements_by_month($statements) {
  $statements_per_month = array();
  foreach ($statements as $statement) {
    $statements_per_month[$statement->timestamp
      ->format('Y-m')][] = $statement;
  }
  return $statements_per_month;
}