Skip to end of metadata
Go to start of metadata

Implemented Moodle features

The LAMS plugin for Moodle implements the following features:

  • Status completion
  • Completion tracking
  • Groups and groupings
  • Grade outcomes
  • Grades
  • Backup and restore

Setup

  • Downloaded NEWMODULE.zip
  • Following the README.txt instructions did the following changes:
mv NEWMODULE lamslesson
cd lamslesson
find . -type f -exec sed -i 's/newmodule/lamslesson/g' {} \;
# Change copyright notices
find . -type f -exec sed -i 's/@license   http:\/\/www.gnu.org\/copyleft\/gpl.html GNU GPL v3 or later/@license  http:\/\/www.gnu.org\/licenses\/gpl-2.0.html GNU GPL v2/g' {} \;
find . -type f -exec sed -i 's/@copyright 2010 Your Name/@copyright 2010 LAMS Foundation/g' {} \;
  • Copy old lams2mod data model across
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/lamslesson/db" VERSION="20101203" COMMENT="XMLDB file for Moodle mod/lamslesson"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
  <TABLES>
    <TABLE NAME="lamslesson" COMMENT="LAMS module" NEXT="lamslesson_lesson">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/
>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEXT="intro"/>
        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="timemodified"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary_lamslesson" TYPE="primary" FIELDS="id" COMMENT="Primary key for lamslesson"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="course_lamslesson" UNIQUE="false" FIELDS="course"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="lamslesson_lesson" COMMENT="LAMS lesson" PREVIOUS="lamslesson" NEXT="lamslesson_grade">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="course"/>
        <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="lamslesson"/>
        <FIELD NAME="lamslesson" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="course" NEX
T="name"/>
        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="lamslesson" NEXT="intro"/>
        <FIELD NAME="intro" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="groupid"/>
        <FIELD NAME="groupid" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="false" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="intro" NEXT="
sequence_id"/>
        <FIELD NAME="sequence_id" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="groupid" N
EXT="lesson_id"/>
        <FIELD NAME="lesson_id" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="sequence_id"
 NEXT="timemodified"/>
        <FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lesson_id"
 />
      </FIELDS>
      <KEYS>
        <KEY NAME="primary_lamslesson_lesson" TYPE="primary" FIELDS="id" COMMENT="Primary key for lamslesson_lesson"/>
      </KEYS>
      <INDEXES>
        <INDEX NAME="course_lamslesson_lesson" UNIQUE="false" FIELDS="course"/>
      </INDEXES>
    </TABLE>
    <TABLE NAME="lamslesson_grade" COMMENT="LAMS user grade" PREVIOUS="lamslesson_lesson">
      <FIELDS>
        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="lamslessonlesson"/>
        <FIELD NAME="lamslessonlesson" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" N
EXT="user"/>
        <FIELD NAME="user" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lamslessonlesson"
 NEXT="completed"/>
        <FIELD NAME="completed" TYPE="int" LENGTH="1" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="user"/>
      </FIELDS>
      <KEYS>
        <KEY NAME="primary_lamslesson_grade" TYPE="primary" FIELDS="id" COMMENT="Primary key for lamslesson_grade"/>
      </KEYS>
    </TABLE>
  </TABLES>
  <STATEMENTS>
    <STATEMENT NAME="insert log_display" TYPE="insert" TABLE="log_display" COMMENT="Initial insert of records on table log_display">
      <SENTENCES>
        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lamslesson', 'add', 'lamslesson', 'name')" />
        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lamslesson', 'add lesson', 'lamslesson_lesson', 'name')" />
        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lamslesson', 'update', 'lamslesson', 'name')" />
        <SENTENCE TEXT="(module, action, mtable, field) VALUES ('lamslesson', 'view lamslesson', 'lamslesson', 'name')" />
      </SENTENCES>
    </STATEMENT>
  </STATEMENTS>
</XMLDB>
  • modified the version.php
$module->version  = 2011010600;  
  • modified lang/en/newmodule.php to lang/en/lams2lesson.php
$string['modulename'] = 'LAMS Lesson';
$string['modulenameplural'] = 'LAMS Lessons';
$string['lamslessonfieldset'] = 'Custom example fieldset';
$string['lamslessonname'] = 'Lesson name';
$string['lamslessonname_help'] = 'This is the content of the help tooltip associated with the lamslessonname field. Markdown syntax is supported.';
$string['lamslesson'] = 'LAMS Lesson';
$string['pluginadministration'] = 'LAMS Lesson administration';
$string['pluginname'] = 'LAMS Lesson';
  • Visit Settings > Site Administration > Notifications, to create the module's tables.
  • Go to Site Administration > Plugins > Activity modules > Manage activities
    and to find that this lamslesson has been added to the list of
    installed modules.

Development

Development tasks

We have a set of development tasks for this integration in our tracker:

YUI tree replaces Tigra tree

Instead of using the old tigra tree javascript function, I decided to use YUI Tree instead. It looks a lot better and it gives a lot more options.

The lamslesson_process_array function in lib.php takes care of the XML send back from LAMS with the available sequence for this user into YUI tree format to be displayed in the browser.

Moodle activity completion

Moodle 2 now has Activity Completion. So that means that now Moodle activities can have a completion state. Although it just records it binary (completed or not, so it doesn't have things like attempted, etc -for what I have seen anyway).

So we can send the complete progress we get in LAMS (once a student finishes a lesson) back to Moodle so it can record this state and do their conditional activities.

Grades

The plugin passes marks from LAMS to Moodle's gradebook on student completing the lesson.

Backup and restore

You can now back up and restore lamslesson activitivies too.