File/lib/sl_generallib.php

Description

Sloodle general library.

Provides various utility functionality for general Sloodle purposes.

  • copyright: Copyright (c) 2007-8 Sloodle (various contributors)
  • contributor: Edmund Edgar
  • contributor: Peter R. Bloomfield
  • filesource: Source Code for this file
  • license: GNU GPL v3
Includes
 require_once (SLOODLE_DIRROOT.'/lib/sl_iolib.php') (line 22)

Include the IO library.

Functions
sloodle_add_to_log (line 295)

Old logging function

  • todo: May require update?
void sloodle_add_to_log ([ $courseid = null], [ $module = null], [ $action = null], [ $url = null], [ $cmid = null], [ $info = null])
  • $courseid
  • $module
  • $action
  • $url
  • $cmid
  • $info
sloodle_array_to_vector (line 420)

Converts an array vector to a string vector.

Array vector should be associative, containing elements 'x', 'y', and 'z'. Converts to a string vector of format "<x,y,z>".

string sloodle_array_to_vector ( $arr)
  • $arr
sloodle_check_course_module_instance_type (line 468)

Determines if the specified course module instance is of the named type.

For example, this can check if a particular instance is a "forum" or a "chat".

  • return: True if the module is of the specified type, or false otherwise
bool sloodle_check_course_module_instance_type (int $id, string $module_name)
  • int $id: The integer ID of a course module instance
  • string $module_name: Module type to check (must be the exact name of an installed module, e.g. 'sloodle' or 'quiz')
sloodle_finished_login_coordinates (line 535)

Generates teleport coordinates for a user who has already finished the LoginZone process.

  • return: An associated array vector
array sloodle_finished_login_coordinates ()
sloodle_get_auth_method (line 133)

Gets the site-wide authentication from the configuration table.

mixed sloodle_get_auth_method ()
sloodle_get_config (line 56)

Gets a Sloodle configuration value from Moodle's "config" table.

