forked from adlnet/moodle-logstore_xapi
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Course module completion updated #21
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
62b9363
Change course module completion updated event based on completion state
milt b32bbcc
centrally dispatch for course module types
milt 55e5ea7
tests for two states of cm completion update
milt f62951b
fix test copypasta
milt 393abda
update contrib
milt f7d961a
make type actually optional
milt a7f392b
add contrib
milt ecc4e6c
update expected activity types, the reason for the season
milt 9334160
formatting
milt 7ff1b8b
fix feedback
milt 569139e
update other instances of survey
milt d6f5f3c
don't set in quiz except in jisc case
milt 21ad22d
fix forum
milt 5a0e344
remove hard type from resource
milt b049970
remove forced type for book
milt 8a29118
CMV changes
milt fa602c3
remove type arg from course module object builder
milt 1d5cd81
add todo about module objects
milt ea8f04d
typo
milt 0e21fd5
lots of json formatting
milt 962872d
remove bad call to course_module in quiz helper
milt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is basically the biggest change here, xAPI type is decided by a single table, not whatever the caller specifies.