How to build a learning repository on Drupal (5.x) and PHP 5.1.x +

This guide gives instructions for building a Learning Object Metadata (LOM) repository on Drupal 5.x and PHP 5.1.x.

Please note that this guide is intended for the version 2 of the repository setup, please read the New Features from the v1 of the Learning Repository at the Features page for a list of changes.

In case of any issues with downloading the content required for the repository or installation problems, please contact the respected authors of the content over the Contact form of the website (in the contact form choose "Web site" under the Category). We will be happy to provide any assistance needed.

Repository

LOM Repository v2 - Features

Completing this step-by-step guide will result in a repository with the following features:

Please note that some of the fields specified in the schema are missing, the fields were left out to fit the needs of the JEM project.

Demonstration: The JEM Learning Repository is built following these guidelines.

New Features from the v1 of the Learning Repository

Optional Features

LOM Repository v2 - Module Requirements

Please click the module names to find out more about the module.

Name Purpose
CCK CCK is used to create the record type that models the learning resource
CCK Author Name Module This is a custom module built to fit the requirements of the learning repository. Due to compatibility reasons, this module cannot be run simultaneously with the CCK Full Name module
Content Templates Contemplate is used to create the views and the input form for the CCK learning resource content type
Date Module The date module is a flexible date/time field type for the cck content module with two ways of storing the date
Image / Image Attach Module Allows users with proper permissions to upload images into Drupal
Profile Module A Drupal core module, must be enabled
Taxonomy Hide Module Enables to setup list of categories which terms will not be listed in reference term list during node view
Taxonomy Import Module This is required for importing the necessary taxonomies
Taxonomy Module A Drupal core module, must be enabled
Taxonomy XML The module is required for importing and exporting the taxonomies
Views Module The views module provides a flexible method for Drupal site designers to control how lists of content (nodes) are presented

LOM Repository v2 - Installation Steps

Before you install, please note that the module uses DOM commands to write the exported record, for this reason your system must be using PHP 5.1.x, preferred version is PHP 5.2.5 and above.

Please make sure to follow the installation steps in the defined order; failure in completing the steps might result in a broken Drupal installation.

Setup CCK

  1. Login to your system with admin privileges
  2. Download the required modules and enable them, Administer -> Site Building -> Modules
  3. Adjust the module permissions, Administer -> User Management -> Access Control
  4. Create the content type for the Learning Resource by copying the contents of the /content_type/learning_resource.content_type.txt from the download package in the Administer -> Content Management -> Content Types -> Import
  5. Adjust the name of the content type, field name descriptions etc if needed, do not change the machine readable name of the content type
  6. Review the access rules for the content type under the "node module" at Administer -> User Management -> Access Control
  7. Import the necessary vocabularies, Administer -> Content Management -> Categories -> Import. The vocabularies (found in the /vocabularies at the download package) are:
    • Aggregation Level (LOM v.10) (preview)
    • Aggregation Level (LOM v1.2) (preview)
    • Context (LOM v1.0) ( preview)
    • Context (LOM v1.2) ( preview)
    • Difficulty (LOM v1.0) (preview)
    • Difficulty (LOM v1.2) (preview)
    • Intended End User Role (LOM v1.2) (preview)
    • Interactivity Level (LOM v1.0) (preview)
    • Interactivity Level (LOM v1.2) (preview)
    • Interactivity Type (LOM v1.2) (preview)
    • Keywords
    • Language (Enchanged from LOM) (preview)
    • Learning Resource Type (LOM v1.0) (preview)
    • Learning Resource Type (LOM v1.2) (preview)
    • LivingTaxonomy (preview)
    • Semantic Density (LOM v1.0) (preview)
    • Semantic Density (LOM v1.2) (preview)
    • Status (LOM v1.0) (preview)
    • Status (LOM v1.2) (preview)
    • Structure (LOM v1.0) (preview)
    • Structure (LOM v1.2) (preview)

The above vocabularies marked as LOM v1.2 are complete on basis of the IMS Learning Resource Meta-Data Information Model (Version 1.2.1 Final Specification), the ones marked as LOM v1.0 are for the older version. The older version is required providing support for IEEE LOM v1.0 on the LOM Import (separate module). For the Language taxonomy, the specification does not state a static vocabulary but we have decided to add some pre defined languages into it, this is to make the usage easier. Additional languages can be added or removed to the vocabulary, please read "Post Installation and Modifications" for further reference. After importing we strongly encourage to check under Administer -> Content Management -> Categories that all the related vocabularies are correctly associated to the content type.

7. Visit the settings for the Taxonomy Hide module at Administer -> Site Configuration -> Taxonomy Hide and hide all the Learning Resource related vocabularies, this prevents the vocabularies from showing as duplicates as we have modified the node output to our needs

Setup Custom Views

  1. Go to Administer -> Content Management -> Content Templates and create a new content template for Learning Resource
  2. Open the content template and from the download package paste the contents of /content_template/lom_teaser.txt to the teaser template window, check the checkbox “Affect teaser output”. Do the same for the body part, copy /content_template/lom_body.txt to the body template window and check the “Affect body output”.
  3. Copy the three files in the /includes folder of the download package into your drupal /includes folder
  4. Login to your server over ssh, sftp, ftp or whatever means you have to access the files on the server.
  5. In your Drupal installation database, create a table using the following command:

 create table lom_counter(nid int, count int)

Customize the theme

1. Go to your Drupal installation files and there your theme under the /themes/<mytheme> and edit the page.tpl.php in your theme by adding the following JavaScript snippet before the </head>, the same snippet is available in the download package at /theme/javascript/lom_counter.js:
 <script>
   var iCount;
   function count() {
       iCount++;
       //alert("Count = "+iCount);
       showCount();
   }
   function zero() {
     iCount = 0;
   }
   function getCount() {
     node=document.getElementById("valCount");
     iCount = node.innerHTML;
   }
   function showCount() {
     node=document.getElementById("displayCount");
     node.innerHTML = +iCount;
   }
   </script>

Modify the <body> tag so that it looks something like the following:

 <body onload="getCount(),showCount()">
2. In the theme folder, paste the code from /theme/template.txt of the download package in the end of the template.php, if the file does not exist create one by copying over the file from the download package at /theme/template.php
3. In the same theme folder, copy the file /theme/lom_record.tpl.php from the download package unchanged, this is the modified input form for the Learning Resource
4. Modify your theme's style.css or style.php and add the contents of the file /theme/css_additions/style.css.txt from the download package to the end of the file
5 Caution: To make the export of the records on the repository work, you must create a blank file with the mane lom_record.xml at the root of your drupal installation

Menu Creation

  1. Create a menu item called Repository, Administer -> Site Building -> Menus, the menu name can be different as well
  2. Using the Views Import, Administer -> Site Building -> Views - > Import, import the three views from the /views folder of the download package (just copy-paste the contents of each of the files separately)

If you chose to change the name of the menu, make sure to edit the URL under the Page on each of the three views to match the target of the menu item which was created before

LOM Repository v2 - Post Installation and Modification

Modification of the content type

In some cases you might want to add or remove some of the tags defined in the IMS specification. To do this, you must first either add/remove the necessary fields in the content type or add/remove the vocabularies that you want, in case you want to keep an existing vocabulary you can also just unlink it from the content type in the categories settings at Administration -> Content management -> Categories.

After the vocabularies or content type fields are added, you must modify the content template to show the newly created fields or vocabularies. Also, you must modify the input form in lom_record.tpl.php to show/hide the fields or vocabularies in the input form and also modify the body template in your content type template.

Editing the views: Adding the "quick links" for adding a repository

The views provided with the guide do not include the "Register and login to add your learning resource" texts seen on the header of every view for the repository on the JEM website, eg. http://www.jem-thematic.net/repository/by_title as the (base) url which the link is pointing to is specific for every installation. To add these links, edit the three views at Administer -> Site building -> Views (the views are called by_title, by_author, by_date) and add the following to the header section of every view 8make sure to change the url to point to your own Drupal installation:

 <div class="quicklinks">Register and login to <a href="http://www.jem-thematic.net/node/add/lom-record">add your learning resource</a></div>

Also, add login to your website over ftp or similar and add the following to your style.css under /themes/&lt;mytheme&gt;/:

 .quicklinks {
    border-left:1px solid #AABBCC;
    border-right:2px solid #AABBCC;
    border-top:1px solid #AABBCC;
    border-bottom:2px solid #AABBCC;
    font-size:120%;
    margin-top: 5px;
    margin-bottom:1em;
    padding:0.5em;
    text-align:right;
    font-weight: bold;
    min-width: 300px;
    max-width: 400px;
    float:right; 
 }

Editing the views: Remove the RSS support for the learning repository views

To remove the RSS support for the learning repository views, edit the three views at Administer -> Site building -> Views (the views are called by_title, by_author, by_date). Scroll down to the Arguments section and remove the argument type RSS: RSS Feed Selector for each of the three views separately.

Renaming the vocabularies

If you want to rename any of the existing vocabularies related to the Learning Resource, make sure to change the vocabulary names which appear in the SQL queries at the beginning of the body template of the content type template and at the beginning of the lom_record.tpl.php. If these are not changed the fields will not show in the outputted node and in the input form.

Adding terms to vocabularies

If you wish to add terms to already existing and configured vocabularies or change properties of one of the vocabularies (except disable), no changes are needed in the code. We would appreciate it if you would inform us of additions, especially to the Living Taxonomy, in relation to fields of applications of Mathematics (e.g. Physics).

LOM Repository v2 - Upgrading from previous versions

Before taking any steps on upgrading your repository, we strongly encourage you to backup your current content template, content type and vocabularies. We also provide the old code in the download section in case something goes wrong with the upgrade.

To update from the old version of the repository, please do the following steps:

Upgrade the vocabularies

Remove the old vocabularies (except for the LOM LivingTaxonomy and LOM Keywords) and re-import the following vocabularies:

Make sure not to reimport the LOM Keywords vocabulary because this will overwrite the keywords for your existing records.

Update your content type

  1. Remove the old Learning Resource content type at Administer -> Content Management -> Content Types
  2. Re-create the content type by copying the contents of /content_type/learning_resource.content_type.txt from the download package in the Administer -> Content Management -> Content Types -> Import

Update the content template

  1. Go to Administer -> Content Management -> Content Templates and edit the existing content template for Learning Repository
  2. Replace the content of the body part with the content of /content_template/lom_body.txt of the download package; the teaser does not need altering
  3. Login to your system over ftp or ssh and insert the following three files from the /includes folder in the download package into your Drupal installation /includes folder: create_lom_elements.inc, lom_ims_export.inc and lom_ieee_export.inc lom_ieee_export.inc

Update the page template

  1. Login to your system over ftp or ssh
  2. In your theme folder, replace the lom_record.tpl.php with lom_record.tpl.php.txt from the /theme folder in the download package (remove the txt extension from the file name)

LOM Repository v2 - Download

The entire guide can be downloaded and printed by using the Printer-friendly version. To download the software package (vocabularies etc) for creating this repository, please fill in our survey on usage of the repository after which the download will start automatically. The download is free of charge but the survey is needed for statistical purposes when reporting about the JEM project.

The code in the download package is for version 2 of the repository, for version 1 please contact us over the contact form.


Proceed to survey