Moodle Integration code

Before you begin the LAMS2.0 and Moodle 1.6.3+ integration, have a quick look at these animations:

Installation instructions

  1. Download the LAMS Moodle module
  2. Unzip the file
  3. Move the lamstwo directory to moodle/mod/
  4. Move the lamstwo.php file to moodle/lang/en_utf8/
  5. Login as admin and go to admin, LAMS tables will be created automatically. In Moodle 1.7, you can go to the admin screen by changing the url to "http://<moodleserver>/moodle/admin/" (if you access Moodle as "http://<moodleserver>/moodle/") or "http://<moodleserver>/admin/" (if you access Moodle as "http://<moodleserver>/").
  6. Go to modules and click settings for LAMS2 module and put the proper values in (as shown below)

When the Moodle module is installed in step 4. you should see output like:

Quick visual walkthru LAMS Integration with Moodle

Here are the steps you need to take to get LAMS and your LMS (in this case Moodle) to be integrated. In this example they are on the same server (my local PC) but that was only because it is easy for me to create a screenshot on my own PC.  I have LAMS installed on port 8080 and Moodle 1.7 installed on port 80.
OK, now let's get it on with the integration:

In the LAMS side

1. login in LAMS as a sysadmin (the user that you created at installation time)

2. Select the "Sys Admin" link.

3. Select "Maintain Integrated Servers".

4. Setup the fields as appropriate.

On the LMS side

1. Go to your configuration menu and click on the LAMS settings

2. Enter the LAMS server URL, server_id, server_key and request_source.

When a teacher runs the LAMS authoring client (when adding an activity) and the teacher saves a sequence, the "Saved" message will have a button "Close and return to {request_source}". If this button is clicked, then the LAMS authoring client will close and the list of sequences on the add activity screen will update automatically. So the request_source should be set to a name that your users understand e.g. "Moodle", "the add LAMS activity screen". This feature will be added in LAMS 2.0.1 - you will not see the message in LAMS 2.0. Have a look at MoodleSaved.jpg to see how the message appears.


Make sure you keep your sever_key private as that is the key used for authentication

3. Click the "Validate" button to make sure it is configured correctly. LAMS should already be running - the validation test will call LAMS to ensure that the two systems can communicate.
4. If it validates okay, then click Save changes.

That's it. You are done.

Now you can go and add sequences and activities to your Moodle courses!

Latest Changes


Troubleshooting, Problems and Comments?

Post them in the Tech Forum in the LAMS Community

LAMS is unable to get user data from Moodle

When a user tries to create access LAMS from within Moodle for the first time, such as to create new learning design, LAMS calls back to Moodle to get the user's details. This could fail for a number of reasons and you might get an error like:

soapenv:Server.userException: java.rmi.RemoteException: Fail to fetch
user data from
external server:moodle - Unexpected return HTTP Status:404; nested
exception is:
org.lamsfoundation.lams.integration.UserInfoFetchException: Fail to
fetch user data from
external server:moodle - Unexpected return HTTP Status:404

3rd party users on servers updated from 2.0

One of the changes from 2.0 relating to integrated users is that their LAMS organisations changed from groups to subgroups. This means that under their 'My Groups' workspace, they have folders for the subgroups. Whereas on a freshly installed 2.0.1+ installed server, 3rd party users should only have a folder for the main integration group. Apart from the fact that 3rd party users on a server updated from 2.0 will have more folders, this isn't a problem.

If you updated your (integrated) LAMS 2.0, then you may notice that existing 3rd party users don't have access to the main integration group folder. Users who start using LAMS after the update applied do have access. This can be easily fixed by logging into LAMS directly and giving the author role to all 3rd party users in the main integration group.

Users can create sequences but not start lessons.

Check to see if the lamstwo table exists. If the strict_trans_tables option is turned on in MySQL, then the database create script will fail.

To fix, find the script in the lamstwo/db directory. If it looks like this:

CREATE TABLE prefix_lamstwo (
  id int(10) unsigned NOT NULL auto_increment,
  course int(10) unsigned NOT NULL default '0',
  name varchar(255) NOT NULL default '',
  introduction text NOT NULL default '',
  sequence_id bigint(20) default '0',
  lesson_id bigint(20) default '0',
  timemodified int(10) unsigned NOT NULL default '0',
  PRIMARY KEY  (id),
  KEY course (course)
)COMMENT='LAMS2 activity';  

then remove the NOT NULL default '' from the introduction line, change "prefix" to the prefix used in your db e.g. mdl then run the CREATE TABLE statement on your database. This will create the table. See LDEV-1435

"All the LAMS module settings have not been set up!" Error and LAMS Course Format

If you try using the LAMS Course Format, you will probably see an error message "All the LAMS module settings have not been set up!". The LAMS Course format is not supported by the LAMSv2 module - it was only used in the original LAMS Moodle module.