Fileref:login/sl enrol linker.php
From SLIS Second Life Wiki
This Linker Script allows objects in Second Life to query and request student enrolment in courses.
Contents |
[edit] Dependencies
Sloodle files:
[edit] Parameters
The following HTTP parameters are required when requesting this script:
- sloodlepwd = the site's Prim Password
- sloodlemode = name of the mode of this request (can be 'enrol', 'check-enrolled', 'list-enrolled', 'list-unenrolled', 'list-enrollable', or 'list-all')
Some modes require or can accept additional parameters:
- sloodlecourseid = ID of a Moodle course
- sloodlecategoryid = ID of the category to which course results should be limited
- sloodleuuid = UUID of the avatar in question (note: always optional if sloodleavname is specified)
- sloodleavname = name of the avatar in question (note: always optional if sloodleuuid is specified)
[edit] Modes
This script will behave in one of the following modes, according to the 'sloodlemode' HTTP parameter. (Note: if the mode specified is not recognised, then the returned status code will be -811).
[edit] enrol
- Required parameters: sloodlecourseid, sloodleuuid, sloodleavname
In this mode, the script will construct a Moodle enrolment URL for the identified user and course. If successful, the return status code is 1, and the data line is the enrolment URL. If the user is already enrolled in that course, the status code is 401 and there is no data line.
[edit] check-enrolled
- Required parameters: sloodlecourseid, sloodleuuid, sloodleavname
This mode checks if the specified user is already enrolled in the specified course. If the query is successful, then the return status code is 1. The data line indicates whether the user is enrolled, by containing a 0 or a 1 (indicating "not enrolled" and "enrolled" respectively).
[edit] list-enrolled
- Required parameters: sloodleuuid, sloodleavname
- Optional parameters: sloodlecategoryid
This mode will query for courses the specified user is enrolled in, optionally limiting the results to the specified course category. If the query is successful, the return status code is 1, and each data line represents a course, with format: "<id>|<shortname>|<longname>".
[edit] list-unenrolled
- Required parameters: sloodleuuid, sloodleavname
- Optional parameters: sloodlecategoryid
This mode will query for courses the specified user is not enrolled in, optionally limiting the results to the specified course category. If the query is successful, the return status code is 1, and each data line represents a course, with format: "<id>|<shortname>|<longname>".
- Note: the query may return courses which the user cannot enrol in via Sloodle.
[edit] list-enrollable
- Required parameters: sloodleuuid, sloodleavname
- Optional parameters: sloodlecategoryid
This mode will query for courses the specified user is allowed to enrol in via Sloodle (but in which s/he is not already enrolled), optionally limiting the results to the specified course category. If the query is successful, the return status code is 1, and each data line represents a course, with format: "<id>|<shortname>|<longname>".
[edit] list-all
- Optional parameters: sloodlecategoryid
This mode will query for all courses on the site, optionally limiting the results to the specified course category. If the query is successful, the return status code is 1, and each data line represents a course, with format: "<id>|<shortname>|<longname>".
[edit] Algorithm
- Construct LSL handler
- Process request data
- Authenticate request
- Fetch non-standard parameters
- Retrieve a list of all courses on the site (limited to category if necessary)
- If mode = 'enrol' then:
- Login specified user
- Ensure course was specified
- Is user enrolled in specified course? If so then:
- Output status code 401
- else:
- Construct and output enrolment URL
- If mode = 'check-enrolled' then:
- Login specified user
- Ensure course was specified
- If user is enrolled in course, output '1'. Otherwise '0'.
- If mode = 'list-enrolled' then:
- Login specified user
- Fetch list of enrolled courses (terminate on failure)
- Output each enrolled course
- If mode = 'list-unenrolled' then:
- Login specified user
- Fetch list of enrolled courses (terminate on failure)
- Iterate through all courses, and output those user is not enrolled in
- If mode = 'list-enrollable' then:
- Login specified user
- Fetch list of enrolled courses (terminate on failure)
- Iterate through all courses, and output those user can enrol in
- If mode = 'list-all' then:
- Output all courses
- If mode is not recognised then:
- Output error message with status code -811
- Render response
- Terminate script
| This page is part of the Sloodle documentation | |||
|---|---|---|---|
| SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home | |||
