diff --git a/classes/log/store.php b/classes/log/store.php index acab8891f..4a239aa97 100755 --- a/classes/log/store.php +++ b/classes/log/store.php @@ -270,6 +270,7 @@ protected function get_handler_config() { 'send_course_and_module_idnumber' => $this->get_config('sendidnumber', false), 'send_username' => $this->get_config('send_username', false), 'account_homepage' => $this->get_config('account_homepage', $CFG->wwwroot), + 'context_platform' => $this->get_config('context_platform', 'Moodle'), 'send_jisc_data' => $this->get_config('send_jisc_data', false), 'session_id' => sesskey(), 'plugin_url' => 'https://github.com/xAPI-vle/moodle-logstore_xapi', diff --git a/lang/en/logstore_xapi.php b/lang/en/logstore_xapi.php index 592aec3d3..6934d1d76 100644 --- a/lang/en/logstore_xapi.php +++ b/lang/en/logstore_xapi.php @@ -79,6 +79,8 @@ $string['send_username_desc'] = 'Statements will identify users with their username when this box is ticked, but only if identifying users by email is disabled.'; $string['account_homepage'] = 'Actor Account HomePage'; $string['account_homepage_desc'] = 'Set the homePage field for actor accounts. Defaults to the app_url.'; +$string['context_platform'] = 'Context Platform'; +$string['context_platform_desc'] = 'Set the context platform field of xAPI statements. Defaults to "Moodle".'; $string['send_jisc_data'] = 'Adds JISC data to statements'; $string['send_jisc_data_desc'] = 'Statements will contain data required by JISC.'; $string['shortcourseid'] = 'Send short course name'; diff --git a/settings.php b/settings.php index 895df2e2a..b1ac5ea47 100644 --- a/settings.php +++ b/settings.php @@ -88,6 +88,10 @@ get_string('account_homepage', 'logstore_xapi'), get_string('account_homepage_desc', 'logstore_xapi'), $CFG->wwwroot, PARAM_TEXT)); + $settings->add(new admin_setting_configtext('logstore_xapi/context_platform', + get_string('context_platform', 'logstore_xapi'), + get_string('context_platform_desc', 'logstore_xapi'), 'Moodle', PARAM_TEXT)); + $settings->add(new admin_setting_configcheckbox('logstore_xapi/send_jisc_data', get_string('send_jisc_data', 'logstore_xapi'), get_string('send_jisc_data_desc', 'logstore_xapi'), 0)); diff --git a/src/transformer/utils/apply_statement_defaults.php b/src/transformer/utils/apply_statement_defaults.php index 959b6a4d5..939b5f05d 100644 --- a/src/transformer/utils/apply_statement_defaults.php +++ b/src/transformer/utils/apply_statement_defaults.php @@ -36,7 +36,7 @@ function apply_statement_defaults(array $config, \stdClass $event, array $statem return array_map(function ($statement) use ($config, $event) { $defaultStatement = [ 'context' => [ - 'platform' => $config['source_name'] ?? 'Moodle', + 'platform' => $config['context_platform'] ?? 'Moodle', 'registration' => stringToUuidV5($config['session_id']), ], 'timestamp' => get_event_timestamp($event),