function opigno_lrs_stats_query in Opigno TinCan API 7
Query Learning Record Store server using mongodb aggregate structure
Parameters
array $pipeline: A structured aggregate query (http://docs.mongodb.org/manual/core/aggregation-pipeline)
Return value
array Array of statements.
8 calls to opigno_lrs_stats_query()
- opigno_lrs_stats_all_course_content_failed_statements in modules/
opigno_tincan_api_stats/ includes/ model/ queries.inc - Retrieve all course content failed statements (caching for current request)
- opigno_lrs_stats_all_course_content_finished_statements in modules/
opigno_tincan_api_stats/ includes/ model/ queries.inc - Retrieve all course content finished statements (caching for current request)
- opigno_lrs_stats_all_course_content_passed_statements in modules/
opigno_tincan_api_stats/ includes/ model/ queries.inc - Retrieve all course content passed statements (caching for current request)
- opigno_lrs_stats_all_course_content_statements in modules/
opigno_tincan_api_stats/ includes/ model/ queries.inc - Retrieve all course content statements (caching for current request)
- opigno_lrs_stats_all_course_content_viewed_statements in modules/
opigno_tincan_api_stats/ includes/ model/ queries.inc - Retrieve all course content viewed statements (caching for current request)
File
- modules/
opigno_tincan_api_stats/ includes/ model/ adapter.inc, line 47 - Implements functions to query statements stored on Learning Record Store server
Code
function opigno_lrs_stats_query($pipeline) {
$statements = array();
//Define request options
$options = array(
'headers' => opigno_lrs_stats_query_request_basic_auth_header(variable_get('opigno_tincan_api_username'), variable_get('opigno_tincan_api_password')),
'data' => drupal_http_build_query(array(
'pipeline' => json_encode($pipeline),
)),
);
//Send request
$response = drupal_http_request(opigno_lrs_stats_end_point(), $options);
//Process response
if (isset($response->error)) {
drupal_set_message("An error occured while requesting Learning Record Store data ({$response->error})", 'error');
}
else {
$statements = array_map('opigno_lrs_stats_query_record_map_statement', json_decode($response->data)->result);
$statements = opigno_lrs_stats_statement_mutate_timestamp($statements);
}
return $statements;
}