Make the xAPI integration work for stuff that aren't content types

d6
Svein-Tore Griff With 2015-02-18 09:07:19 +01:00
parent 0a6dd4808b
commit a96e5cc7b9
1 changed files with 15 additions and 9 deletions

View File

@ -78,15 +78,21 @@ H5P.XAPIEvent.prototype.getVerb = function(full) {
* @param {object} instance - the H5P instance * @param {object} instance - the H5P instance
*/ */
H5P.XAPIEvent.prototype.setObject = function(instance) { H5P.XAPIEvent.prototype.setObject = function(instance) {
this.data.statement.object = { if (instance.contentId) {
// TODO: Correct this. contentId might be vid, and this can't be Drupal this.data.statement.object = {
// specific 'id': H5PIntegration.getContentUrl(instance.contentId),
'id': H5PIntegration.getContentUrl(instance.contentId), 'objectType': 'Activity',
'objectType': 'Activity', 'extensions': {
'extensions': { 'http://h5p.org/x-api/h5p-local-content-id': instance.contentId
'http://h5p.org/x-api/h5p-local-content-id': instance.contentId }
} };
}; }
else {
// Not triggered by an H5P content type...
this.data.statement.object = {
'objectType': 'Activity'
};
}
}; };
/** /**