View Full Version : Help with Flash and Moodle
matbury
02-28-2008, 03:55 PM
For those of you who don't know what Moodle is, it's an open source learning management system that is used by literally thousands of universities and schools around the world. It's written in PHP and is a dynamic database driven modular system. For more info see:
http://en.wikipedia.org/wiki/Moodle
and
http://moodle.org/
Help needed:
The present Flash activity module, developed by Jamie Pratt is out of date (written for Flash MX 2004) and can't incorporate new developments in Actionscript for e-learning. I'm trying to gather help and support to create a much simpler new Flash module for Moodle, which is basically a PHP wrapper so that it will be upwardly compatible with future versions of Flash.
Why am I posting this here?
I'm a Flash developer working in e-learning and at present it's difficult to incorporate Flash into Moodle. There's a huge demand for what Flash has to offer in e-learning and there's a great potential for Flash developers to earn a crust doing freelance work for schools, companies and universities. It's in everyone's interest to make Flash easy to use with Moodle.
I've attached a copy of the NEWMODULE.zip file which is a PHP template for developers who want to create a new Module. I'm no PHP developer and I'm new to back-end programming in general but I'm a fast learner and very committed to making this project a success. At the moment, I'm taking baby-steps and getting a clearer understanding of how the Moodle system works.
For a clearer description of what I'm up to, I'll copy and paste the Moodle forum post I've written here. To view the post on the forum, you have to sign up to Moodle's forums, which is free... pretty much the same as this one. I'll get the post now.
matbury
02-28-2008, 03:59 PM
Moodle forums: http://moodle.org/login/index.php
New Flash module thread:
http://moodle.org/mod/forum/view.php?f=603
Copy of post:
For any new-comers, here's a summary of what I'm proposing so far:
Already agreed upon by contributors:
* Create a new Flash module that integrates SWFs into Moodle, similar to the old Flash Activity Module.
* The new module must be Flash version independent - that is, you can use any version of Flash from MX 2004 (version 6) to Flash CS3 (version 9), and be upwardly compatible with any future versions of Flash. i.e. a PHP wrapper.
* Create a library of video tutorials and top-notch documentation with example source code to give the maximum possible help to anyone proposing to use this system. Making it accessible will be vital to its success.
Further proposals:
* The database and PHP code should be geared toward a dynamic media handling system using XML so a working module installation would have something like:
* Folders containing media GIFs, JPEGs, PNGs, FLVs, MP3s, SWFs (media only) and TXT.
* A folder containing XML files.
* A folder containing SWF presentations.
Any SWF presentation can, therefore, use any of the resources in the folders, negating the need to make a large number of duplicates as in the SCORM model, and making a very efficient, dynamic organisation of resources that is easy to maintain and edit. e.g. If you want to change a graphic or you find a typo, you don't have to open up every single zipped SCORM package that contains it to edit it. This is pretty much the same way that website media is handled anyway.
A developer will be able to create a presentation SWF, for example a quiz, that contains no media. The SWF loads an XML file that contains the questions and answers and references any necessary media such as video, MP3 files and images which make up a particular quiz. In this way, only a small number of SWFs are necessary to create a great number of quizzes.
I believe that, with this model, a new Flash activity module will be extremely powerful and versatile. Developers and resource designers will be free to explore the possibilities and come up with creative new ways to convey information and teach skills.
* There are currently 2 Javascript files that make it quick and easy to embed Flash: swfobject.js and AC_RunActiveContent.js. Although swfobject is by far the best option to date, some Flash users may want to use the standard AC_RunActiveContent.js that Flash CS3 publishes automatically just for convenience. A third, non-javascript version, would also be desirable.
Have I missed anything?
Comments, criticisms, ideas and support are all welcome. I'm a Flash developer, AS 2.0 and AS 3.0 including OOP, and just getting started in PHP and SQL. There are a number of areas that I'll need a lot of help with, so don't be shy, come and give me a hand!
Something else has occurred to me about this proposed framework/system - it would be very easy for developers to create 3rd party lessons (SWF presentations) that would be simple and easy to distribute and deploy. So if your Actionscript skills aren't advanced or you don't have the precious time to create your desired presentations, you could just get some that are ready-made 'off-the-shelf'. You'd get a SWF, a corresponding XML file (as a template/example) and some sample media (images, audio, video,etc.) just to see how it works, then the course designer just has to substitute the XML data and media. How easy would that be, especially with good docs and tutorials?!!
Being a newbie to PHP and SQL, I've been taking baby steps. Here's what I've been up to (comments and advice are most welcome):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
// Database access info
include("db.php");
// Connect to database
mysql_connect($host,$user,$pass);
mysql_select_db($database);
// Retrieve entire table (it's very small at the moment)
$result = mysql_query("SELECT * FROM `aa_mdl_newflash`");
// Get the table row number from the URL query string - e.g. ?rowno=3
// This will ultimately be retrieved from another MySQL table (courses + lessons)
// We also need to retrieve the lesson's corresponding XML file
$row = $_GET['rowno'];
// Make sure the 'rowno' query string variable isn't greater
// than the number of rows in the database table
// (This needs to be more dynamic i.e. get the length of the SQL table)
if ($row > 8) {
$row = 1;
}
// Assign the data to variables
$url = mysql_result($result,$row,"filename");
$swf = mysql_result($result,$row,"name");
$width = mysql_result($result,$row,"width");
$height = mysql_result($result,$row,"height");
$version = mysql_result($result,$row,"version");
$bgcolor = mysql_result($result,$row,"bgcolor");
// Always close the database connection when
// you've finished with it!
mysql_close();
// Define HTML page <head> parameters including CSS
$css = "<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Embed using PHP and SWFObject experiment</title><style type=\"text/css\">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
color: #666666;
}
-->
</style>
</head>";
// SWFObject embed code uses variables retrieved from MySQL database
// and a separate swfobject.js script that needs to be included
/*
SWFObject can also pass extra variables into the Flash SWF
It would be nice to be able to get the lesson's corresponding XML file
and pass it in here.
Does anyone know if you can pass an XML object in this way?
*/
$embed_swf = "<body><script type='text/javascript' src='swfobject.js'></script>
<div id='content'>To view the Flash content, please enable JavaScript in your browser.</div>
<script type='text/javascript'>
var so = new SWFObject('$url', '$swf', '$width', '$height', '$version', '$bgcolor');
so.addParam('wmode', 'transparent');
so.write('content');
</script>";
// Print out the database SWF embed data to the screeen
$embed_info = "<br />
<p class=\"style1\">This is an experiment using PHP code to output Javascript code to embed a SWF. If this works, you should see a Flash movie clip on the screen above. The specific variables to embed the SWF were retrieved from a MySQL database. Here they are:</p>
<p class=\"style1\">SQL rowno: '$row'</p>
<p class=\"style1\">SWF url: '$url'</p>
<p class=\"style1\">SWF name: '$swf'</p>
<p class=\"style1\">SWF width: '$width'</p>
<p class=\"style1\">SWF height: '$height'</p>
<p class=\"style1\">SWF version: '$version'</p>
<p class=\"style1\">SWF bgcolor: '$bgcolor'</p></body>";
// Display the page
echo $css.$embed_swf.$embed_info;
?>
</html>
CyanBlue
02-28-2008, 04:32 PM
I don't understand what type of help you need though... The code seems to be okay... ;)
matbury
02-28-2008, 05:02 PM
Yes, this code works, but it's just the beginning. If you can check out the NEWMODULE.zip folder, you'll see that it's just a blank template with the PHP framework to integrate with the Moodle database.
We need to write the scripts to install the new Flash module, I can write the SQL for that, it's pretty simple, and to retrieve the user's course details and the particular module's instance details to put the results into the Moodle gradebook.
I'm going to break down the problem into basic steps but as I said, I'm a newbie to server side stuff, so I need pointers, advice and constructive criticism. I'm trying to do as much of this as I can myself for the learning experience, but there's a seriously beneficial side to getting this module working for everyone.
Gotta get back to my PHP MySQL tutorials!
matbury,
I'm doing similar work, but with Ilias.
http://www.ilias.de
I think you'll find that Moodle is really a content management system, where ilias is a true LMS. If you are interested in collaborating on this, let me know. Right now, I'm setting up a sandbox. I've also got a video server up, but am working on it and a test server as well.
I agree that Flash for the front end is the way to go. I'm doing the whole thing from scratch in AS3.
producerism
03-22-2008, 07:08 PM
matbury,
I'm doing similar work, but with Ilias.
http://www.ilias.de
wow, thanks for the link. very helpful!
matbury
03-23-2008, 11:04 AM
Hi Wino,
Sorry I haven't replied sooner. I've been so busy with a couple of projects.
I had a look at ILIAS - pretty impressive! I'm gonna have a go at downloading and installing it to see which I prefer - Moode or ILIAS. One question that could be really helpful: Of all the open source LMS's available, why have you chosen ILIAS?
I've got a model of the FlashMod working but none of it is integrated with Moodle's API yet. It's all incredibly vulnerable mysql_query() stuff that needs to be made secure and adapted for use with an LMS.
One thing that has occurred to me is that with all the media that is likely to get uploaded onto the server, it's essential to keep track of all of it. I'm currently working on two fronts:
1. Using PHP scripts to search through the media directories to create a list of all the media present and make it sortable and searchable.
2. Creating a database of uploaded media with descriptive details and easy to copy and paste URL links to make it really easy to create/edit XML files for use with Flash.
Here's a link to a list of presentations that use the system.
http://watchtvlearnenglish.com/moodle/mod/flashmod/index.php
It's the only page which doesn't include an editing form (i.e. I don't want to give everyone here access to my databases!). If you'd like a copy of the code I've got so far, send me an e-mail or Skype me. It is very, very rough and unfinished by the way.
There were several reasons why I settled on Ilias:
1. It is more structured, project-wise than Moodle.
2. Moodle grew from an open-source LCMS into an LMS; Ilias was designed as an LMS from the ground up.
3. Ilias is already SCORM 2004 3rd Edition (V1) compatible. I have found very few commercial applications that are already V1 compatible.*
4. The Joint Forces COS has installed a copy... the US Military is on the cutting edge of eLearning, and that's quite an endorsement in itself.
*SCORM 2004 3rd Edition Version 1 is the latest and greatest SCORM. See adlnet.gov for details.
Anyway, I never installed Moodle, and just got Ilias functional this weekend. So far, it is easy, well-documented, and very versatile.
I will be writing some Flash interfaces for it, as I continue. I am still in the "learning phase" of this project. To date, I have less than $200 invested, and I already have a functional LMS, albeit vacant and not very visually appealing. That will all be addressed as I continue to learn more.
I'm not putting down Moodle. When I first looked into it, it was still be reported as an LCMS. Had that not been the case (I realize now that it is a true LMS), I may never have found Ilias.
matbury
03-25-2008, 11:39 AM
Yeah, Moodle isn't and probably won't ever be SCORM compliant. It has a SCORM simulator plug-in but it doesn't give full support and at the moment it doesn't work - they're trying to find a SCORM specialist to fix it for them!
I've looked into the SCORM thing and I've even produced a SCORM compliant e-learning package as an experiment. I have to say, I'm not impressed. I can see why lots of people are rushing to adopt it but I think it's too bulky and inefficient. The two worst things I can see about it are:
1. It specifies that each SCORM package has to be able to run locally on the user's computer. Therefore it cannot be database driven or have dynamic content.
2. It also specifies that everything that the SCORM package needs has to be contained within the zipped package directory. This doesn't allow content sharing which kind of goes against what I understand as the 'shareable' bit in the SCORM acronym. This means that if you have any multi-media content that is used throughout your LMS, such as spoken feedback or logo images, you have to make a copy for each individual SCORM package. Could you imagine if a client wanted to change their logo?!!
I've created a Wiki (http://matbury.com/wiki/)for my FlashMod project. I've only just started it so there's nothing to look at yet. I also have a working model of the FlashMod in pure PHP, Javascript and MySQL. It should never be deployed on the web in this format as it's not at all secure.
desighforce
03-30-2008, 04:27 PM
Hi,
I too develop e-learning content using flash. And I too have had the Moodle experience and it is not pretty.
What I had to do to keep things neat and tidy is send the data from the swf via php to the mysql database separately from the Moodle mess.
I use externalInterface to capture the studentID from the session info, and send that along with the objectID/courseID to a separate database/table in MySql. This has made everybody happy except for those who consider themselves developers who use the templates and other items within Moodle.
Sorry I can't offer any other info or advice.
Good luck!
matbury
03-31-2008, 12:47 AM
Hi desighforce,
It's nice to hear from someone in a similar situation. I'm very interested in finding out more about your solution to the Flash in Moodle mess. I've got a basic working model but I haven't got as far as retrieving the session data yet.
Could you possibly send me a copy of the code? It'd really help me a lot.
BTW, I've been in touch with Jamie Pratt, who created the original 3rd party Moodle Flash plug-in, and he's putting together some ideas for an completely new version centred around using AMFPHP. It sounds promising but he's unlikely to do anything with it for the next few months (He reckons around 5 months).
I've posted some very basic code on my wiki now. (http://matbury.com/wiki/index.php?title=Main_Page)
desighforce
03-31-2008, 11:36 PM
Hello Matbury;
I will post code sample tomorrow as I have all items at work.
Cheers
matbury
04-01-2008, 12:50 AM
Great, thanks a million!
desighforce
04-01-2008, 11:12 PM
Matbury,
I sent you a PM with the code samples.
Hope it helps.
Cheers
matbury
04-02-2008, 10:22 AM
Thanks desighforce, I'll check it out.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.