Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) The Integration of Moodle with Bolton University’s Systems from a Technical Perspective. Contents INTRODUCTION 2 ADDITIONS TO MOODLE 2 Block sits_course 2 Enrolment Plugin: categories 3 University Theme 3 sits_link extension folder 3 ADDITIONS TO MOODLE’S CORE CODE. 7 Changes to Block Admin 7 Changes to Moodle my 7 TRANSPORT DATABASE 8 Tables: 9 ADVICE ON RE-USE 10 Instructions to copy over SITS Integration work to new moodle server 10 LDAP setup 11 Creation of transport database 11 Figures Figure 1 - Block sits_course Appearance 2 Figure 2 – SITs link functionality accessible at the bottom of the course admin block. 4 Figure 3 – Top level SITs Link 5 Figure 4 – Accessing SITs Link Configuration 6 Figure 5 – SITs Link Configurations 7 Figure 6 – Additions to block_admin.php 7 Figure 7 – Start sits link additions 8 Figure 8 – End of sits link additions 8 Figure 9 - Structure of Imports Database View 9 Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Introduction This document describes how Moodle has been integrated with various systems within the University of Bolton. The rationale behind this work was give lecturers the opportunity to more closely tie Moodle courses with university modules and student lists which are maintained by SITs. It also makes use of the university’s directory server for user information, accessed via LDAP. Additions to Moodle A number of additions and changes were required to integrate Moodle with the university systems. These were developed for the most part as plugins utilizing Moodle in-built extensibility. However there were two small changes to Moodle’s own code. The first was the addition of an extra line to the admin block. The second was an addition of some linked features to the ‘my Moodle’ page. The specifics of each plugin and addition are as follows. Block sits_course This block was intended to sit at the side of a course page indicating that the course was linked to a SITs module. It shows the module ID and contains a link to the “Tallis Aspire” system, which maintains reading list for current modules. The link took the user to a reading list for this specific module. Figure 1 - Block sits_course Appearance It was written as a standard Moodle block with the slight difference in that it only renders if the course in which is resides is linked to one or more modules. It makes a database call to the transport database ‘s links table with the current course id. If the call returns as true a further call is made to get the required information about which modules and renders this information. If the return Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) value is false then null is returned to Moodle causing it not to render the block at all. This meant that the block could be included as a sticky1 block in the context of courses and only appear when required. Enrolment Plugin: categories An enrolment plugin was required to create and rationalize the course categories. It creates categories based upon the lecturer’s name. This allows each lecturer to have a space in which their courses can exist and also allow them to be linked with their “My Moodle” space. The information that it uses is extracted from the directory server via ldap. It takes the ldap configuration information from the ldap plugin config tables. University Theme This theme contains the definitions and imagery that skin Moodle according to the university requirements. It also contains additional definitions that are specific to the requirements of these additions. sits_link extension folder A large part of the functionality of the additions made is within this folder. At the top level of this folder there is an index.php file. This is the main page (shown in Figure 3) of the sits link system. The user accesses this page through the admin block of a course. Figure 2 shows the block with the link to the sits_link extension at the bottom. This block appears to course creators on the left hand side of the course page. 1 Moodle’s sticky block feature allows blocks to be included globally either at the site level or in the context of courses or my Moodle. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Figure 2 – SITs link functionality accessible at the bottom of the course admin block. This link is the only method of getting to the sits_link extension currently. It was designed this way to closely tie the process of linking module information with a Moodle course while still trying to recognize Moodle’s course design philosophy which puts the course at the centre of it’s pedagogic design. It leads to the sits_link page as already mentioned above. In the sits_link index page a breadcrumb at the top allows the tutor to navigate back to the course. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Figure 3 – Top level SITs Link “Manage your SITs modules” allows you to link any modules that you teach that are listed in the SITs system with a Moodle course. You can link more than one module if that is appropriate. “Manage your SITs students” allows students that are linked to the SITs module to be enrolled in the course. Moodle has a system that allows users to enrol themselves in a course and a notification feature. This system works around that meaning that when students login again the course appears in their list of courses on their my Moodle page. It is also possible to search for other students who might not be currently linked to the module on SITs. This does a general search by first, last or both names on the directory server through LDAP. “Manage your course location” allows the teacher or owner of the course to move its category. By default the course is created under the teacher’s own category (the one created by the enrolment plugin). This might not be appropriate for a course, especially if it is a collaboration between more than one teacher so this set of tools allows the tutor to move it to another existing category whilst maintaining it’s inclusion with the SITs link system. This folder also contains a configuration form, which is accessible from the main admin block on the front page in the miscellaneous section. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Figure 4 – Accessing SITs Link Configuration Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Figure 5 – SITs Link Configurations Here the host, username, password and database name can be set for the transport database. The Current Module Date field is currently unused but will allow modules to be automatically selected from the current year when the system has been in operation for more than one year. Additions to Moodle’s core code. Changes to Block Admin A small change was made the Moodle block “Admin”. This block appears by default on the left hand side of the course page. It provides functionality allowing full administration of the course. It was felt that this was an appropriate place to have a link to the additional functionality, particularly because it was effectively an extension to the technical administration of the course (see Figure 2 – SITs link functionality accessible at the bottom of the course admin block.. The code changes for this were small. A single line of code was included in the file /blocks/admin/block_admin.php.. The following figure shows the code and the line numbers with the file for inclusion. Figure 6 – Additions to block_admin.php The additional line can clearly be seen on 233 with the two comments that indicate the start and end points. Changes to Moodle my In this case the additions change the existing functionality. The changes allow both teacher and student to clearly see courses they own, are enrolled in and those that area available to them. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) The changes are made to /my/index.php. They are denoted by start and stop comments similar to those in block_admin.php. This time, however, there is a whole block of code to be included. Figure 7 – Start sits link additions Figure 8 – End of sits link additions All the lines between 81 and 186 are additional, they replace the lines between 72 and 119 in the original distribution version of /my/index.php. Transport Database A view on the SITs database was developed allowing the transport of SITs information to external sources. This was utilized extensively in the integration. This view on the SITs database described modules with associated users and teachers. The database used was mysql. The following entity relationship (ER) diagram shows the structure and datatypes of the database. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Figure 9 - Structure of Imports Database View It is a loosely coupled relational database. That is the relationships are defined in the calling SQL code rather than within the structure of the database. For instance the links table is used to store the relationship between a module as defined within the module table and a Moodle course id, which is stored in Moodle’s own database and is available through Moodle’s code. Person is related to module via the module id. NetworkID is the same code which is used in the university LDAP allowing further information about them to be accessed from the directory server – their name for instance. Tables: Coursecatlink – allows courses to be moved between categories within Moodle. The default category for a course created in the university’s Moodle setup is individual tutor’s staff space. Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) Links – maintains the link between the module id from sits and the course id from Moodle. Module – stores information about each current module. Person – this is actually a link between a module and a person, not specifically user information. The data stored in the table is pertinent to a person’s relationship to a module - that is, when, how and where. The only information about a person stored in the table is their university Network ID. Advice on Re-use The first step would be to install the folders and files from the distribution. The following steps should help with this. Instructions to copy over SITS Integration work to new Moodle server (1) Copy folder /sits_link/sits_link/ to new server (2) Copy folder /my/my/ to new server (3) Copy /moodle/lang/en_utf8/my.php to new server (4) Copy /moodle/lang/en_utf8/sits_link.php to new server (5) Copy /moodle/theme/University/topmenu.php to new server (6) Copy /moodle/theme/University/uni_layout.css to new server (7) Copy /moodle/course/lib/lib.php to new server. (some css changes in print_course() method) (8) Copy /moodle/blocks/admin/blocks/admin.php to new server (only change is an include) (9) Create your transport database – please see section below. (10) On the live Moodle server rename the existing "schools" category to "old- schools". Once you have completed the rest of the steps here, you may have to manually relocate some of the existing courses to the new school structure automatically created in step 10. (Although, it looks as though it’s only the "staff training material" category you have to move) (11) This next script generates the school category structure Locate the file php file /moodle/my/script/create_categories.php in your file explorer (not your browser yet) Might be worth having a quick review of it, just to see what it does before you run it. *IMPORTANT* - this should only be run once! Navigate to the url of this script in your browser to run it. It should create the complete hierarchy of the school categories. (it doesn’t delete anything) It also Jisc Curriculum Design Programme, Coeducate Project University of Bolton (2010) sets up the "coursecatlink" table so that we can map a Moodle category to a school code based on info we find in the "schoolCode" field of the "module" table. *IMPORTANT* - Once you have run this script, it might be prudent to move it from the doc root, so it doesn't get run again by accident. (or by anyone else, it’s open so anyone can run it! Alternatively, add admin only access to the top of the script.) (12) Review your “old-schools” category and move any existing courses to the new category created above. Then delete this old category. LDAP setup LDAP is setup through Moodle’s LDAP authentication. This is required as a basis for connecting user authorization to user information. Moodle has systems in place for this and the sits_link extension makes use of this setup for it’s own lookup routines which auto-create accounts, if required, and automatic enrolment in the course. If a different authentication mechanism is used then there are a couple of alternative methods of getting sits_link to work correctly. The first method requires that you have an LDAP setup but are using a different service to authenticate. Simply setup the LDAP authentication plugin in Moodle but then disable it. This means that the LDAP settings will be stored in the database from where the sits_link extension can access and make use of them. The second method would require some programming. The file /sits_link/lib/ldaplib.php would need to be rewritten. For simplicity’s sake rewrite body of the functions but keep the function names and parameters the same. The exact details on how to do this are beyond the scope of this document and in any case would be specific to individual needs. It would be important to bear in mind however that returned data from each function would need to be in the format currently used. Extensive reading of the source code and how it returns data would be required. Creation of transport database The Bolton system makes use of a transport database which draws from the SITs database using a scheduled script. In this way it is kept up to date on regular basis. The format of the database is important to the sits_link extension. A mysql script is included in the source code to create a database. The ER diagram in Figure 9 may also be used as a template to create a database. If a different database to mysql needs to be used then some modification of the file /sits_link/lib/imports_db.php would be required.