| « Manager Tools - an intriguing business model | Changes in the last ten years » |
During the past couple of weeks I've been working on building a major intranet site. It's based on two systems (ExponentCMS and Moodle), which naturally brings the challenge of providing a seamless experience for users.
As with all integrations there are two parts to it:
- User login
- Look & feel
With Moodle, getting half-way to the utopia of single-sign-on is quite easy. You just configure it to look at the ExponentCMS database for usernames and passwords. Users then register once (in ExponentCMS) and use the same username/password on the Moodle part of the site.
It's still not seamless; single-sign-on is currently just a dream. But at least it feels partially unified.
The look and feel is slightly harder... I started with creating the HTML/CSS template, based on the client's design requirements - but then this needs translating into both an ExponentCMS and a Moodle theme. ExponentCMS is extremely flexible with regards to layout and design. There really are no constraints as you've got total control over the main template and also over the way each of the modules (such as menus, breadcrumbs etc) display.
Out of the box, most of ExponentCMS's modules have table based layouts. I've managed now to create CSS (ie. far more accessible) versions of most of the important ones, like top and side menus.
Moodle, in comparison, is far less-flexible. It has a fixed layout of header, three columns (laid out with a table), and a footer. But alongside that is a hugely comprehensive CSS structure that allows the designer control over every aspect of display (except that basic layout). So, with a bit of work and hunting around for the right part of the CSS file to edit, it's possible to make a Moodle site match most other CSS-based websites.
The thing I've always struggled with is how to provide a consistent navigation interface for users - so they can easily jump between the two systems. Up till now, I've got over this problem by creating a hard-wired version of the top menu inside the Moodle header. This has a major disadvantage - in that, if the menu changes in the ExponentCMS part of the site, it needs to be manually changed in the Moodle part. Not friendly!
So, I took the plunge, and decided to learn how to get the Moodle site to read the ExponentCMS database. It wasn't as hard as I feared. It could easily be translated to use any CMS that works with pages in a hierarchical structure (eg. Etomite).
<!-- To create a Moodle top-menu from ExponentCMS section data -->
<!-- Mark Berthelemy - 14th June 2006 -->
<!-- www.learningconversations.co.uk -->
<!-- ############################### -><!-- start a div to hold the top menu -->
<div id="topmenubar"><!-- it's list-based - like all good menus, which means it degrades well -->
<ul><!-- Make a connection to the exponent database -->
<!-- Use the same settings as your ExponentCMS site -->
<?php// SETTINGS TO CHANGE
$expdbhost = 'localhost';
$expdbuser = 'root';
$expdbpass = '******';
$expdbname = 'exponent';// A relative link to the base URL. The index.php?section= is critical
$exponenturl = '/exponent/index.php?section=';// END OF SETTINGS TO CHANGE
// Make the connection to the database host
$expconn = mysql_connect($expdbhost, $expdbuser, $expdbpass) or die ('Error connecting to mysql');// But don't make a permanent connection to the exponent database. This will break the Moodle connection.
// Retrieve all the data from the "Section" table of the exponent database
$result = mysql_query("SELECT * FROM $expdbname.exponent_section WHERE Parent =0",$expconn);// store the record of the "example" table into $row
while ($row = mysql_fetch_array( $result )) {// Print out the contents of the entry as a list
echo '<li><a href="'.$exponenturl.$row['id'].'">'.$row['name'].'</a></li>';
}
?>
</ul>
</div> <!-- end of top menu bar --><!-- END -->
How did I learn that? I skimmed a couple of web-based tutorials about connecting to mysql databases. I searched for people who'd tried to connect to multiple databases at once and picked up on the problems they'd had. I got examples from the php.net and mysql.com sites on how to create queries and extract the data as a list. And now I'm recording it here so I don't forget, and to help other people going through the same process.
I wouldn't have got to this point by attending a mysql course, or reading a linear book. I started with a problem and looked for answers to that specific problem. In the process I've also gained generic, transferable knowledge about dealing with mysql & php.
Is this an approach that only applies to programming? I don't think so. However, the programming community seems much more easy about sharing knowledge than any other community I'm part of. Without that open sharing of problems and answers I would have probably given up and gone back to the old way of creating these menus manually.
The thing about programming is that it's a creative activity, and it's not difficult to achieve some results quickly. Which means it lends itself to an apprenticeship model of learning extremely well. John Seely-Brown & John Hagel explore this further in their paper "From Push to Pull - Emerging Models for Mobilizing Resources".
1 comment
Well thanks for making me feel stupid on a Friday afternoon I will definitely be talking about psychology next time I see you.