Skip to content
Snippets Groups Projects
Unverified Commit 1ff09f44 authored by Ryan Smith's avatar Ryan Smith Committed by GitHub
Browse files

fix: Improves scorm activity for #186. (#210)

parent c680b0c2
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 10 deletions
......@@ -24,6 +24,7 @@ function sco_launched(array $config, \stdClass $event) {
$repo = $config['repo'];
$user = $repo->read_record_by_id('user', $event->userid);
$course = $repo->read_record_by_id('course', $event->courseid);
$scorm = $repo->read_record_by_id('scorm', $event->objectid);
$lang = utils\get_course_lang($course);
return [[
......@@ -34,7 +35,7 @@ function sco_launched(array $config, \stdClass $event) {
$lang => 'launched'
],
],
'object' => utils\get_activity\event_module($config, $event, $lang),
'object' => utils\get_activity\course_scorm($config, $event->contextinstanceid, $scorm, $lang),
'timestamp' => utils\get_event_timestamp($event),
'context' => [
'platform' => $config['source_name'],
......
......@@ -40,7 +40,7 @@ function scoreraw_submitted(array $config, \stdClass $event) {
return [[
'actor' => utils\get_user($config, $user),
'verb' => utils\get_scorm_verb($scormscoestracks, $lang),
'object' => utils\get_activity\module($config, 'scorm', $scorm, $lang),
'object' => utils\get_activity\course_scorm($config, $event->contextinstanceid, $scorm, $lang),
'timestamp' => utils\get_event_timestamp($event),
'result' => utils\get_scorm_result($scormscoestracks, $rawscore),
'context' => [
......
......@@ -39,7 +39,7 @@ function status_submitted(array $config, \stdClass $event) {
return [[
'actor' => utils\get_user($config, $user),
'verb' => utils\get_scorm_verb($scormscoestracks, $lang),
'object' => utils\get_activity\module($config, 'scorm', $scorm, $lang),
'object' => utils\get_activity\course_scorm($config, $event->contextinstanceid, $scorm, $lang),
'timestamp' => utils\get_event_timestamp($event),
'context' => [
'platform' => $config['source_name'],
......
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace src\transformer\utils\get_activity;
defined('MOODLE_INTERNAL') || die();
use src\transformer\utils as utils;
function course_scorm(array $config, $cmid, $scorm, $lang) {
$scormname = property_exists($scorm, 'name') ? $scorm->name : 'Scorm';
return [
'id' => $config['app_url'].'/mod/scorm/view.php?id='.$cmid,
'definition' => [
'type' => 'http://id.tincanapi.com/activitytype/legacy-learning-standard',
'name' => [
$lang => $scormname,
],
],
];
}
......@@ -3,7 +3,7 @@
"userid": 1,
"courseid": 1,
"timecreated": 1433946701,
"objecttable": "scorm",
"objectid": 1,
"eventname": "\\mod_scorm\\event\\sco_launched"
"eventname": "\\mod_scorm\\event\\sco_launched",
"contextinstanceid": 1
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
"object": {
"id": "http:\/\/www.example.org\/mod\/scorm\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"type": "http:\/\/id.tincanapi.com\/activitytype\/legacy-learning-standard",
"name": {
"en": "test_name"
}
......
......@@ -3,7 +3,6 @@
"userid": 1,
"courseid": 1,
"timecreated": 1433946701,
"objecttable": "scorm",
"objectid": 1,
"eventname": "\\mod_scorm\\event\\scoreraw_submitted",
"other": "a:2:{s:8:\"cmivalue\";i:100;s:9:\"attemptid\";i:1;} ",
......
......@@ -16,7 +16,7 @@
"object": {
"id": "http:\/\/www.example.org\/mod\/scorm\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"type": "http:\/\/id.tincanapi.com\/activitytype\/legacy-learning-standard",
"name": {
"en": "test_name"
}
......
......@@ -3,7 +3,6 @@
"userid": 1,
"courseid": 1,
"timecreated": 1433946701,
"objecttable": "scorm",
"objectid": 1,
"eventname": "\\mod_scorm\\event\\status_submitted",
"other": "a:1:{s:9:\"attemptid\";i:1;} ",
......
......@@ -16,7 +16,7 @@
"object": {
"id": "http:\/\/www.example.org\/mod\/scorm\/view.php?id=1",
"definition": {
"type": "http:\/\/id.tincanapi.com\/activitytype\/lms\/module",
"type": "http:\/\/id.tincanapi.com\/activitytype\/legacy-learning-standard",
"name": {
"en": "test_name"
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment