180 likes | 297 Views
Exposing Moodle. The programming behind SLOODLE. Peter R. Bloomfield University of the West of Scotland. SLOODLE is funded and supported by Eduserv SLOODLE is supported by San Jose State University. What is SLOODLE?. Integration of Moodle and “Second Life”
E N D
Exposing Moodle The programming behind SLOODLE Peter R. Bloomfield University of the West of Scotland SLOODLE is funded and supported by Eduserv SLOODLE is supported by San Jose State University
What is SLOODLE? • Integration of Moodle and “Second Life” • Totally different interface and experience • Our research explores how and why
“WebIntercom” Moodle Chatroom “MetaGloss” Moodle Glossary Modules • SLOODLE ‘objects’ in SL typically correspond to activities in Moodle
Users & Avatars • Moodle user accounts correspond to SL avatars • SLOODLE stores this association in the database
Second Life Moodle Communication • Second Life talks to Moodle using HTTP • Communication is text only (UTF-8) http
Limitations • SL uses “Linden Scripting Language” • Very limited processing • Very limited memory • HTTP responses are max. 2048 bytes • Data must be concise and structured • Parsing must be simple • Conventional web services are not possible
Getting the data out • Dedicated “linker scripts” access Moodle DB • PHP scripts which link SL with Moodle • Using Moodle’s DB functions (get_record, etc.) • Will use web service API in future! • Old versions of linker scripts are maintained • Using HTTP for input/output • WebIntercom linker script: • Input: chat messages from SL • Output: recent chat messages from Moodle
Simple example (version linker): 1|OK0.4|2009031003 Complex example (WebIntercom): 1|OK|10101||||cb62238b-5ff9-44b4-b705-4ac11cb05b68292|Peter Bloomfield|enter298|Peter Bloomfield|blah blah blah299|Pedro McMillan |(SL) hello world HTTP responses
MOODLE Controller (Object) (Object) SECOND LIFE Security • Need to verify authenticity of requests • Uses internal passwords • SLOODLE Controllers: • Activity modules • Control SLOODLE access to their course Course Course
SLOODLE PHP API • Lots of tools = lots of linker scripts • Needed a re-usable API to help • Object-oriented • Compatible with PHP 4 and 5
Sessions • Linker scripts create a SloodleSession object • Has many members and methods • Supports: • Input (HTTP parameters) • Output (HTTP response) • Abstracted data access • Security • And more...
Why? • Simplification • Keeps low-level code out of linker scripts • Makes them easier to read/write • Re-use code • Quicker to develop later tools • Easier to debug/fix general problems • Abstraction • Copes with version changes • Greater portability potential
Example Linker -- Setup $sloodle = new SloodleSession(); $sloodle->authenticate_request(); $sloodle->load_module('chat', true); $sloodle->validate_user(false);
Example Linker -- Processing $message = $sloodle->request-> optional_param('message', null); if ($message != null) $sloodle->module->add_message($message);
Example Linker -- Output $sloodle->response->set_status_code(1); $sloodle->response->set_status_descriptor('OK'); $messages = $sloodle->module->get_chat_history(); foreach ($messages as $m) { $author = $m->user->get_user_name(); $sloodle->response->add_data_line( array($m->id, $author, $m->message)); } $sloodle->response->render_to_output();
The Road Ahead • Consolidate functionality • Keep related code together • Make it easier for new developers • Work-out some ‘quirks’ in the system • Porting to other platforms? • We love Moodle though!
Thanks! Visit us online: www.sloodle.org Or contact me: peter.bloomfield@uws.ac.uk