This work requires two things:
- A LAMS Tool Adapter that wraps the Moodle tool
- Minimal modifications in the Moodle tool
The LAMS Tool Adapter is basically a LAMS Tool but with almost no "business logic" within it. It provides a set of hooks for the Moodle tools to behave as if it would be a LAMS Tool following the LAMS Tool Contract.
To talk to this LAMS Tool Adapter, the Moodle tool has to have a few minimal modifications to be incorporated in the context of LAMS.
As we have now completed this implementation, we have created animations on how this works (we will soon have this available for you to play with):
- Authoring and Preview
- Enactment/Runtime and Monitoring
- Using Moodle Tool outputs for Branching
- Achieving interoperability using Export and Import
You can use the demo server to try this implementation of the Moodle Forum in LAMS. We are looking forward for comments and suggestions in the LAMS Community Tech Forums. Please let us know what you think!
LAMS Tool Adapter
See the LAMS Tool Adapter page for further information on its implementation.
Modifications to Moodle and Moodle Tool to work in LAMS
In this page we will focus on the necessary extensions we do in the Moodle Forum Tool to add it as a native LAMS tool. There are significant benefits on extending a Moodle tool to work on the context of LAMS.
The main challenge we faced with Moodle Tools is the same as we face with other LMSs: Moodle tools instances are heavily tied to a course. Therefore you can't quite create Moodle tool instances that are not within a context of a course.
LAMS (and learning design for that matter) has a design stage (authoring), where the teacher sets up the sequence of activities, and a runtime or enactment stage, which is when given the design that the teacher has created, the students go thru this design completing and doing the activities.
Moodle and other LMSs and their tools don't really have this concept. If they would, a teacher should be able to create a Forum outside the course and then instantiate one or more instances of this forum in one (or more) of her courses. Currently, LMS' tools allow teacher to create activities/tools in a course. So teacher goes into the course page, selects a tool to add, completes its content and bang! Now this tool is in the course page.
Trying to do a work around this can be difficult as it requires to "hack" the LMS tool, meaning that not only you need a tool adapter to "bring" this tool into LAMS, but also modify the code (though slightly) in the LMS tool to overcome this limitation.
Here's the list of changes and tasks we have identified that are needed to get a Moodle tool to work in LAMS. We'll go thru each of this individually:
Important Integration Principle
The main principle we follow is to avoid any modification to existing code whenever possible and extend the current method or functions instead.
Modifications to Moodle
- moodle/lib/db/install.xml (+2 lines)
We added a new column to the \course_modules_ table so it distinguishes between LAMS course module instance (_is_lams). The is_lams is a integer value that can have only a 0 or 1 value. If 0, it means that it isn't a LAMS instance. We use this field to filter instances of course modules in the course page (as you can see below).
- moodle/course/modedit-lams.php (+463 lines) new
This file is copy of modedit.php where we add only a few lines (this is an actual diff):
We add a new parameter called lamsupdateurl which after saving the content of the mod, this is the URL where we are going to return to in LAMS.
We won't need Moodle groups within this tool, therefore we remove it.
As you can see, we also extend the mod_forum.php file (we'll show this later) by creating a customized copy mod_forum_lams.php
Here is where we add the action parameter to the <form> as well as add the lamsupdateurl element to it.
We have added a column (is_lams) to the mdl_course_modules table as well as the mdl_forum table to identify which instances of forum and/or course modules are to be used for LAMS only.
After the saving, we return to LAMS using the lamsupdateurl appending the coursemodule id.
As mentioned before, in the authoring stage, the content we create for an activity/tool are independent of the course you create it on. Therefore we get rid of all the navigation breadcrumb.
No need for course footer, so we remove this too.
- moodle/lib/datalib.php (+1 -1 lines)
As we have added a new column to the course_modules, when a Moodle Course page is displayed, we don't want to show instances of Moodle that we have created for LAMS (as these instances might be used at authoring stage). Therefore, we add a new constraint to the function get_course_mods($courseid) function to show only course modules that aren't used in LAMS.
See the ND cm.is_lams=0 at the end of the query statement.
Modifications to Moodle Forum Tool
- moodle/mod/forum/db/install.xml (+1 line)
Just as we did with the course_modules table, we add an is_lams column to the forum table. Default value is 0.
- moodle/mod/forum/index.php (+1 lines)
We replaced the get_records function for a get_records_select instead and add the is_lams=0 so it only shows forums that weren't created for LAMS.
- moodle/mod/forum/mod_form_lams.php (+178 lines) new
This file is also a copy of the original moodle/forum/mod_form.php which we remove a lot of features that http://lamscvs.melcoe.mq.edu.au/fisheye/browse/lams/temp_moodle_dev/moodle/mod/forum/mod_form_lams.php?r=1.1]. The only additions/modifications are:
We use standard_hidden_coursemodule_elements rather than standard_coursemodule_elements
Instead of showing the standard Save options, we only show one Save button.
- moodle/mod/forum/view.php (+6 lines)
In order to make the Moodle Forum Tool "workflow aware", we need to introduce a "Next Activity" button so after the students have posted their messages they can continue to other activities in the sequence. However, we only show this button if this is a Moodle Forum instance used in LAMS (is_lams = 1).
- moodle/mod/forum/lib.php (+134 lines)
As part of adding a new Moodle Tool into LAMS, we need to add a few functions to the Moodle Forum tool so they can be use from LAMS. These functions are based on existing Moodle Forum functions.
This function is called from LAMS when it needs to create a new instance of a Moodle Forum based on the content of another instance. For instance when the teacher in LAMS creates a sequence that includes a Moodle Forum activity, then she creates a new LAMS lesson, LAMS needs to create a separate new instance of the Moodle Forum tool that the teacher created (because we don't want to modify the original design so the teacher can reuse this sequence elsewhere). Same if the teacher creates a second or third LAMS lesson based on the same sequence. For each new LAMS lesson, new instances of Moodle Forum Tools will be created. The LAMS tool adapter calls the forum_clone_instance when it needs to create new copies.
Exports a Forum object into a file and sends it to LAMS so it can export it with a LAMS sequence (see Export and Import Animation)
This does the import of a LAMS sequence that contains a Moodle Forum. (see Export and Import Animation).
This function deals with the outputs that are required to do Branching.
This function handles the export portfolio as is expected in LAMS. In this case, we only provide a link to the webpage that host the forum. Eventually it would be nice to have all the postings in the forum as an html file so the student (or teacher) can take home with them.
And that's all!
LAMS Integration Interface
Completed, but not documented yet. Coming soon...