Fileref:sl classroom/sl profile linker.php
From SLIS Second Life Wiki
This Linker Script gives external access to the profile management tools for classroom layouts. (See the Sloodle Set for more information).
The script operates in one of several modes, depending on what is specified in the 'sloodlecmd' parameter.
Contents |
Dependencies
Sloodle files:
Parameters
The following parameters are required:
- sloodlepwd = Prim Password for authenticating the request
- sloodleuuid = UUID of the user making the request (optional if 'sloodleavname' is specified)
- sloodleavname = avatar name of the user making the request (optional if 'sloodleuuid' is specified)
- sloodlecourseid = the ID of the course which the profile is in
- sloodlecmd = the operation (or command) to be carried out. (This can be 'newprofile', 'saveentries', 'listentries', or 'listprofiles')
If 'sloodlecmd' is set to 'newprofile', 'saveentries' or 'listentries' then the following parameter is also required:
- sloodleprofilename = the name of the profile beinghandled
If 'sloodlecmd' is set to 'saveentries' then the following parameter is required as well:
- sloodleentries = the entries to be added to the profile, in pipe-delimited form (e.g. "Sloodle+Set+0.704|<1,2,3>||Sloodle+WebIntercom|<0,3.2,1>")
Response
The response depends on the mode, as specified in the 'sloodlecmd' parameter.
newprofile
If successful, the status code will be 1, and the ID number and profile name will be give on the first data line, like this:
23|My Prfile
saveentries
Status code will be 1, but with no data.
listentries
If successful, the status code will be 1, with each line representing a single entry. The entry will contain the entry ID, the name of the object, and the position; e.g.:
6|Sloodle WebIntercom|<1.4,0.9,2.6> 7|Sloodle Registration Booth|<2.1,3.0,3.5> 11|Sloodle MetaGloss|<0.0,1.2,2.6>
listprofiles
If successful in fetching a list of profiles, the status code will be 1, and each line will contain a profile ID number, and the name of the profile; e.g.:
2|topic1 15|demo 26|assessment
Error Responses
There are some profile-specific error codes, as follows:
- -901 = unknown profile error
- -902 = profile does not exist
- -903 = profile already exists (i.e. cannot be created again)
- -904 = unknown profile command (parameter 'sloodlecmd')
In some cases, -103 may also be returned if no profile or entry data was found. Also, -331 will be returned if the user does not have admin or teacher status on the course.
Algorithm
- Create SloodleLSLHandler object
- Process basic request data
- Authenticate request
- Login user
- Ensure user is an admin, or a teacher on the current course (terminate if not)
- Obtain additional parameters
- Is script in 'newprofile' mode? If yes then:
- Fetch classroom profile
- If profile didn't exist already then:
- Construct database object
- Add profile to database (terminate on failure)
- If profile already existed then:
- Output error message
- Is script in 'listprofiles' mode? If yes then:
- Get a list of profiles in the course
- Output profiles
- Is script in 'listentries' mode? If yes then:
- Get named profile (terminate on failure)
- Get all entries in profile
- Output each entry
- Is script in 'saveentries' mode? If yes then:
- If there are no entries to save then terminate with error message
- Get named profile (terminate on failure)
- Get old entries
- Construct array of database entry object for new entries
- Save new profile entries to database
- Output success or failure message
- Is script mode unrecognised? Then output error message
- Render response
- Terminate script
| This page is part of the Sloodle documentation | |||
|---|---|---|---|
| SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home | |||
