mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-69467-311' of https://github.com/sebastianberm/moodle into MOODLE_311_STABLE
This commit is contained in:
commit
06eb4fd769
2 changed files with 46 additions and 1 deletions
|
@ -331,7 +331,11 @@ class helper {
|
|||
$core = $factory->get_core();
|
||||
|
||||
// When there is a logged in user, her information will be passed to the player. It will be used for tracking.
|
||||
$usersettings = isloggedin() ? ['name' => $USER->username, 'mail' => $USER->email] : [];
|
||||
$usersettings = [];
|
||||
if (isloggedin()) {
|
||||
$usersettings['name'] = $USER->username;
|
||||
$usersettings['id'] = $USER->id;
|
||||
}
|
||||
$settings = array(
|
||||
'baseUrl' => $basepath,
|
||||
'url' => "{$basepath}pluginfile.php/{$systemcontext->instanceid}/core_h5p",
|
||||
|
|
|
@ -47,3 +47,44 @@ H5P.getMoodleComponent = function () {
|
|||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the actor. (Moved to overrides due to MDL-69467)
|
||||
*/
|
||||
H5P.XAPIEvent.prototype.setActor = function () {
|
||||
if (H5PIntegration.user !== undefined) {
|
||||
this.data.statement.actor = {
|
||||
'name': H5PIntegration.user.name,
|
||||
'objectType': 'Agent'
|
||||
};
|
||||
if (H5PIntegration.user.id !== undefined) {
|
||||
this.data.statement.actor.account = {
|
||||
'name': H5PIntegration.user.id,
|
||||
'homePage': H5PIntegration.siteUrl
|
||||
}
|
||||
} else if (H5PIntegration.user.mail !== undefined) {
|
||||
this.data.statement.actor.mbox = 'mailto:' + H5PIntegration.user.mail;
|
||||
}
|
||||
} else {
|
||||
var uuid;
|
||||
try {
|
||||
if (localStorage.H5PUserUUID) {
|
||||
uuid = localStorage.H5PUserUUID;
|
||||
} else {
|
||||
uuid = H5P.createUUID();
|
||||
localStorage.H5PUserUUID = uuid;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// LocalStorage and Cookies are probably disabled. Do not track the user.
|
||||
uuid = 'not-trackable-' + H5P.createUUID();
|
||||
}
|
||||
this.data.statement.actor = {
|
||||
'account': {
|
||||
'name': uuid,
|
||||
'homePage': H5PIntegration.siteUrl
|
||||
},
|
||||
'objectType': 'Agent'
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue