---------------------------------------------- WebCT CE4 -> Moodle import script Written by Dan Stowell (c) 2005-2006 Released under the GNU Public Licence ---------------------------------------------- These files come with NO WARRANTY. Tested using content exported from WebCT CE 4.1.5, with Content Migration Utility schema version 2.16. THIS SCRIPT REQUIRES MOODLE 1.6 OR LATER. The script is able to import a course file exported using WebCT's "Content Migration Utility". Import of all the commonly-used WebCT "tools" is achieved (the exceptions being CD-ROM, Whiteboard, & Student Homepages, none of which have a direct equivalent in Moodle). Quiz/Survey import may be patchy since the data is much more intricate than for other tools, and is relatively susceptible to variations in data format. It is extremely unlikely that the script will work perfectly with a different version of WebCT than the one listed above. You may need to rework the PHP code if you want it to work in other contexts. The file "changelog.txt" includes notes about some known issues in the importing process. IMPORTANT: This will NOT import WebCT "course backups" - ONLY files created using the Content Migration Utility (available to the WebCT server administrator). WebCT "course backups" are encrypted and therefore impossible to process. ALSO IMPORTANT: This will ONLY work in Moodle 1.6 and later, not in Moodle 1.5, because of certain architectural changes. It is possible to download a version for Moodle 1.5 if you are familiar with using CVS, just get an export of the files as at June 1st 2006. _______________________________________________________________________ HOW TO USE: 1) Place these files, in their "webctimport" folder, within the Moodle main directory. 2) Use WebCT's "Content Migration Utility" to produce a Zip file for each course you want to migrate, and place the Zip file(s) in the "webctimport/incoming/" folder. 3) Visit http://...your..../moodle/webctimport/index.php (you'll need an admin login for your Moodle installation) and follow the onscreen instructions. The script does not assign teachers or students to the newly-created course(s) - the Moodle administrator(s) will have to do that. An "Import log" is created and loaded into the Moodle course, listing the tools that have been imported and any problems that may have occurred (as well as warning about tools that cannot be imported). A "Teacher Welcome" page is also created, to try and help orient the freshly-migrated teacher. _______________________________________________________________________ AUTOMATING: The script requires admin login, so if you want to automate this process (e.g. import a batch of files using a Perl script) you may need to rework the security (for example, deactivate the requirement to be admin, and replace it with .htaccess-based authentication). Once you've done that, it should be possible to script the process by automatically calling URLs along the lines of .../webctimport/index.php?action=process&crscode=BIOL1001&zipfile=biolstuff.zip _______________________________________________________________________ HOW THE SCRIPT WORKS - ORDER OF PROCESSING: The script runs through the data structure in four passes: 1) The first pass processes the main XML manifest and loads the resources listed - it loads files into the course's filespace, and creates entries in the various modules' tables. 2) The second pass creates the structure in terms of "course sections", processing the sub-manifests to translate each Organizer Page or Content Module into a separate section. 3) The third pass processes "webctproperties" files to add that data to the relevant module activities. 4) The fourth pass adds the module activities into the correct course sections, copying their link names from the sub-manifests as it does this. The script builds up a fairly hefty array of data as it goes through these passes, stored in the global variable $data. (Passes 2/3/4 don't read the main manifest from scratch, but instead use the info in $data.) The log page is built up in a global variable $logpage. The first pass uses PHP's "Expat" library to parse the main manifest file. Most of the other processing (e.g. of "webctproperties" files) is done by lazy pattern-matching using regular expressions, and doesn't validate the XML before attempting to process it. _______________________________________________________________________ TROUBLESHOOTING TIPS: * Note that the course is HIDDEN when first created, and has no teachers assigned. This means that ONLY the admin user will be able to verify its existence. The admin will in most situations need to assign teachers. * The import log is saved to the course as a hidden resource. If the course appears mangled, the first thing to do is to check the import log (which should have been created as a file resource and added to the course's topmost section).