* A helper class to validate and structure data for output according to the {@link http://slisweb.sjsu.edu/sl/index.php/Sloodle_communications_specification Sloodle communications specification}.
* Accessor function to set member value {@link $side_effects}. <b>Note:</b> it is recommended that you use {@link add_side_effect()} or {@link add_side_effects()} instead.
* @param mixed $par An integer side effect code, an array of integer side effect codes, or null to clear it
$this->_internal_validation_error("Sloodle - LSL response: cannot add side effects. Invalid element in array of side effect codes. All elements should be integers", 0);
$this->_internal_validation_error("Sloodle - LSL response: cannot add side effect. Invalid side effect type. should be an integer or an array of integers", 0);
}
// Was it valid?
if ($valid) {
// If we were passed just a single side effect, then convert it to an array
* Accessor function to set member value {@link $data}. <b>Note: it is recommended that you use the {@link add_data_line()} and {@link clear_data()} functions instead of this.</b>
* @param mixed $par Any scalar value, or a mixed array of scalars or scalar arrays, or null to clear it
* <i>Constructor</i> - can intialise some variables
* @param int $status_code The initial status code for the response (optional - ignore if null)
* @param string $status_descriptor The initial status descriptor for the response (optional - ignore if null)
* @param mixed $data The initial data for the response, which can be a scalar, or a mixed array of scalars/scalar-arrays (see {@link SloodleResponse::$data}) (optional - ignore if null)
* @return void
* @access public
*/
function SloodleResponse($status_code = null, $status_descriptor = null, $data = null)
// 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
// If $static is true (default) then this will be treated as a static call, and a new response object will be used
// If $static is false then this is treated as adding data to an existing response object
/**
* 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
*
* @param int $status_code The status code for the response (required)
* @param string $status_descriptor The status descriptor for the response (optional - ignored if null)
* @param mixed $data The data for the response, which can be a scalar, or a mixed array of scalars/scalar-arrays (see {@link SloodleResponse::$data}) (optional - ignored if null)
* @param bool $static If true (default), then this function will assume it is being call statically, and construct its own response object. Otherwise, it will all the existing member data to render the output.
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return string|nullThe password provided in the request parameters, or null if there wasn't one
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return int|nullThe course ID provided in the request parameters, or null if there wasn't one
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return int|nullThe controller ID provided in the request parameters, or null if there wasn't one
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return int|nullThe module ID provided in the request parameters, or null if there wasn't one
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return string|nullThe avatar UUID provided in the request parameters, or null if there wasn't one
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return string|nullThe avatar name provided in the request parameters, or null if there wasn't one
* Fetches the request descriptor request parameter.
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return string|nullThe request descriptor provided in the request parameters, or null if there wasn't one
* Fetches the server access level parameter, if specified.
* @param bool $required If true (default) then the function will terminate the script with an error message if the HTTP request parameter was not specified.
* @return string|nullThe server access level provided in the request parameters, or null if there wasn't one
* Process all of the standard data provided by the HTTP request, and write it into our {@link SloodleSession} object.
* Requires that a {@link SloodleSession} object was provided at construction, and is stored in the $_session member.
* NOTE: this does not load the module part of the session. That must be done separately, using the {@link SloodleSession::load_module()} member function.
* @param bool $require_auth If true, then the function will terminate the script with an error message if it cannot authenticate the request through a course, controller and password
* @param bool $require_user If true, then the function will terminate the script with an error message if a legitimate user was not identified or could not be auto-registered
* @return bool True if successful, or false otherwise.
* Obtains a named HTTP request parameter, optionally requiring it or not
* @param string $parname The name of the parameter to get
* @param bool $required Indicates whether or not to 'require' the parameter (if it is required, but cannot be found, then the script is terminated with an error message)
* @param mixed $default If the $require parameter is false, and the HTTP parameter cannot be found, then this value will be returned instead
* @return string|mixed The raw value of the HTTP parameter if found, or the value of parameter $default if it was not found and parameter $require was false