Assign submission plugins

An assignment submission plugin is used to display custom form fields to a student when they are editing their assignment submission. It also has full control over the display the submitted assignment to graders and students.

For a good reference implementation, see the onlinetext submission plugin included with core because it uses most of the features of submission plugins.

File structure ​

Assignment Feedback plugins are located in the /mod/assign/submission directory. A plugin should not include any custom files outside of it's own plugin folder.

The plugin name should be no longer than 36 (11 before Moodle 4.3) characters - this is because the database tables for a submission plugin must be prefixed with assignsubmission_[pluginname] (17 chars + X) and the table names can be no longer than 53 (28 before Moodle 4.3) chars due to a limitation with PostgreSQL.

If a plugin requires multiple database tables, the plugin name will need to be shorter to allow different table names to fit under the 53 character limit (28 before Moodle 4.3).

Note: If your plugin is intended to work with versions of Moodle older than 4.3, then the plugin name must be 11 characters or shorter, and table names must be 28 characters or shorter.

Each plugin is in a separate subdirectory and consists of a number of mandatory files and any other files the developer is going to use.

Some of the important files are described below. See the common plugin files documentation for details of other files which may be useful in your plugin.

settings.php ​

Plugin settings, file path: /settings.php.

You can define settings for your plugin that the administrator can configure by creating a settings.php file in the root of your plugins' directory.

Settings must named in the following format:

By following the correct naming, all settings will automatically be stored in the config_plugins database table.

Full details on how to create settings are available in the Admin settings documentation.

This example from the submission_file plugin also checks to see if there is a maxbytes setting for this moodle installation and, if found, adds a new admin setting to the settings page.

locallib.php ​

Global support functions, file path: /locallib.php.

This is where all the functionality for this plugin is defined. We will step through this file and describe each part as we go.

All submission plugins MUST define a class with the component name of the plugin that extends assign_submission_plugin.

get_name() ​

Get name is abstract in submission_plugin and must be defined in your new plugin. Use the language strings to make your plugin translatable.

get_settings() ​

The "get_settings" function is called when building the settings page for the assignment. It allows this plugin to add a list of settings to the form. Notice that the settings are prefixed by the plugin name which is good practice to avoid conflicts with other plugins.

save_settings() ​

The "save_settings" function is called when the assignment settings page is submitted, either for a new assignment or when editing an existing one. For settings specific to a single instance of the assignment you can use the assign_plugin::set_config function shown here to save key/value pairs against this assignment instance for this plugin.

get_form_elements() ​

The get_form_elements function is called when building the submission form. It functions identically to the get_settings function except that the submission object is available (if there is a submission) to associate the settings with a single submission. This example also shows how to use a filemanager within a submission plugin. The function must return true if it has modified the form otherwise the assignment will not include a header for this plugin.

The "save" function is called to save a user submission. The parameters are the submission object and the data from the submission form. This example calls file_postupdate_standard_filemanager to copy the files from the draft file area to the filearea for this submission, it then uses the event api to trigger an assessable_file_uploaded event for the plagiarism api. It then records the number of files in the plugin specific "assignsubmission_file" table.

get_files() ​

If this submission plugin produces one or more files, it should implement "get_files" so that the portfolio API can export a list of all the files from all of the plugins for this assignment submission. This is also used by the offline grading feature in the assignment.

view_summary() ​

The view_summary function is called to display a summary of the submission to both markers and students. It counts the number of files submitted and if it is more that a set number, it only displays a count of how many files are in the submission - otherwise it uses a helper function to write the entire list of files. This is because we want to keep the summaries really short so they can be displayed in a table. There will be a link to view the full submission on the submission status page.

The view function is called to display the entire submission to both markers and students. In this case it uses the helper function in the assignment class to write the list of files.

can_upgrade() ​

The can_upgrade function is used to identify old "Assignment 2.2" subtypes that can be upgraded by this plugin. This plugin supports upgrades from the old "upload" and "uploadsingle" assignment subtypes.

upgrade_settings() ​

This function is called once per assignment instance to upgrade the settings from the old assignment to the new mod_assign. In this case it sets the maxbytes , maxfiles and alwaysshowdescription configuration settings.

upgrade() ​

The "upgrade" function upgrades a single submission from the old assignment type to the new one. In this case it involves copying all the files from the old filearea to the new one. There is a helper function available in the assignment class for this (Note: the copy will be fast as it is just adding rows to the files table). If this function returns false, the upgrade will be aborted and rolled back.

