Coder Social home page Coder Social logo

frumbert / xapiactivity Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 204 KB

Moodle Availability condition to restrict access to an activity or section based on a statement in an external Learning Record Store via xAPI.

License: GNU General Public License v3.0

PHP 100.00%
moodle moodle-plugin moodle-availability xapi lrs php

xapiactivity's Introduction

moodle-availability_xapiactivity

Restrict module and section access based on an record being present in an external Learning Record Store (LRS) using the Experience Api (xAPI / TinCan).

This availability condition makes it possible to show modules or sections only when a user has performed an action that is recorded in an external LRS, which could have been put there by an external system.

xAPI requires 3 parameters to look up a record: the verb, the activity and the actor. These represent the statement The user (actor) performed (verb) in (activity).

The verb is usually a URL which may look like http://adlnet.gov/expapi/verbs/experienced or http://id.tincanapi.com/verb/replied. You can list and read about existing verbs here: https://registry.tincanapi.com/#home/verbs

The activity is usually an URL which may look like https://some.fakesite.com/1/2/3. This will be determined by the system that is writing to the LRS. You will need to look this up.

The actor is a user. In this plugin this must match a moodle user record in some way. You can currently look up and actor using their email, idnumber or username field. This must match the actor record being stored in your LRS.

Setting up the plugin

Use the Moodle plugin installer to put this plugin into the correct location. If you are unable to install plugins automatically, the plugin folder needs to be located at:

<your-moodle-root>/availability/condition/xapiactivity

The plugin has the following fields you need to set globally (via /admin/settings.php?section=availabilitysettingxapiactivity):

  • LRS Url: The URL of your LRS, whcih might look like https://cloud.scorm.com/lrs/57837584
  • API Key: The username or apikey for your LRS, which might look like fds789dhj275hk4jf987
  • API Secret: The password or secret key for your LRS, which might look like DUY%H#B@VD%#
  • Authenication Method: Only basic authentication is supported at this time. Most LRS's support BASIC auth.
  • Actor Lookup Field: The field to match in the moodle user table to determine the actor

Using the plugin

Once configured with your LRS and authentication details, you can use the plugin anywhere you can normally add a restriction, with the exceptions:

  1. The front page of the site
  2. The first section/topic of a course

To set up the restiction, use the usual activity conditions editor. You can read more about this here : https://docs.moodle.org/en/Conditional_activities_settings

  1. Click the Add restriction button
  2. Click the xAPI lookup button
  3. Fill in the Verb, Activity Url and Condition Label fields. The Condition Label is the name or description of the activity that you want to show to users in Moodle. It doesn't have to be the same as the acvitity name in your LRS.

Example LRS statement

You can see an example page which sends a statement to a LRS here:

https://gist.github.com/frumbert/11b31e67b78c4c37f56dd7540bce5715

You'll need to modify lines 657 and 658 to enter your LRS details. You can sign up for a free LRS at https://scormcloud.com/ or https://lrs.io/

Licence

GPL3

xapiactivity's People

Contributors

frumbert avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.