// 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 = ''; // Convert the plugin class names back to the simpler slide type name.
// message = the body of the message. // // The following parameters are optional: // firstmessageid = if specified, only messages whose ID number is greater than or equal to this value will be returned in the chat history // sloodledebug = if 'true', then Sloodle debugging mode is activated // /** 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 chat module $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('chat', true); // Attempt to validate the user // (this will auto-register/enrol users where necessary and allowed) // If server access level is public, then validation is not essential... otherwise, it is $sloodleserveraccesslevel = $sloodle->request->get_server_access_level(false); if ($sloodleserveraccesslevel == 0) { $sloodle->validate_user(false); } else { $sloodle->validate_user(true); } // Has an incoming message been provided? $message = sloodle_clean_for_db($sloodle->request->optional_param('message', null)); if ($message != null) { // Add it to the chatroom. if (!$sloodle->module->add_message($message)) { add_to_log($sloodle->course->get_course_id(), 'sloodle', 'add message', '', 'Added chat message to chatroom', $sloodle->request->get_module_id());
// sloodleblogvisibility = the visibility of the post: public, site, private (or draft) // // // Returns status code 1 if successful in simply checking authorisation and blogging ability. // Returns status code 103 is successful in adding blog entry. // Can also return various blog-specific error codes. /** 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 as user-specific, and load a blog module $sloodle = new SloodleSession(); $sloodle->authenticate_user_request(); $sloodle->load_module('blog', false); // No database data required // Attempt to validate the avatar $sloodle->validate_avatar(); $sloodle->user->login(); // Is blogging enabled? if (!$sloodle->module->is_enabled()) { $sloodle->response->quick_output(-10401, 'BLOG', 'Blogging is disabled on this site.', false); exit; } // Check if the user has permission to create blog entries if (!$sloodle->module->user_can_write()) { $sloodle->response->quick_output(-10402, 'BLOG', 'User lacks permission to write blog entries.', false); exit; } // Check for our additional parameters
// sloodlepos = position of the PrimDrop (vector <x,y,z>) // // If the submission was successful, the status code will be 1. // Otherwise, the codes above may be returned (although -10204 will only appear as a side effect). // Status code -103 will appear if some assignment submission to the database fails. // /** 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, load the Sloodle Object assignment module, and validate the user $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('sloodleobject', true); // Has user data been omitted? $uuid = $sloodle->request->get_avatar_uuid(false); $avname = $sloodle->request->get_avatar_name(false); if ($uuid == null && $avname == null) { // Just query the assignment details $sloodle->response->set_status_code(1); $sloodle->response->set_status_descriptor('OK'); $sloodle->response->add_data_line($sloodle->module->get_name()); $sloodle->response->add_data_line(strip_tags($sloodle->module->get_intro())); $sloodle->response->render_to_output(); exit; } // Some user data has been provided, so make sure we can validate the user $sloodle->validate_user(); // Check the requirements for allowing submissions
require_once SLOODLE_LIBROOT . '/sloodle_session.php'; // Process incoming data $sloodle = new SloodleSession(); // Check what type of authentication we are using $course_centric = false; if ($sloodle->request->get_controller_id(false) == null) { // Attempt user-centric authentication $sloodle->authenticate_user_request(); $sloodle->validate_avatar(); } else { // Attempt course-centric authentication $sloodle->authenticate_request(); $course_centric = true; } // Load the AviLister module $sloodle->load_module('avilister', false); // No database data required // Check for other parameters $sloodlelookupavname = $sloodle->request->optional_param('sloodlelookupavname'); $sloodleavnamelist = $sloodle->request->optional_param('sloodleavnamelist'); // Check what mode we are in (0 = course names, 1 = single-lookup, 2 = multi-lookup) $mode = 0; if (!empty($sloodlelookupavname)) { $mode = 1; } else { if (!empty($sloodleavnamelist)) { $mode = 2; } } switch ($mode) { case 0:
// sloodlemoduleid = ID of a chatroom // sloodleinventory = a pipe-separated list of names of items in the obect's inventory // sloodlechannel = the UUID of an XMLRPC channel which can be used to request object distribution // // The following parameter is optional: // sloodledebug = if 'true', then Sloodle debugging mode is activated /** 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 chat module $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('distributor', true); // Fetch the required additional parameters $sloodleinventory = $sloodle->request->required_param('sloodleinventory'); $sloodlechannel = $sloodle->request->required_param('sloodlechannel'); // Attempt to update the inventory $objects = explode('|', $sloodleinventory); if (!$sloodle->module->set_objects($objects)) { // Update failed $sloodle->response->quick_output(-101, 'SYSTEM', 'Failed to update list of objects', false); exit; } // Attempt to update the channel if (!$sloodle->module->set_channel($sloodlechannel)) { // Update failed $sloodle->response->quick_output(-101, 'SYSTEM', 'Failed to update XMLRPC channel UUID', false); exit;
// sloodleserveraccesslevel = defines the access level to the resource (ignored if unspecified) // // The following parameter is optional: // sloodledebug = if 'true', then Sloodle debugging mode is activated // If successful, status code 1 will be returned. // Each data line will contain a concept and definition separated by a pipe: <concept>|<definition> /** 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 glossary module $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('glossary', true); // Has a search term been specified? $sloodleterm = $sloodle->request->optional_param('sloodleterm', null); if (empty($sloodleterm)) { // Just fetch the name of the glossary $sloodle->response->set_status_code(1); $sloodle->response->set_status_descriptor('OK'); $sloodle->response->add_data_line($sloodle->module->get_name()); $sloodle->response->add_data_line(strip_tags($sloodle->module->get_intro())); $sloodle->response->render_to_output(); exit; } // If the server access level has been specified, then validate the user $serveraccesslevel = $sloodle->request->get_server_access_level(false); if ($serveraccesslevel !== null && $serveraccesslevel != 0) { $sloodle->validate_user();
// This person is enrolled and in correct group $allresponses[0][$response->userid]->timemodified = $response->timemodified; $allresponses[$response->optionid][$response->userid] = clone $allresponses[0][$response->userid]; unset($allresponses[0][$response->userid]); // Remove from unanswered column } } } return $allresponses; } } ///// END HORRIBLE HACK! ///// // Authenticate the request, and load a choice module $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('choice', true); // Has an option been specified? $sloodleoptionid = $sloodle->request->optional_param('sloodleoptionid'); if ($sloodleoptionid === null) { // No - we are simply querying for choice data $sloodle->response->set_status_code(10001); $sloodle->response->set_status_descriptor('CHOICE_QUERY'); // Check availability and results $isavailable = '0'; if ($sloodle->module->is_open()) { $isavailable = '1'; } $canshowresults = $sloodle->module->can_show_results(); // Fetch the intro (question) text, but cut everything after the first line $qtext = trim($sloodle->module->get_intro()); $qlines = explode("<br />", $qtext);