get_editor_fields() ​

This example is from assignsubmission_onlinetext. If the plugin uses a text-editor it is ideal if the plugin implements "get_editor_fields". This allows the portfolio to retrieve the text from the plugin when exporting the list of files for a submission. This is required because the text is stored in the plugin specific table that is only known to the plugin itself. If a plugin supports multiple text areas it can return the name of each of them here.

get_editor_text() ​

This example is from assignsubmission_onlinetext. If the plugin uses a text-editor it is ideal if the plugin implements "get_editor_text". This allows the portfolio to retrieve the text from the plugin when exporting the list of files for a submission. This is required because the text is stored in the plugin specific table that is only known to the plugin itself. The name is used to distinguish between multiple text areas in the one plugin.

get_editor_format() ​

This example is from assignsubmission_onlinetext. For the same reason as the previous function, if the plugin uses a text editor, it is ideal if the plugin implements "get_editor_format". This allows the portfolio to retrieve the text from the plugin when exporting the list of files for a submission. This is required because the text is stored in the plugin specific table that is only known to the plugin itself. The name is used to distinguish between multiple text areas in the one plugin.

is_empty() ​

If a plugin has no submission data to show - it can return true from the is_empty function. This prevents a table row being added to the submission summary for this plugin. It is also used to check if a student has tried to save an assignment with no data.

submission_is_empty() ​

Determine if a submission is empty. This is distinct from is_empty() in that it is intended to be used to determine if a submission made before saving is empty.

get_file_areas() ​

A plugin should implement get_file_areas if it supports saving of any files to moodle - this allows the file areas to be browsed by the moodle file manager.

copy_submission() ​

Since Moodle 2.5 - a students submission can be copied to create a new submission attempt. Plugins should implement this function if they store data associated with the submission (most plugins).

format_for_log() ​

The format_for_log function lets a plugin produce a really short summary of a submission suitable for adding to a log message.

delete_instance() ​

The delete_instance function is called when a plugin is deleted. Note only database records need to be cleaned up - files belonging to fileareas for this assignment will be automatically cleaned up.

Useful classes ​

A submission plugin has access to a number of useful classes in the assignment module. See the phpdocs (or the code) for more information on these classes.

assign_plugin ​

This abstract class is the base class for all assignment plugins (feedback or submission plugins).

It provides access to the assign class which represents the current assignment instance through "$this->assignment".

assign_submission_plugin ​

This is the base class all assignment submission plugins must extend. It contains a small number of additional function that only apply to submission plugins.

This is the main class for interacting with the assignment module.

It contains public functions that are useful for listing users, loading and updating submissions, loading and updating grades, displaying users etc.

Other features ​

Add calendar events ​.

Submission plugins can add events to the Moodle calendar without side effects. These will be hidden and deleted in line with the assignment module. For example:

This code should be placed in the save_settings() method of your assign_submission_plugin class.

  • settings.php
  • get_settings()
  • save_settings()
  • get_form_elements()
  • get_files()
  • view_summary()
  • can_upgrade()
  • upgrade_settings()
  • get_editor_fields()
  • get_editor_text()
  • get_editor_format()
  • submission_is_empty()
  • get_file_areas()
  • copy_submission()
  • format_for_log()
  • delete_instance()
  • assign_plugin
  • assign_submission_plugin
  • Add calendar events

Making the most of Moodle’s Assignments for formative and summative assessment

Moodle’s assignment activities are easy to set up and offer many possibilities to create unique learning experiences for your students.

The Assignment activity in Moodle allows students to submit work for their teachers to grade or assess. The learners’ submissions may be text typed online or uploaded files of any format that the teachers specify. While creating an Assignment is quite straightforward, this activity has several settings that educators can combine to create unique experiences for their learners. 

Moodle Assignment for formative and summative assessment

Because it has so many combinations of configuration, the Assignment activity can be used both for formative assessment and summative evaluation. The table below outlines the goals and characteristics of each type of assessment: 

Differences between formative and summative assessment. The content is described below the image.

In formative assessment the goal is to monitor student learning therefore the assignments should be set to be always available, without necessarily being graded, allowing additional attempts, with no pass grade required (if it is graded). The  activity completion is usually set to “view” or “submit”. An formative assignment such as this often gets a 0% weight in the gradebook. 

