Example #1
0
//
// Status code 1 will be returned on success.
// Each data line specifies one entry in the presetnation, as follows:
//  type|url|name
// The type may be "image", "video" or "web".
// In future, scaling values may be applied.
//
/** Lets Sloodle know we are in a linker script. */
define('SLOODLE_LINKER_SCRIPT', true);
/** Grab the Sloodle/Moodle configuration. */
require_once '../../sl_config.php';
/** Include the Sloodle PHP API. */
require_once SLOODLE_LIBROOT . '/sloodle_session.php';
// Authenticate the request, and load a slideshow module
$sloodle = new SloodleSession();
$sloodle->authenticate_request();
$sloodle->load_module(SLOODLE_TYPE_PRESENTER, true);
// Load the necessary Presenter plugins
if (!$sloodle->plugins->load_plugins('presenter')) {
    $sloodle->response->quick_output(-131, 'PLUGIN', 'Failed to load any SLOODLE Presenter plugins. Please check your "sloodle/plugin" folder.', false);
    exit;
}
// Start preparing the response
$sloodle->response->set_status_code(1);
$sloodle->response->set_status_descriptor('OK');
// Output each URL and entry type
$slides = $sloodle->module->get_slides();
if (is_array($slides)) {
    foreach ($slides as $slide) {
        // This will store the source URL for the slide
        $slidesource = '';
// With this information, a new entry is made which is not linked to a particular user account.
// As such, the entry is deemed 'unauthorised' and cannot be used until authorised.
// If successful, status code 1 is returned, and the ID of the active object entry is returned on the data line.
// The object should use this to build a URL to send the user to Sloodle for manual object authorisation.
// Unauthorised entries will expire within 5 minutes and be deleted.
/** Lets Sloodle know we are in a linker script. */
define('SLOODLE_LINKER_SCRIPT', true);
/** Grab the Sloodle/Moodle configuration. */
require_once '../sl_config.php';
/** Include the Sloodle PHP API. */
require_once SLOODLE_LIBROOT . '/sloodle_session.php';
// Attempt to authenticate the request
// (only require authentication if controller ID and/or password is set)
$authrequired = isset($_REQUEST['sloodlecontrollerid']) || isset($_REQUEST['sloodlepwd']);
$sloodle = new SloodleSession();
$request_auth = $sloodle->authenticate_request($authrequired);
// Get the extra parameters
$sloodleobjuuid = $sloodle->request->required_param('sloodleobjuuid');
$sloodleobjname = $sloodle->request->required_param('sloodleobjname');
$sloodleobjpwd = $sloodle->request->required_param('sloodleobjpwd');
$sloodleobjtype = $sloodle->request->optional_param('sloodleobjtype', '');
$sloodlecloneconfig = $sloodle->request->optional_param('sloodlecloneconfig', '');
// uuid of an object whose config we want to clone. combined with a layout id of 0. used for rezzing a mothership from a set
// When the set rezzes an item from a layout, it can pass this parameter saying what layout entry the object represented.
// We'll use that to auto-configure the object based on the layout entry configurations.
$sloodlelayoutentryid = $sloodle->request->optional_param('sloodlelayoutentryid', -1, PARAM_INT);
// If the request was authenticated, then the object is being fully authorised.
// Otherwise, it is simply a 'pending' authorisation.
if ($request_auth) {
    // If the request is coming from an authorised object, then use that user as the authoriser for this one
    $sloodlepwd = $sloodle->request->required_param('sloodlepwd');