Add info about the library being used to the xAPI statements

editor-padding
Svein-Tore Griff With 2015-07-10 12:58:02 +02:00
parent 8431304dd0
commit 03370c9500
2 changed files with 20 additions and 0 deletions

View File

@ -131,6 +131,17 @@ H5P.XAPIEvent.prototype.setContext = function (instance) {
}
};
}
if (instance.libraryInfo) {
if (this.data.statement.context === undefined) {
this.data.statement.context = {"contextActivities":{}};
}
this.data.statement.context.contextActivities.category = [
{
"id": "http://h5p.org/libraries/" + instance.libraryInfo.versionedNameNoSpaces,
"objectType": "Activity"
}
];
}
};
/**

View File

@ -748,6 +748,15 @@ H5P.newRunnable = function (library, contentId, $attachTo, skipResize, extras) {
if (instance.parent === undefined && extras && extras.parent) {
instance.parent = extras.parent;
}
if (instance.libraryInfo === undefined) {
instance.libraryInfo = {
versionedName: library.library,
versionedNameNoSpaces: machineName + '-' + versionSplit[0] + '.' + versionSplit[1],
machineName: machineName,
majorVersion: versionSplit[0],
minorVersion: versionSplit[1]
};
}
if ($attachTo !== undefined) {
instance.attach($attachTo);