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):
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.
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)
\#$forums = get_records('forum', 'course', $course->id); $forums = get_records_select('forum', "course=$course->id and is_lams=0");
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://lamscvscode.melcoe.mq.edu.aulamsfoundation.org/fisheye/browse/lams/temp_moodle_dev/moodle/mod/forum/mod_form_lams.php?r=1.1]. The only additions/modifications are:
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.
LAMS Integration Interface
Completed, but not documented yet. Coming soon...