opigno_tincan_api_in_house_training_statements.module in Opigno TinCan API 7
File
modules/opigno_tincan_api_in_house_training_statements/opigno_tincan_api_in_house_training_statements.module
View source
<?php
module_load_include('inc', 'opigno_tincan_api', 'includes/opigno_tincan_api.statements_func');
module_load_include('inc', 'opigno_tincan_api', 'includes/opigno_tincan_api.tincan_activity_definition_types');
module_load_include('inc', 'opigno_tincan_api', 'includes/opigno_tincan_api.tincan_verbs');
function opigno_tincan_api_in_house_training_statements_opigno_in_house_training_finished($taker, $iht, $score) {
$statement = _opigno_tincan_api_statement_base_creation(OpignoTincanApiTinCanVerbs::$attended, OpignoTincanApiTinCanActivityDefinitionTypes::$meeting, $iht);
if ($statement === false) {
return;
}
$context = new TinCan\Context();
if (isset($iht->og_group_ref[LANGUAGE_NONE])) {
$parent_courses_nids = array_map(function ($e) {
return $e['target_id'];
}, $iht->og_group_ref[LANGUAGE_NONE]);
_opigno_tincan_api_context_set_parents($context, $parent_courses_nids, OpignoTincanApiTinCanActivityDefinitionTypes::$course);
}
_opigno_tincan_api_context_set_language($context, $iht->language);
$results = opigno_in_house_training_score_form_get_default_value($iht->nid, $taker->uid);
if (isset($results['status']) && $results['status']) {
$attended = true;
}
else {
$attended = false;
}
_opigno_tincan_api_set_result($statement, $score, null, $attended, null, null);
$statement
->setContext($context);
_opigno_tincan_api_send_statement($statement);
}