Source for file linker.php

Documentation is available at linker.php

  1. <?php
  2.     /**
  3.     * Sloodle Presenter linker.
  4.     * Allows a Sloodle Presenter object in-world to request a list of entries for a presentation.
  5.     *
  6.     * @package sloodle
  7.     * @copyright Copyright (c) 2007-8 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.     // This script should be called with the following parameters:
  14.     //  sloodlecontrollerid = ID of a Sloodle Controller through which to access Moodle
  15.     //  sloodlepwd = the prim password or object-specific session key to authenticate the request
  16.     //  sloodlemoduleid = ID of a presenter
  17.     //
  18.     // Status code 1 will be returned on success.
  19.     // Each data line specifies one entry in the presetnation, as follows:
  20.     //  type|url|name
  21.     // The type may be "image", "video" or "web".
  22.     // In future, scaling values may be applied.
  23.     //
  24.     
  25.  
  26.     /** Lets Sloodle know we are in a linker script. */
  27.     define('SLOODLE_LINKER_SCRIPT'true);
  28.     
  29.     /** Grab the Sloodle/Moodle configuration. */
  30.     require_once('../../sl_config.php');
  31.     /** Include the Sloodle PHP API. */
  32.     require_once(SLOODLE_LIBROOT.'/sloodle_session.php');
  33.     
  34.     // Authenticate the request, and load a slideshow module
  35.     $sloodle new SloodleSession();
  36.     $sloodle->authenticate_request();
  37.     $sloodle->load_module(SLOODLE_TYPE_PRESENTERtrue);
  38.     
  39.     // Start preparing the response
  40.     $sloodle->response->set_status_code(1);
  41.     $sloodle->response->set_status_descriptor('OK');
  42.     
  43.     // Output each URL and entry type
  44.     $entries $sloodle->module->get_entry_urls();
  45.     if (is_array($entries)) {
  46.         foreach ($entries as $entry{
  47.             // Convert our type back to a legacy type for sake of old Presenters
  48.             $type $entry[1];
  49.             switch ($entry[1])
  50.             {
  51.             case 'PresenterSlideImage'case 'SloodlePluginPresenterSlideImage'$type 'image'break;
  52.             case 'PresenterSlideWeb'case 'SloodlePluginPresenterSlideWeb'$type 'web'break;
  53.             case 'PresenterSlideVideo'case 'SloodlePluginPresenterSlideVideo'$type 'video'break;
  54.             }
  55.  
  56.             $sloodle->response->add_data_line(array($type$entry[0]$entry[2]));
  57.         }
  58.     }
  59.     
  60.     // Output our response
  61.     $sloodle->response->render_to_output();
  62.     
  63. ?>

Documentation generated on Fri, 17 Jul 2009 11:01:45 +0100 by phpDocumentor 1.4.0