Source for file active_object_ping_linker.php

Documentation is available at active_object_ping_linker.php

  1. <?php
  2.     /**
  3.     * Sloodle active object ping.
  4.     * Allows active objects to notify the Sloodle installation that they are still 'alive'.
  5.     *
  6.     * @package sloodleclassroom
  7.     * @copyright Copyright (c) 2008 Sloodle (various contributors)
  8.     * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  9.     *
  10.     * @contributor Peter R. Bloomfield
  11.     *
  12.     */
  13.     
  14.     // The following parameters are required:
  15.     //
  16.     //  sloodlecontrollerid = the ID of the controller through which the current object may access Sloodle
  17.     //  sloodlepwd = the prim password or object-specific session key to authenticate access
  18.     //  sloodleobjuuid = the UUID of the object which is active
  19.     //
  20.     //
  21.     // If the check is successful, the status code will be 1.
  22.     // If the object was not found, status code -103 is returned.
  23.     //
  24.     // NOTE: using the "sloodleobjuuid" parameter allows an object to ping on behalf of another.
  25.     // However, the object must be authorised on the controller identified by "sloodlecontrollerid".
  26.     //
  27.     
  28.     
  29.     /** Lets Sloodle know we are in a linker script. */
  30.     define('SLOODLE_LINKER_SCRIPT'true);
  31.     
  32.     /** Grab the Sloodle/Moodle configuration. */
  33.     require_once('../sl_config.php');
  34.     /** Include the Sloodle PHP API. */
  35.     require_once(SLOODLE_LIBROOT.'/sloodle_session.php');
  36.     
  37.     // Authenticate the request
  38.     $sloodle new SloodleSession();
  39.     $sloodle->authenticate_request();
  40.     
  41.     // Get our additional parameter
  42.     $sloodleobjuuid $sloodle->request->get_param('sloodleobjuuid'true);
  43.     
  44.     // Attempt to ping the object
  45.     if ($sloodle->course->controller->ping_object($sloodleobjuuid)) {
  46.         $sloodle->set_status_code(1);
  47.         $sloodle->set_status_descriptor('OK');
  48.     else {
  49.         $sloodle->set_status_code(-103);
  50.         $sloodle->set_status_descriptor('SYSTEM');
  51.         $sloodle->add_data_line('Failed to ping active object.');
  52.     }
  53.     
  54.     // Output the response
  55.     $sloodle->response->render_to_output();
  56. ?>

Documentation generated on Mon, 07 Jul 2008 12:32:11 +0100 by phpDocumentor 1.4.0