Fileref:login/sl enrol linker.php

From SLIS Second Life Wiki

Jump to: navigation, search

Image:folder.gif (parent)

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

  1. Construct LSL handler
  2. Process request data
  3. Authenticate request
  4. Fetch non-standard parameters
  5. Retrieve a list of all courses on the site (limited to category if necessary)
  6. If mode = 'enrol' then:
    1. Login specified user
    2. Ensure course was specified
    3. Is user enrolled in specified course? If so then:
      1. Output status code 401
    4. else:
      1. Construct and output enrolment URL
  7. If mode = 'check-enrolled' then:
    1. Login specified user
    2. Ensure course was specified
    3. If user is enrolled in course, output '1'. Otherwise '0'.
  8. If mode = 'list-enrolled' then:
    1. Login specified user
    2. Fetch list of enrolled courses (terminate on failure)
    3. Output each enrolled course
  9. If mode = 'list-unenrolled' then:
    1. Login specified user
    2. Fetch list of enrolled courses (terminate on failure)
    3. Iterate through all courses, and output those user is not enrolled in
  10. If mode = 'list-enrollable' then:
    1. Login specified user
    2. Fetch list of enrolled courses (terminate on failure)
    3. Iterate through all courses, and output those user can enrol in
  11. If mode = 'list-all' then:
    1. Output all courses
  12. If mode is not recognised then:
    1. Output error message with status code -811
  13. Render response
  14. Terminate script


This page is part of the Sloodle documentation
SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home
Personal tools