This function does not necessarily need to be used. All configuration data is available as named members of Moodle's $CFG global variable. NOTE: in Sloodle debug mode, this function will terminate the script with an error if the name is not prefixed with "sloodle_".

  • return: A string containing the configuration value, or false if the query failed (e.g. if the named value didn't exist)
  • see: sloodle_set_config()
mixed sloodle_get_config (string $name)
  • string $name: The name of the value to be stored (should be prefixed with "sloodle_")
sloodle_get_course_module_instance (line 431)

Obtains the identified course module instance database record.

  • return: A database record if successful, or false if it could not be found
mixed sloodle_get_course_module_instance (int $id)
  • int $id: The integer ID of a course module instance
sloodle_get_distribution_list (line 237)

Gets an array of the names of all objects in the Object Distributor.

NOTE: Stored in the Moodle configuration table as value "sloodle_distrib_objects". Must be set manually as a pipe-delimited list, e.g. "object1|object2|object3".

  • return: A numeric array of strings (will be an empty array if no objects are available)
  • see: sloodle_get_config()
array sloodle_get_distribution_list ()
sloodle_get_loginzone_pos (line 160)

Gets the position of the site-wide LoginZone object.

mixed sloodle_get_loginzone_pos ()
sloodle_get_loginzone_region (line 212)

Gets the name of the region where the site-wide LoginZone object was most recently rezzed.

mixed sloodle_get_loginzone_region ()
sloodle_get_loginzone_size (line 186)

Gets the size of the site-wide LoginZone object.

mixed sloodle_get_loginzone_size ()
sloodle_get_module_id (line 489)

Obtains the ID number of the specified module (type not instance).

  • return: Integer containing module ID, or false if it is not installed
mixed sloodle_get_module_id (string $name)
  • string $name: The name of the module type to check, e.g. 'sloodle' or 'forum'
sloodle_get_prim_password (line 78)

Gets the site-wide Sloodle prim password from the configuration table.

mixed sloodle_get_prim_password ()
sloodle_is_automatic_registration_on (line 118)

Determines whether or not automatic registration is enabled.

bool sloodle_is_automatic_registration_on ()
sloodle_is_course_module_instance_visible (line 442)

Determines whether or not the specified course module instance is visible.

Checks that the instance itself and the course section are both valid.

  • return: True if visible, or false if invisible or not found
bool sloodle_is_course_module_instance_visible (int $id)
  • int $id: The integer ID of a course module instance.
sloodle_is_installed (line 336)

Determines whether or not Sloodle is installed.

Queries Moodle's modules table for a Sloodle entry. NOTE: does not check for the presence of the Sloodle files.

  • return: True if Sloodle is installed, or false otherwise.
bool sloodle_is_installed ()
sloodle_login_zone_coordinates (line 614)

Calculates the maximum and minimum bounds of the site-wide LoginZone.

Returns the bounds as a numeric array of two associate array vectors: ($max, $min). (Or returns false if no LoginZone position/size could be found in the Moodle configuration table).

array sloodle_login_zone_coordinates ()
sloodle_position_is_in_login_zone (line 505)

Checks if the specified position is in the current (site-wide) loginzone.

bool sloodle_position_is_in_login_zone (mixed $pos)
  • mixed $pos: A string vector or an associated array vector
sloodle_prim_password (line 106)

Old form of the {@link: sloodle_set_prim_password()} function.

Now deliberately terminates the script if called. DO NOT USE!

void sloodle_prim_password ()
sloodle_random_position_in_zone (line 561)

Generates a random position within the specified cubic zone.

  • return: An associative vector array
array sloodle_random_position_in_zone (array $zonemax, array $zonemin)
  • array $zonemax: Associative array vector specifying the maximum boundary of the cubic zone
  • array $zonemin: Associative array vector specifying the minimum boundary of the cubic zone
sloodle_random_security_token (line 348)

Generates a random login security token.

Uses mixed-case letters and numbers to generate a random 16-character string.

string sloodle_random_security_token ()
sloodle_random_web_password (line 372)

Generates a random web password Uses mixed-case letters and numbers to generate a random 8-character string.

string sloodle_random_web_password ()
sloodle_round_vector (line 581)

Rounds the specified 3d vector integer values.

Can handle/return a string vector, or an array vector. (Output type matches input type).

mixed sloodle_round_vector (mixed $pos)
  • mixed $pos: Either a string vector or an array vector
sloodle_send_xmlrpc_message (line 253)

Sends an XMLRPC message into Second Life.

  • return: True if successful, or false if an error occurs
bool sloodle_send_xmlrpc_message (string $channel, int $intval, string $strval)
  • string $channel: A string containing a UUID identifying the XMLRPC channel in SL to be used
  • int $intval: An integer value to be sent in the message
  • string $strval: A string value to be sent in the message
sloodle_set_auth_method (line 147)

Sets the site-wide authentication method in the Moodle configuration table.

Note: no validation is performed on the parameter except to establish that it is a string

bool sloodle_set_auth_method (string $auth)
  • string $auth: A string containing the authentication method, "web" for web-based, or "autoregister" for automatic registration
sloodle_set_config (line 35)

Sets a Sloodle configuration value.

This data will be stored in Moodle's "config" table, so it will persist even after Sloodle is uninstalled. After being set, it will be available (read-only) as a named member of Moodle's $CFG variable. NOTE: in Sloodle debug mode, this function will terminate the script with an error if the name is not prefixed with "sloodle_".

  • return: True on success, or false on failure (may fail if database query encountered an error)
  • see: sloodle_get_config()
bool sloodle_set_config (string $name, string $value)
  • string $name: The name of the value to be stored (should be prefixed with "sloodle_")
  • string $value: The string representation of the value to be stored
sloodle_set_loginzone_pos (line 172)

Sets the position of the site-wide LoginZone object (stored in the Moodle configuration table).

bool sloodle_set_loginzone_pos (mixed $pos)
  • mixed $pos: Either a string vector "<x,y,z>" or an associative vector array {x,y,z}
sloodle_set_loginzone_region (line 223)

Sets the name of the region where the site-wide LoginZone object was most recently rezzed.

void sloodle_set_loginzone_region (string $region)
  • string $region: A string containing the name of a region (e.g. "virtuALBA")
sloodle_set_loginzone_size (line 198)

Sets the size of the site-wide LoginZone object (stored in the Moodle configuration table).

bool sloodle_set_loginzone_size (mixed $size)
  • mixed $size: Either a string vector "<x,y,z>" or an associative vector array {x,y,z}
sloodle_set_prim_password (line 91)

Sets the site-wide Sloodle prim password from the configuration table.

Note: this functio peforms no validation on the input value, except to determine that it is a string.

bool sloodle_set_prim_password (string $password)
  • string $password: A string containing the prim password
sloodle_vector_to_array (line 400)

Converts a string vector to an array vector.

String vector should be of format "<x,y,z>". Converts to associative array with members 'x', 'y', and 'z'. Returns false if input parameter was not of correct format.

mixed sloodle_vector_to_array (string $vector)
  • string $vector: A string vector of format "<x,y,z>".

Documentation generated on Tue, 04 Mar 2008 15:08:40 +0000 by phpDocumentor 1.4.0