Skip to content

Commit

Permalink
Create config for context platform (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
milt authored Feb 7, 2025
1 parent 5328175 commit 8e4db73
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/log/store.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions lang/en/logstore_xapi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 4 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/transformer/utils/apply_statement_defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 8e4db73

Please sign in to comment.