function hook_opigno_scorm_scorm_cmi_get_alter in Opigno 7
Implements hook_opigno_scorm_cmi_get_alter().
This hook allows modules to alter CMI data that is about to be sent back to the SCORM.
Parameters
mixed $value: The data that will be returned. Can be NULL if not previously persisted in the database.
string $cmi_key: The CMI data indentifier for the value.
array $context: Context array, with at least the following keys:
- uid: The user ID
- scorm_id: The SCORM ID.
- original_value: The original value, in case some module alters it.
2 invocations of hook_opigno_scorm_scorm_cmi_get_alter()
- opigno_scorm_quiz_load_objective in modules/
scorm/ quiz/ opigno_scorm_quiz.module - Load all objective data for the given SCORM.
- opigno_scorm_scorm_cmi_get in modules/
scorm/ opigno_scorm.module - Get a CMI data value for the given SCORM.
File
- modules/
scorm/ opigno_scorm.api.php, line 111 - This file contains module hooks definitions and documentation.
Code
function hook_opigno_scorm_scorm_cmi_get_alter(&$value, $cmi_key, $context) {
if ($cmi_key === 'cmi.learner_name') {
$profile = profile_load($context['uid']);
$value = "{$profile->first_name} {$profile->last_name}";
}
}