forked from adlnet/moodle-logstore_xapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from yetanalytics/course_module_completion_upd…
…ated Course module completion updated
- Loading branch information
Showing
292 changed files
with
12,082 additions
and
11,864 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "xapi-vle/moodle-logstore-xapi", | ||
"license": "GPL v3", | ||
"require-dev": { | ||
"learninglocker/statementfactory": "~0.0" | ||
}, | ||
"require": { | ||
"ext-json": "*" | ||
}, | ||
"prefer-stable": true, | ||
"minimum-stability": "dev" | ||
} | ||
"name": "xapi-vle/moodle-logstore-xapi", | ||
"license": "GPL v3", | ||
"require-dev": { | ||
"learninglocker/statementfactory": "~0.0" | ||
}, | ||
"require": { | ||
"ext-json": "*" | ||
}, | ||
"prefer-stable": true, | ||
"minimum-stability": "dev" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
* @copyright Jerret Fowler <[email protected]> | ||
* Ryan Smith <https://www.linkedin.com/in/ryan-smith-uk/> | ||
* David Pesce <[email protected]> | ||
* Milt Reder <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
|
@@ -34,10 +35,9 @@ | |
* @param array $config The transformer config settings. | ||
* @param \stdClass $course The course object. | ||
* @param int $cmid The id of the context. | ||
* @param string $xapitype The type of xAPI object. | ||
* @return array | ||
*/ | ||
function course_module(array $config, \stdClass $course, int $cmid, string $xapitype) { | ||
function course_module(array $config, \stdClass $course, int $cmid) { | ||
$repo = $config['repo']; | ||
$coursemodule = $repo->read_record_by_id('course_modules', $cmid); | ||
$module = $repo->read_record_by_id('modules', $coursemodule->module); | ||
|
@@ -47,10 +47,14 @@ function course_module(array $config, \stdClass $course, int $cmid, string $xapi | |
$courselang = utils\get_course_lang($course); | ||
$instancename = property_exists($instance, 'name') ? $instance->name : $module->name; | ||
|
||
$activitytype = utils\get_module_activity_type($module->name); | ||
|
||
// TODO: Some objects (like mod_choice CMI interactions) will need more | ||
// dispatch and add those here | ||
$object = [ | ||
'id' => $coursemoduleurl, | ||
'definition' => [ | ||
'type' => $xapitype, | ||
'type' => $activitytype, | ||
'name' => [ | ||
$courselang => $instancename, | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?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/>. | ||
|
||
/** | ||
* Transformer utility for retrieving course module activity types. | ||
* | ||
* @package logstore_xapi | ||
* @copyright Milt Reder <[email protected]> | ||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
namespace src\transformer\utils; | ||
|
||
use src\transformer\utils as utils; | ||
|
||
/** | ||
* Return the mapping of modules to activity types. | ||
* @return array | ||
*/ | ||
|
||
function get_module_activity_type_mapping() { | ||
return [ | ||
'assign' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/assignment', | ||
'bigbluebuttonbn' => 'http://adlnet.gov/expapi/activities/meeting', | ||
'book' => 'http://id.tincanapi.com/activitytype/book', | ||
'chat' => 'http://id.tincanapi.com/activitytype/chat-channel', | ||
'choice' => 'http://adlnet.gov/expapi/activities/cmi.interaction', | ||
'data' => 'http://xapi.org.au/contentprofile/activitytype/database', | ||
'facetoface' => 'https://w3id.org/xapi/acrossx/activities/face-to-face-discussion', | ||
'feedback' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/feedback', | ||
'folder' => 'http://activitystrea.ms/collection', | ||
'forum' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/forum', | ||
'glossary' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/glossary', | ||
'h5pactivity' => 'http://adlnet.gov/expapi/activities/media', | ||
'imscp' => 'https://w3id.org/xapi/cmi5/activitytype/course', | ||
'label' => 'https://w3id.org/xapi/acrossx/activities/webpage', | ||
'lesson' => 'http://adlnet.gov/expapi/activities/lesson', | ||
'lti' => 'http://adlnet.gov/expapi/activities/media', | ||
'page' => 'https://w3id.org/xapi/acrossx/activities/page', | ||
'quiz' => 'http://adlnet.gov/expapi/activities/assessment', | ||
'resource' => 'http://id.tincanapi.com/activitytype/resource', | ||
'scorm' => 'http://id.tincanapi.com/activitytype/legacy-learning-standard', | ||
'url' => 'http://adlnet.gov/expapi/activities/link', | ||
'wiki' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/wiki', | ||
'workshop' => 'https://xapi.edlm/profiles/edlm-lms/concepts/activity-types/workshop', | ||
'questionnaire' => 'http://id.tincanapi.com/activitytype/survey', | ||
'survey' => 'http://id.tincanapi.com/activitytype/survey' | ||
]; | ||
} | ||
|
||
/** | ||
* Return an activity type or default for a given module name. | ||
* | ||
* @param string $module_name The name of a moodle course module. | ||
* @return string | ||
*/ | ||
function get_module_activity_type($module_name) { | ||
$module_uris = get_module_activity_type_mapping(); | ||
|
||
if (array_key_exists($module_name, $module_uris)) { | ||
return $module_uris[$module_name]; | ||
} else { | ||
return 'http://id.tincanapi.com/activitytype/lms/module'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
{ | ||
} | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"timestamp": "2015-06-10T14:31:41.000Z", | ||
"context": { | ||
"platform": "Moodle", | ||
"registration": "58028332-2277-5b51-a632-7836992917ea" | ||
} | ||
"timestamp": "2015-06-10T14:31:41.000Z", | ||
"context": { | ||
"platform": "Moodle", | ||
"registration": "58028332-2277-5b51-a632-7836992917ea" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
{ | ||
"id":1, | ||
"eventname":"\\core\\event\\badge_awarded", | ||
"timecreated": 1433946701, | ||
"relateduserid": 1, | ||
"courseid": 1, | ||
"objectid": 1, | ||
"other": "a:1:{s:13:\"badgeissuedid\";i:2;}", | ||
"objecttable": "badge" | ||
"id": 1, | ||
"eventname": "\\core\\event\\badge_awarded", | ||
"timecreated": 1433946701, | ||
"relateduserid": 1, | ||
"courseid": 1, | ||
"objectid": 1, | ||
"other": "a:1:{s:13:\"badgeissuedid\";i:2;}", | ||
"objecttable": "badge" | ||
} |
Oops, something went wrong.