Release of our psychological test Flash module has been delayed slightly as we are deciding on a name for it and Timothy Takemoto is working on some example tests. It will hopefully be released under GPL sometime in the next week or so.
Here's what I'm working on as a start for Moodle Flash integration for anyone interested. This will be finished and released under a GPL license late in January. Much of the functionality I discuss below is already implemented in the psychological test activity and I'm now just working on generalising the code to create a framework for integrating all kinds of Flash movies into Moodle as activities.
Thanks to Josep and Tim for providing me some funds to support myself while I work on this!
Flash Movie Activity Module
I'm working on a generic Flash movie activity module. This activity module will fit into the Moodle activity module framework so that activities based on repurposable or non repurposable Flash movies can be created and configured in courses just as any other activity can and they can 'talk' to Moodle.
What the Activity Creator will see.
Integration will include :logging of user actions. gradebook integration. Allow flash movies to send grades to the server. automatic detection of flash movies installed in a sub directory. First step of config will be to allow an activity creator to choose among movies installed, choose a name for the activity, set the maximum grade. Second step will be movie specific. Movies will be configured in one of three ways : If available use a movie specific Flash movie which will generate XML to save which will be sent to the Flash activity movie. Or use a movie specific HTML form designed by the movie designer data from which will be converted to XML and sent to the movie. Or use a default HTML form in which the activity creator can enter XML directly which will be passed to the movie. back up features so all user data, grades and configuration data for a movie can be backed up and restored as part of the Moodle course back up and restore.
What the Flash Movie Designer Will See.
The Flash movie desginer will make use of some simple methods on an actionscript class to save and fetch data to the Moodle database.
Functions will be able to send the following commands to Moodle :Fetch init data. Fetch and save persistent data. Save a grade.
The Movie designer will not deal with XML directly, this will be done for him / her by the class. They will pass objects of data to the class methods.
Commands to be sent to the server will be cached until a go() method is invoked, thus several commands can be sent at once. When the data has been fetched callback functions will be called passing a data object received to the function.
Debugging mode will be supported to pop up a window everytime XML is sent or received showing the XML sent and received.
In the case of a communications error the prebuilt class will deal with the error by popping up a dialogue box with an error message.
The Flash activity Movie is passed a unique unpredictable key generated by PHP through the FLASHVARS parameter in the HTML that embeds the acitivity in a page. This valid key is stored on the server side along with information about what course and what instance of the activity the user is accessing. We always use this session information or information from the Moodle session variable we can rely on on the server side when we need to know who the user is, what activity this is.
The Web Services opened up must however be treated as a public interface which may be accessed by something other than our Flash Movies, we will be sure that a user can only modify their own data or may only alter movies' init data if they are teachers.
We will use three main database table to store info for all kind of different movies :
They will all have one 'TEXT' column in which we store XML as well as timemodified, userid, flashid columns and others. This will allow us to have great flexibility in what we store in the database and meet the storage needs of many different Flash Movies.
This is just a start. I hope I will have time to add some more features to the activity module in the next month or later. Also I intend to make it easy for an activity designer to add functionality on the server side to extend this module.