Tuesday, March 4, 2008

Making Moodle Think It's Blackboard CE

The Problem

We're experimenting with the Moodle learning management system at the moment. It may let us do some nice things including
  1. Letting potential students register themselves in a moodle course and perform some pre-tests before they enrol.
  2. Let us better handle small courses with 10's of thousands of students (Such as an online oh&s induction) since per student licencing is no longer an issue and client PC's won't whine about popup blockers and lack of java like they do with Backboard CE. (this is fine for a year long course but regular users don't want to download and install java, then disable all their popup blockers just to do a 45 minute course)
We've put a lot of effort into writing the middleware between our Student management system (QLS) and Blackboard CE (formerly WebCT) and we'll need to get it talking to moodle if we ever want to role it out in production.

The Solution

Our middleware exports IMS enterprise files. These are XML files containing lists of courses with the students and teachers to go in them. It's an industry standard so if an IMS enterprise file works with one system it should naturally work with any system.

There's always problems!

Blackboard CE doesn't quite handle IMS Enterprise files the way moodle does. The big differences are
  1. CE can include passwords which we will need for some of our users. They use a custom element in the person record to do this. Moodles IMS enterprise import doesn't support this. The custom element looks something like mypassword
  2. CE uses the element of an imported person to define how they authenticate. E.g. LDAP, Internal etc.
So I made some small tweaks to moodles IMS enterprise import module to make it behave like Blackboards.

The important lines are

// Added By SB. Look for a password Blackboard CE style

if(preg_match('{.*?(.+?).*?}is', $tagcontents, $matches)){
$this->log_line("password would be '$matches[1]' i hope.");
$person->password=trim($matches[1]);
}

and

$this->log_line("The source is '$person->source' is that good?");

if ($person->source=='WebCT') {
$person->auth = 'manual';
} else {
$person->auth = 'ldap';
}

$this->log_line("added with auth of '$person->auth' so does it work");

You'll want to change the if test to suit your own organisations business rules. E.g. mapping source ID's to the authentication sources you want. If your really keen make it a config option and send me your improved version.

You can download the full code from here and paste it over the top of moodle/enrol/imsenterprise/enrol.php

Regards

Stephen

Stephen

No comments: