Daily Archives: December 22, 2010

ATutor 2.0.2 Released and Basic LTI Support for ATutor is Alpha

I spent my spare time in the last few weeks working on IMS Basic LTI support for ATutor that even included a short trip to their new offices at the Ontario College of Art and Design (www.ocad.ca). First and foremost I need to thank Cindy Li, Greg Gay and Harris Wong of the ATutor team for their great mentoring and quick assistance when I needed it.

The BasicLTI support in ATutor is probably the richest UI for Basic LTI I have built yet – it is informed by all the other designs of how to best put Basic LTI into a course management system. Also, since ATutor also supports IMS Common Cartridge 1.0 – it was the first time I wrote Basic LTI support with a mind to connect it to a Common Cartridge import / export. While that is not yet done (CC 1.1 support), I laid the groundwork for connecting CC 1.0 and Basic LTI 1.0 to form CC 1.1 in an upcoming release. In this release I just focused on getting a good Basic LTI implementation into ATutor content system.

Here is a video of ATutor Basic LTI passing validation: http://www.vimeo.com/18074396

Some of my favourite features include:

  • The ability for either an administrator or an instructor to make a virtual tool placement.
  • The use of the recently-minted ATutor content plugin capabilities which is a clever combination of JQuery and PHP call backs that was design and built by Cindy in *less than a day*.
  • Full support of the IMS Basic LTI Extensions

I also really enjoyed working in the ATutor framework and exploring their module structure. I really love PHP’s flexibility and extendability and found the code very clean and easy to read. I followed a strict MVC pattern in each file that dealt with objects. I handled MVC by simply doing Model work first, Controller work second, and then View at the end. It is framework-free MVC and it is pretty when you do it.

I also decided to build (yet another) object-relational-mapper – I generally hate the way we are forced to code frameworks like Rails, Hibernate, Symfony, etc – they simply are too Draconian in how we write code. All of these frameworks have lots of goodness but the over-obsession on inversion of control makes them too constricting in the long run.

So I wrote my own – I called the Form-Oriented-Object-Relational-Mapper (FOORM). I wrote it an then used it in my Basic LTI implementation. The basic idea is that you describe form data and then make backing tables for the data. FOORM handles: (a) generating forms for edit, (b) generating simple view output, (c) validating input data, (d) creating properly escaped INSERT sequences, and (e) creating properly escaped UPDATE sequences. It also does some cool AUTHZ filtering of forms based on a notion of “control rows”. It does not do much in the way of SELECT support – SELECTs are hand-built.

Later I wll clean it up a bit and write it up but here is a simplified code snippet from the Model portion of Basic LTI for ATutor:

if ( at_form_validate($blti_instructor_form, $msg) ) {
        $fields = array('course_id' => $_SESSION['course_id']);
        $sql = at_form_update($_POST, $blti_instructor_form, $fields);
        $sql = 'UPDATE '.TABLE_PREFIX."basiclti_tools SET ".$sql." WHERE id = $tool".
               " AND course_id = ". $_SESSION['course_id'];
        $result = mysql_query($sql, $db) or die(mysql_error());

The at_form_update gives the properly escaped key/value SET pairs for the data coming in from the
POST request.

The $blti_instructor_form (subset) looks as follows:

$blti_instructor_form = array(

The form array defines how things are to look on the screen as well as the validation rules for the fields and the names of the columns in the database.

In general is is concise and elegant and allows the programmer fine-grain control of the ORM process and yet takes on much of the burden of long INSERT/UPDATE statements and complex validation rules.

I will play with it more in the future and generalize it more and perhaps release FOORM at some point.

All in all a fun few weeks working as an ATutor contributor. I look forward to interacting with the ATutor community as they become interested in Basic LTI.