Skip to content

Moodle-Plugin

This documentation part describes the source-code file-structure, database layout and functionality of our moodle-plugin.

Repo/File-Structure

The plugin repo is located at the HFT Stuttgart transfer portal here.

It contains a license file, a readme linking to this documentation and the plugin code in a subfolder.

This plugin is a moodle assign-submission-plugin.

Version.php

This file set's a few plugin variables read from moodle. The plugin release variable should contain a version number in the semantic-version scheme. The plugin version needs to match the plugin release. Minor and patch part of the semantic-version have to be padded to three digits.

Settings.php

This defines the plugin settings, configurable from the moodle plugin administration.

Defined options are the default enabled state for assignments and the backend url.

Locallib.php

This file holds the plugin class that extends the assign_submission_plugin.

On the top multiple requires are done for the additional files in the subfolders models and utils. Next starts the class definition, overriding the parent classes abstract methods getting called on various actions from the Moodle-UI.

Models

file content description
DttResult.php classes DttResult and DttResultSummary for transferring from backend

Utils

file content description
backend.php logic to communicate with the backend server
database.php logic talking to the database
view.php logic to react to frontend actions

Database

Results from tests are delivered in a summary object, containing some meta data and an array of single result objects.

Both classes are persisted in their own database table. Both are matched by the assignment and submission id to which they belong. An additional redundant relationship between results and summaries was not implemented.

uml diagram

Functionality

This plugin offers the possibility to create an assignment that accepts an URL to a Git-repo or a zipped code base as a submission.

The lecturer who creates the assignment must provide a Git repo that contains the test code and specify a Docker image available on DockerHub that will be used as a test runner.

When a submission is made, it is sent to the backend server. There it is tested against the test code in the test runner defined by the lecturer. The connection from the plugin remains open all the time. After completing the test, the backend closes the connection with the results as a response.

The received results are persisted in the database. In the view of a submission, a summary table is displayed at the top and each individual result in a second table below.