function opigno_lrs_stats_aggregate_statements_by_context in Opigno TinCan API 7
Aggregate statements by context
Note:
- First you need to unwind context using "opigno_lrs_stats_query_scope_unwind_context" on the pipeline
Output example: array( 'http://opigno.org/node/104' => statements, 'http://opigno.org/node/106' => statements, 'http://opigno.org/node/109' => statements )
Return value
array
1 call to opigno_lrs_stats_aggregate_statements_by_context()
- opigno_lrs_stats_course_content_course_contexts_statistics in modules/
opigno_tincan_api_stats/ includes/ course_content/ model.inc - Present course contexts statistics
File
- modules/
opigno_tincan_api_stats/ includes/ model/ aggregations.inc, line 143 - Implements functions to aggregate statements
Code
function opigno_lrs_stats_aggregate_statements_by_context($statements) {
$statements_per_context = array();
foreach ($statements as $statement) {
$statements_per_context[$statement->context->contextActivities->grouping->id][] = $statement;
}
return $statements_per_context;
}