In summative assessment, the goal is to evaluate student learning via assessment, thus a summative assignment is usually  set up with clear start, end and cut-off dates. It will be graded, with additional attempts to re-open the assessment set manually. Summative assessments are usually set with a required pass grade and the activity completion linked to requiring a “grade”. Summative assignments often have a weight higher than 20% in the gradebook.

Moodle Assignment submissions

There are many ways to combine submission types and settings in Assignment activity to achieve your teaching and learning goals or simply streamline your class management:

Assignments with no submission required These are assignments where learners don’t have to submit anything to complete the assessment. While this may sound counterintuitive, this type of Assignment can be used, for instance, for offline assessment -use it as an attendance sheet on a field trip- or for example, to assess a face-to-face speaking Assignment where learners really don’t have anything to submit. 

Assignments with online text submission With this type of Assignment submissions, learners add their work directly into the Assignment activity using the Atto editor, a rich text editor that allows learners to write text, add images and even record audio or video files. For this and for all other submission types, you can enable an option to allow learners to work in draft versions of their Assignment before sending the final submission.

Assignments with file submission This type of submission for Assignments requires learners to submit a file -teachers can define its format and size- for teachers to evaluate. To streamline the grading process, teachers can download all submissions at once, including a grading worksheet that displays the user name, email and submission status and allows teachers to add a grade and feedback in comments – and then bulk-upload all assessments back to Moodle, including a separate feedback file for each submission.

Group assignments in Moodle Collaborative learning is at the heart of Moodle LMS, so Moodle Assignments can easily be set up to be submitted as a group. Teachers can set these Assignments up so that only one of the group members has to submit the file, or make it mandatory for each team member to make the submission. Favourite tip: Our Moodle Academy team recommends combining this type of Assignment with a peer evaluation to know how the experience was for each of the group members.

Grading Moodle Assignments

Moodle Assignments support two main types of grading: simple direct grading and advanced grading. The first group includes grading done through numerical scales, custom scales (for example, stars or words like weak , satisfactory , strong , etc) or no grading at all. Advanced grading methods in Moodle include rubrics and marking guides, and we’ll look at them in more detail:

Moodle Assignment: assessment with marking guides In this type of grading, the teacher defines a series of criteria and assigns a maximum amount of marking points to each. When assessing learners’ assignments, the teachers provide both a numerical mark and a comment for each of the criteria. For this type of grading, you can make the criteria and maximum marking points available for learners to see – this helps them know what’s expected from them and what they need to cover in their submission. Favourite tip: Use ‘frequently used comments’ to speed up your grading process and to ensure that your grading is consistent.

Moodle Assignment: assessment with rubrics For grading with rubrics, teachers create a set of criteria with several levels of achievement, all displayed on a table. Sharing the rubric with learners is important, as it lets learners know how they’ll be assessed. For each submission, the rubric will be displayed to teachers, who then can select the level of accomplishment for each of the criteria just by clicking on it, as well as leave written feedback if necessary.

Moodle Assignment: assessment with marking workflow When you set up a marking workflow for an Assignment, it means that learners’ work can be assessed by several teachers. You can manually design the workflow and define the sequence of states (eg not marked , in marking , marked ), as well as allocate marking to another teacher.

This content has been extracted from the Moodle Academy webinar Assessment: exploring Assignments, facilitated by Moodle Education Advisor Anna Krassa. Watch the full webinar on our Moodle Academy site to see 7 real life examples on how you can combine submission types and grading types with availability and different types of feedback to create the right Assignment for your teaching and learning goals .

Increasing cybersecurity in companies: Harnessing Intelliboard’s learning analytics and Moodle Image

Increasing cybersecurity in companies: Harnessing Intelliboard’s learning analytics and Moodle

Moodle Certified Partner Emprove expands reach to Costa Rica Image

Moodle Certified Partner Emprove expands reach to Costa Rica

Announcing the provisional agenda for MoodleMoot Global 2024! Image

Announcing the provisional agenda for MoodleMoot Global 2024!

Announcing our latest Gold Sponsor for MoodleMoot Global 2024: Kialo Edu Image

Announcing our latest Gold Sponsor for MoodleMoot Global 2024: Kialo Edu

Documentation

Assignment activity.

  • Managing activities
  • BigBlueButton
  • LTI External tool

What is the Assignment activity?

Assignments allow students to submit work to their teacher for grading. The work may be text typed online or uploaded files of any type the teacher’s device can read. Grading may be by simple percentages or custom scales, or more complex rubrics may be used. Students may submit as individuals or in groups.

--> Continue Dismiss