External Database Plugin

Jump to: navigation, search

This is for discussion regarding development of a plugin that will interface between the Moodle 1.9 gradebook and an external database in order to synchronize grade items, categories, scales, and outcomes and transfer data between them.

Site settings

Once the plugin has been installed, it will be available for the site administrator to configure in Admin->Grades.

At the site level, the plugin will give the site administrator the ability to define external database server settings and remote database fields, including settings for grades, categories, outcomes, and scales.

These fields may map to multiple or the same tables and are optional (if not defined, that functionality will not be enabled in the plugin).

The site administrator will be able to define which system (Moodle, external database, most recent update) is the ‘master’ record. The site administrator will be able to determine if course teachers have the ability to add new records of each type to the external database, and if course teachers are allowed to keep Moodle grade items unassigned. Depending on how this is set up, a number of different scenarios are possible.

Sample screenshot of configuration page follows. It is understood that the layout and design for this page will change to accommodate help buttons, information regarding these settings, etc. It has merely been presented in this format to show options needed in a compact manner. The ‘Allow’ checkboxes may be removed from this screen if enabled as Gradebook roles and clearly documented.

Please note that the site administrator will also need a way to associate course and user id between the two systems, ensuring proper synchronization for course and user data. Either fields for this information must be included, or if external database enrollment has been configured, the administrator may choose to use those settings. These settings are not included in the following screenshot.

Gradebook plugin site settings.JPG

These settings are assuming that ‘remote_desc’ will map to ‘itemname’ (grades & categories), ‘fullname (outcomes), and ‘name’ (scale). It may be necessary to add options to set this relationship. Categories should use mdl_grade_items with an itemtype of category and the same localfield mapping as Grade Items.

Course settings

Once external database integration has been enabled, a new set of options is available in the Moodle gradebook under the ‘View’ dropdown, similar to what is seen for report, import and export plugins. This is controlled by the options that have been configured and capabilities defined in the user’s role. Screenshot of all options enabled follows:

Gradebook plugin view dropdown.JPG

Selecting any of the external database plugin options will present the course teacher with a screen similar to the screen seen for that item under the Edit options, but will enable the teacher to assign Moodle items to the external database, create new mappings for the external database, or leave Moodle items unassigned. Once this is done and saved, the remoteid and remotedesc will be mapped to the proper location in the Moodle database.

A sample screenshot of the Categories and items selection page follows.

Gradebook plugin course settings.JPG

Please note that when a category is selected, only categories from the external database should be displayed, likewise with grade items. These pages will need some sort of check when changes are saved to ensure that a one-to-one relationship exists – the user should not be allowed to map multiple items from Moodle or the external database to a single item in the other. Attempts to create one to many relationships should return the page with the offending items clearly marked.

Additional functionality could include the use of AJAX to remove already chosen items from the dropdown list.