From 2ac1d9aedfb74840b42aaaaa2e420d1106cd7f42 Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Thu, 16 Apr 2020 10:17:34 +0200 Subject: [PATCH] MDL-67814 h5p: recover missed xAPI settings --- h5p/classes/helper.php | 4 ++-- h5p/classes/player.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/h5p/classes/helper.php b/h5p/classes/helper.php index f040d527aa4..dd12ca61761 100644 --- a/h5p/classes/helper.php +++ b/h5p/classes/helper.php @@ -299,7 +299,7 @@ class helper { * @return array The settings. */ public static function get_core_settings(): array { - global $CFG; + global $CFG, $USER; $basepath = $CFG->wwwroot . '/'; $systemcontext = context_system::instance(); @@ -321,7 +321,7 @@ class helper { 'saveFreq' => false, 'siteUrl' => $CFG->wwwroot, 'l10n' => array('H5P' => $core->getLocalization()), - 'user' => [], + 'user' => ['name' => $USER->username, 'mail' => $USER->email], 'hubIsEnabled' => true, 'reportingIsEnabled' => false, 'crossorigin' => null, diff --git a/h5p/classes/player.php b/h5p/classes/player.php index 30f04e6634d..9633388e0d3 100644 --- a/h5p/classes/player.php +++ b/h5p/classes/player.php @@ -614,6 +614,8 @@ class player { $settings = helper::get_core_assets(); // Added here because in the helper we don't have the h5p content id. $settings['moodleLibraryPaths'] = $this->core->get_dependency_roots($this->h5pid); + // Add also the Moodle component where the results will be tracked. + $settings['moodleComponent'] = $this->component; $cid = $this->get_cid(); // The filterParameters function should be called before getting the dependencyfiles because it rebuild content -- 2.11.4.GIT