Skip to content

Files

Latest commit

 

History

History
 
 

docs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Installation and Upgrading

You'll need to install Composer first.

  • Install with composer require learninglocker/moodle-xapi-translator.
  • Update with composer update learninglocker/moodle-xapi-translator.

Supported Events

Mapping for moodle event names to translator event classes can be found in the Controller.

Moodle Event Translator Event Test Example
\core\event\course_viewed CourseViewed CourseViewedTest CourseViewed
\mod_page\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_quiz\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_url\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_folder\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_book\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_scorm\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_forum\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_resource\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_quiz\event\attempt_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_choice\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_data\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_feedback\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_lesson\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_lti\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_wiki\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_workshop\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_chat\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_glossary\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_imscp\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_survey\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_url\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_facetoface\event\course_module_viewed ModuleViewed ModuleViewedTest ModuleViewed
\mod_quiz\event\attempt_preview_started AttemptStarted AttemptStartedTest AttemptStarted
\mod_quiz\event\attempt_reviewed AttemptReviewed AttemptReviewedTest AttemptReviewed
\core\event\user_loggedin UserLoggedin UserLoggedinTest UserLoggedin
\core\event\user_loggedout UserLoggedout UserLoggedoutTest UserLoggedout
\mod_assign\event\submission_graded AssignmentGraded AssignmentGradedTest AssignmentGraded
\mod_assign\event\assessable_submitted AssignmentSubmitted AssignmentSubmittedTest AssignmentSubmitted
\mod_forum\event\discussion_viewed DiscussionViewed DiscussionViewedTest DiscussionViewed
\mod_quiz\event\attempt_abandoned AttemptAbandoned AttemptAbandonedTest AttemptAbandoned
\mod_forum\event\user_report_viewed ModuleViewed ModuleViewedTest ModuleViewed
\core\event\user_created UserRegistered UserRegisteredTest UserRegistered
\core\event\user_enrolment_created EnrolmentCreated EnrolmentCreatedTest EnrolmentCreated
\mod_scorm\event\sco_launched ScormLaunched ScormLaunchedTest ScormLaunched

Adding Events

  1. Create a new ".php" file in the "tests" directory.
  2. Change the file from step 1 using the "tests/ModuleEventTest.php" file as an example.
  3. Run the tests you've created with "./vendor/bin/phpunit".
  4. You should see the tests fail.
  5. Create a new ".php" file in the "src/events" directory.
  6. Change the file from step 5 using the "src/Events/ModuleEvent.php" file as an example.
  7. Run the tests with "./vendor/bin/phpunit".
  8. You should see the tests pass if you've done everything correctly.
  9. You may wish to repeat steps 2-4 and/or steps 6-8 at this point.
  10. Change the "src/Controller.php" file to map the Moodle event to the file you created in step 5.
  11. Create a pull request so that everyone else can use your new event.

When adding new events or modifying existing events, we recommend that you follow the rules of TDD.

  1. You are not allowed to write any production code unless it is to make a failing unit test pass.
  2. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
  3. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

First Pull Request

If this is your first pull request, you need to follow the steps below.

  1. Click the "Fork" button (top right of Github). Github will fork (copy) this repository as your own so you can make changes.
  2. Run git remote set-url origin https://github.com/YOUR_USERNAME/Moodle-xAPI-Translator.git (replacing YOUR_USERNAME for your Github username).

Once this is done, you can then follow the steps for subsequent pull requests below.

Subsequent Pull Requests

  1. Run git add -A; git commit -am "DESCRIPTION"; to commit your changes (replacing DESCRIPTION with a description of what you've changed).
  2. Run git push to push your commits to your forked repository.
  3. Go to "https://github.com/YOUR_USERNAME/Moodle-xAPI-Translator/pulls" (replacing YOUR_USERNAME for your Github username).
  4. Click the "New pull request" button to begin creating your pull request.
  5. Click the "Create pull request" button (twice) to confirm the creation of your pull request.

Once step 5 is complete, we'll test and review your pull request before merging it with the rest of the code.