Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Submissions Library: Difference between revisions

From MoodleDocs
Line 179: Line 179:
== How it works ==
== How it works ==


=== API for activity modules ===
==== Activity instance settings form ====
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:
<code php>$this->standard_submission_coursemodule_elements();</code>
==== Displaying submission form ====
==== Save/update submission ====
==== Delete submission ====
=== General workflow details ===
==== Student makes a submission ====
==== Teacher views student's submission ====
==== Someone tries to download a file from submissionplugin_file ====
==== Course module deletion ====
=== How "File submission" plugin stores files ===
=== Accessing files ===
=== Submission plugin development ===
== Backup/restore ==


== Backup/restore ==
== Backup/restore ==

Revision as of 17:34, 22 June 2015

Project goal

Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.


Project scope

A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.

The existing modules requiring submissions (Assignment, Workshop) should use this library.


Relevant tracker issues

  1. MDL-47344 - Allow usage of submission methods in other plugins


Use cases

  1. Assignment: no comment.
  2. Workshop: uses submissions but it's another code doing the same.
  3. Lesson: as well as questions the submissions could be used at lessons for a small tasks. For example, a task at the end of lesson about MS Paint: draw an your dream house, save it and upload.
  4. Community module: for example, Assignment with individual tasks could not re-implement all existing submission types.
  5. Non-mod usage? If there is no such cases this library should only work with activity modules.

Database schema

submissions_bindings

Identifies all connected submission plugins to an activity modules.

Field Type Default Description
id bigint Auto-numbered.
context bigint Activity context.
area varchar(100) An area within activity module. A module may have a few.
method varchar(100) Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.

submissions_pluginconfig

Stores plugins configuration.

Field Type Default Description
id bigint Auto-numbered.
binding bigint Activated plugin. Points to submissions_bindings record.
option varchar(100) Plugin setting name.
value text Setting value.

submissions_instances

Identifies all submissions. A data associated with the submission is stored by plugin.

Field Type Default Description
id bigint Auto-numbered.
binding bigint Activated plugin. Points to submissions_bindings record.
itemid bigint null Identifies an element within area. For example, answer or user id.
timecreated bigint 0 When the submission was created.
timemodified bigint 0 Latest submission modification time.
status int 0 Draft (default), Latest, Archived.

submissionplugin_onlinetext

This is a table example for "Online text" plugin. This table is not a part of library.

Field Type Default Description
id bigint Auto-numbered.
submissioninstance bigint Point to submission from submissions_instances table.
onlinetext text Actual submission data.
onlineformat int 0 Text format.

submissionplugin_file

This is a table example for "File submission" plugin. This table is not a part of library.

Field Type Default Description
id bigint Auto-numbered.
submissioninstance bigint Point to submission from submissions_instances table.
numfiles bigint Number of submitted files.

How it works

API for activity modules

Activity instance settings form

In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used: $this->standard_submission_coursemodule_elements();

Displaying submission form

Save/update submission

Delete submission

General workflow details

Student makes a submission

Teacher views student's submission

Someone tries to download a file from submissionplugin_file

Course module deletion

How "File submission" plugin stores files

Accessing files

Submission plugin development

Backup/restore

Backup/restore