SloodleResponseA helper class to validate and structure data for output according to the Sloodle communications specification.
Located in /sloodle/lib/io.php (line 50)
void
SloodleResponse
([int $status_code = null], [string $status_descriptor = null], [mixed $data = null])
void
quick_output
(int $status_code, [string $status_descriptor = null], [mixed $data = null], [bool $static = true])
string
$avatar_uuid
= null (line 131)
Avatar UUID.
Should be a string specifying the UUID key of the agent in-world being handled. (Typically of the user who initiated the request). Optional. Ignored if null.
mixed
$data
= null (line 174)
Data to render following the status line in the response.
This value can either be a scalar (single value, e.g. int, string, float), or an array. If it is a single scalar, it is rendered as a single line. If it is an array, then each element becomes one line. If an element is a scalar, then it is directly output onto the line. If an element is an array, then each child element is output as a separate field on the same line. Optional. Ignored if null.
string
$field_separator
= "|" (line 66)
The separation string between fields of a response line (by default, a pipe character |).
string
$line_separator
= "\n" (line 59)
The separation string between lines of the response (typically just a newline).
integer
$page_number
= null (line 158)
Current page number.
If a response requires multiple pages, this value indicates which page is being returned in this response. Optional, unless $page_total is specified. Ignored if null. Not yet supported.
integer
$page_total
= null (line 149)
Total number of pages.
If a response requires multiple pages, this value indicates how many pages there are. Optional, unless $page_number is specified. Ignored if null. Not yet supported.
string
$request_descriptor
= null (line 104)
Request descriptor.
A brief string passed into the request by an LSL script (via HTTP parameter 'sloodlerequestdesc'), which is returned so that it can correctly distinguish one request from anotehr. Optional. Ignored if null.
integer
$request_timestamp
= null (line 113)
Timestamp when the request was originally made by the LSL script.
This is not filled-in automatically. You must do it manually if you need it. Optional. Ignored if null.
integer
$response_timestamp
= null (line 122)
Timestamp when the response was generated on the Moodle site.
This is not filled-in automatically. You must do it manually if you need it. Optional. Ignored if null.
mixed
$side_effects
= null (line 94)
Integer side effect(s) codes.
Status code(s) of side effect(s) incurred during the operation. Can be a single integer, or an array of integers. Optional. Ignored if null.
int
$status_code
= null (line 75)
Integer status code of the response.
Refer to the status codes page on the Sloodle wiki for a reference. Required.
string
$status_descriptor
= null (line 84)
Status descriptor string.
Should contain a generalised description/category of the status code. Optional but recommended. Ignored if null.
mixed
$tracking_code
= null (line 140)
Tracking code of the request.
Use of this value is undefined. Please do not use it. Optional. Ignored if null.
Constructor
Adds one line of data to the $data member
Adds a single side effect code to member $status_code
Adds one or more integer side effect codes to member $status_code.
Quick output of data to avoid several accessor calls if the response is very basic.
Can be called statically to allow simple output of basic data. The status code is required, but the other parameters are optional If an error occurs, the LSL-friendly error message is output to the HTTP response, and the script terminated
Outputs the response directly to the HTTP response.
Renders the response to a string.
Prior to rendering, this function will perform final validation on all the data. If anything fails, then the script will terminate with an LSL-friendly error message.
Accessor function to set member value $avatar_uuid
Accessor function to set member value $data. Note: it is recommended that you use the add_data_line() and clear_data() functions instead of this.
Sets the field separator.
Sets the line separator.
Accessor function to set member value $page_number
Accessor function to set member value $page_total
Accessor function to set member value $request_descriptor
Accessor function to set member value $request_timestamp
Accessor function to set member value $response_timestamp
Accessor function to set member value $side_effects. Note: it is recommended that you use add_side_effect() or add_side_effects() instead.
Accessor function to set member value $status_code
Accessor function to set member value $status_descriptor
Accessor function to set member value $tracking_code
Internal function to report a data validation error.
Outputs an LSL-friendly error message, and terminates the script
Documentation generated on Mon, 16 Jun 2008 15:56:25 +0100 by phpDocumentor 1.4.0