<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nixo</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nixo"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Nixo"/>
	<updated>2026-07-29T04:21:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48116</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48116"/>
		<updated>2015-06-22T18:36:38Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Someone tries to download a file from submissionplugin_file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
&lt;br /&gt;
See also: [[#Accessing files]]&lt;br /&gt;
&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
A main plugin class should be calles submissionplugin_&amp;lt;pluginnname&amp;gt; and it should be inherited from abstract class submissionplugin.&lt;br /&gt;
&lt;br /&gt;
TODO: add detailed description on methods plugin must implement.&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
The submission must be a part of activity module instances.&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Assign submission plugins]]&lt;br /&gt;
* [[Advanced grading methods]] - if we have a multiple grading areas, each of those area may require a submissions.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48115</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48115"/>
		<updated>2015-06-22T18:35:01Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
A main plugin class should be calles submissionplugin_&amp;lt;pluginnname&amp;gt; and it should be inherited from abstract class submissionplugin.&lt;br /&gt;
&lt;br /&gt;
TODO: add detailed description on methods plugin must implement.&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
The submission must be a part of activity module instances.&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Assign submission plugins]]&lt;br /&gt;
* [[Advanced grading methods]] - if we have a multiple grading areas, each of those area may require a submissions.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48114</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48114"/>
		<updated>2015-06-22T18:34:45Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
A main plugin class should be calles submissionplugin_&amp;lt;pluginnname&amp;gt; and it should be inherited from abstract class submissionplugin.&lt;br /&gt;
&lt;br /&gt;
TODO: add detailed description on methods plugin must implement.&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
The submission must be a part of activity module instances.&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Assign submission plugins]]&lt;br /&gt;
* [[Advanced Grading Methods]] - if we have a multiple grading areas, each of those area may require a submissions.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48113</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48113"/>
		<updated>2015-06-22T18:15:52Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Backup/restore */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
A main plugin class should be calles submissionplugin_&amp;lt;pluginnname&amp;gt; and it should be inherited from abstract class submissionplugin.&lt;br /&gt;
&lt;br /&gt;
TODO: add detailed description on methods plugin must implement.&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
The submission must be a part of activity module instances.&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48112</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48112"/>
		<updated>2015-06-22T18:14:16Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Submission plugin development */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
A main plugin class should be calles submissionplugin_&amp;lt;pluginnname&amp;gt; and it should be inherited from abstract class submissionplugin.&lt;br /&gt;
&lt;br /&gt;
TODO: add detailed description on methods plugin must implement.&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48111</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48111"/>
		<updated>2015-06-22T18:12:54Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Accessing files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
The activity module should be responsible of giving access to files stored by submission plugins, because only activity module can interpret area and itemid correctly.&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48110</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48110"/>
		<updated>2015-06-22T18:10:39Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* How &amp;quot;File submission&amp;quot; plugin stores files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
File submission plugin stores all files at file areas identified by:&lt;br /&gt;
* context — activity context (from submissions_bindings)&lt;br /&gt;
* component name — submissionplugin_file&lt;br /&gt;
* area type — submissionplugin_file_&amp;lt;area&amp;gt; (&amp;lt;area&amp;gt;  from submissions_bindings)&lt;br /&gt;
* itemid — submission instance id.&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48109</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48109"/>
		<updated>2015-06-22T18:08:22Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Course module deletion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
&lt;br /&gt;
submission::delete_all_for_context(...) call should be added to course_delete_module(...) function.&lt;br /&gt;
&lt;br /&gt;
Note: all associated files will be deleted when course_delete_module(...) function calls deletion of all files associated with the module&#039;s context. Perhaps submission plugins should not rely on this.&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48108</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48108"/>
		<updated>2015-06-22T18:03:31Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Teacher views student&amp;#039;s submission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48107</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48107"/>
		<updated>2015-06-22T18:03:19Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Student makes a submission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48106</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48106"/>
		<updated>2015-06-22T18:03:06Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Course module deletion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
[[{{ns:file}}:submissionlib delcoursemod.png|200px|thumb|none|UML Sequence Diagram: course module deletion]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:submissionlib_delcoursemod.png&amp;diff=48105</id>
		<title>File:submissionlib delcoursemod.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:submissionlib_delcoursemod.png&amp;diff=48105"/>
		<updated>2015-06-22T18:02:44Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48104</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48104"/>
		<updated>2015-06-22T18:02:08Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Someone tries to download a file from submissionplugin_file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
[[{{ns:file}}:submissionlib accessfile.png|200px|thumb|none|UML Sequence Diagram: someone tries to download a file]]&lt;br /&gt;
TODO: add more details&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:submissionlib_accessfile.png&amp;diff=48103</id>
		<title>File:submissionlib accessfile.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:submissionlib_accessfile.png&amp;diff=48103"/>
		<updated>2015-06-22T18:01:29Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48102</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48102"/>
		<updated>2015-06-22T18:01:02Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Teacher views student&amp;#039;s submission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib teacher.png|200px|thumb|none|UML Sequence Diagram: teacher views student&#039;s submission]]&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:submissionlib_teacher.png&amp;diff=48101</id>
		<title>File:submissionlib teacher.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:submissionlib_teacher.png&amp;diff=48101"/>
		<updated>2015-06-22T18:00:29Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48100</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48100"/>
		<updated>2015-06-22T17:59:53Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* General workflow details */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|none|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48099</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48099"/>
		<updated>2015-06-22T17:58:49Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Student makes a submission */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
[[{{ns:file}}:submissionlib student.png|200px|thumb|left|UML Sequence Diagram: student makes a submission]]&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:submissionlib_student.png&amp;diff=48098</id>
		<title>File:submissionlib student.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:submissionlib_student.png&amp;diff=48098"/>
		<updated>2015-06-22T17:57:08Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48097</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48097"/>
		<updated>2015-06-22T17:48:18Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48096</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48096"/>
		<updated>2015-06-22T17:47:58Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Backup/restore */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== What else to consider ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48095</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48095"/>
		<updated>2015-06-22T17:46:19Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* API for activity modules */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying a submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
First, a submission_instance object should be retrieved.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submissioninstance = $submission-&amp;gt;get_submission_instance($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, it can be displayed.&lt;br /&gt;
&amp;lt;code php&amp;gt;if ($submissioninstance) {&lt;br /&gt;
    $submissioninstance-&amp;gt;display();&lt;br /&gt;
    // or&lt;br /&gt;
    $html = $submissioninstance-&amp;gt;render();&lt;br /&gt;
}&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A special method should be used to add elements on submission form. A previous submission can be loaded by specifying $baseitemid.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;add_submission_form_elements($mform, $baseitemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
Activity module should access the submissions using a submission class.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save or update the submission a special method should be used. It accepts submitted form data as its only argument.&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission-&amp;gt;save($formdata);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
All submissions associated with the activity module instance can be deleted by using the following static method:&lt;br /&gt;
&amp;lt;code php&amp;gt;submission::delete_all_for_context($context);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Individual submissions can be deleted this way:&lt;br /&gt;
&amp;lt;code php&amp;gt;$submission = new submission($context, $area);&lt;br /&gt;
$submission-&amp;gt;delete($itemid);&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48094</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48094"/>
		<updated>2015-06-22T17:34:42Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* How it works */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
=== API for activity modules ===&lt;br /&gt;
&lt;br /&gt;
==== Activity instance settings form ====&lt;br /&gt;
In order to add a plugin settings elements on activity settings page the following method of moodleform_mod should be used:&lt;br /&gt;
&amp;lt;code php&amp;gt;$this-&amp;gt;standard_submission_coursemodule_elements();&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Displaying submission form ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Save/update submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Delete submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== General workflow details ===&lt;br /&gt;
&lt;br /&gt;
==== Student makes a submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Teacher views student&#039;s submission ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Someone tries to download a file from submissionplugin_file ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Course module deletion ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== How &amp;quot;File submission&amp;quot; plugin stores files ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Accessing files ===&lt;br /&gt;
&lt;br /&gt;
=== Submission plugin development ===&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48093</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48093"/>
		<updated>2015-06-22T17:25:45Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Use cases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? If there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48080</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48080"/>
		<updated>2015-06-22T11:33:30Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* submissionplugin_file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
This is a table example for &amp;quot;File submission&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| numfiles&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Number of submitted files.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48079</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48079"/>
		<updated>2015-06-22T11:32:25Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* submissionplugin_onlinetext */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
This is a table example for &amp;quot;Online text&amp;quot; plugin. This table is not a part of library.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;submissioninstance&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Point to submission from submissions_instances table.&lt;br /&gt;
|-&lt;br /&gt;
| onlinetext&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Actual submission data.&lt;br /&gt;
|-&lt;br /&gt;
| onlineformat&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Text format.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48078</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48078"/>
		<updated>2015-06-22T11:26:52Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* submissions_instances */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
Identifies all submissions. A data associated with the submission is stored by plugin.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| itemid&lt;br /&gt;
| bigint&lt;br /&gt;
| null&lt;br /&gt;
| Identifies an element within area. For example, answer or user id.&lt;br /&gt;
|-&lt;br /&gt;
| timecreated&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| When the submission was created.&lt;br /&gt;
|-&lt;br /&gt;
| timemodified&lt;br /&gt;
| bigint&lt;br /&gt;
| 0&lt;br /&gt;
| Latest submission modification time.&lt;br /&gt;
|-&lt;br /&gt;
| status&lt;br /&gt;
| int&lt;br /&gt;
| 0&lt;br /&gt;
| Draft (default), Latest, Archived.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48077</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48077"/>
		<updated>2015-06-22T11:19:23Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* submissions_pluginconfig */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
Stores plugins configuration.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;binding&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activated plugin. Points to submissions_bindings record.&lt;br /&gt;
|-&lt;br /&gt;
| option&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Plugin setting name.&lt;br /&gt;
|-&lt;br /&gt;
| value&lt;br /&gt;
| text&lt;br /&gt;
|&lt;br /&gt;
| Setting value.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48076</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48076"/>
		<updated>2015-06-22T11:15:40Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Database schema */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== submissions_pluginconfig ===&lt;br /&gt;
&lt;br /&gt;
=== submissions_instances ===&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_onlinetext ===&lt;br /&gt;
&lt;br /&gt;
=== submissionplugin_file ===&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48075</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48075"/>
		<updated>2015-06-22T11:07:47Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Database schema */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
=== submissions_bindings ===&lt;br /&gt;
Identifies all connected submission plugins to an activity modules.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Auto-numbered.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;context&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
|&lt;br /&gt;
| Activity context.&lt;br /&gt;
|-&lt;br /&gt;
| area&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| An area within activity module. A module may have a few.&lt;br /&gt;
|-&lt;br /&gt;
| method&lt;br /&gt;
| varchar(100)&lt;br /&gt;
|&lt;br /&gt;
| Submission plugin name. It is considered that the plugin is activated in these area of these activity module instance.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48074</id>
		<title>Submissions Library</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Submissions_Library&amp;diff=48074"/>
		<updated>2015-06-22T10:56:00Z</updated>

		<summary type="html">&lt;p&gt;Nixo: Created page with &amp;quot;== Project goal == Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.   == Project scope ==...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Project goal ==&lt;br /&gt;
Make activity module developers (not only Assignment developers) able to use submission types: both standard and community-developed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project scope ==&lt;br /&gt;
A library providing API for activity module submission types support implementation. Actual proposition is to make assignsubmission plugins system-level.&lt;br /&gt;
&lt;br /&gt;
The existing modules requiring submissions (Assignment, Workshop) should use this library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Relevant tracker issues ==&lt;br /&gt;
# MDL-47344 - Allow usage of submission methods in other plugins&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
# Assignment: no comment.&lt;br /&gt;
# Workshop: uses submissions but it&#039;s another code doing the same.&lt;br /&gt;
# 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.&lt;br /&gt;
# Community module: for example, [[POAS Assignment development|Assignment with individual tasks]] could not re-implement all existing submission types.&lt;br /&gt;
# Non-mod usage? Is there is no such cases this library should only work with activity modules.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Database schema ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Backup/restore ==&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=48073</id>
		<title>VSTU projects</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=48073"/>
		<updated>2015-06-22T10:26:07Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Lead: Sychev Oleg Aleksandrovich==&lt;br /&gt;
Senior Lecturer of POAS (Software Engineering) department&lt;br /&gt;
&lt;br /&gt;
===Core patches===&lt;br /&gt;
# [[Categories editing interface improvment|Improvment of editing interface for category list]]. Moving category anywhere should require only one page reload. Developers: Sychev Oleg, Shkarupa Alex. Status: waiting reviewing!&lt;br /&gt;
# [[Javascript-interface for repeat_elements function|Javascript-interface for repeat_elements function]] - adding new blanks to the form shoudn&#039;t require page reloads.&lt;br /&gt;
# [[Forum thread subscription|Forum thread subscription]] - a long standing request to be able to subscript only to the thread, not whole forum.&lt;br /&gt;
# [[AJAX mod editing|Editing course modules without reloading ]] - adding/editing activities(resources) in AJAX mode without page reloads.&lt;br /&gt;
# [[Exporting/importing several question categories at once|Exporting/importing several question categories at once]] - changing the interface of exporting question categories.&lt;br /&gt;
# [[Capturing and sending to the server selection user piece of text on the web page|Capturing and sending to the server selection user piece of text on the web page]] - TODO.&lt;br /&gt;
# [[Save category description in Moodle XML import/export|Save category description in Moodle XML import/export]] - TODO.&lt;br /&gt;
&lt;br /&gt;
===Activity modules===&lt;br /&gt;
# [[Assignment development|New assignment-replacement module]] with support for individual tasks (with custom fields), several grading criterions, automatic graders etc.&lt;br /&gt;
# [[Subcourse module improvments|Subcourse module improvments]] - improve Subcourse module to get rid of buggy Metacourses and make it actually useful.&lt;br /&gt;
# [[Question-lesson link|A proposition how to link question engine with lesson module]] - adding only two simple functions to the question definition we could create ideal connection with the lesson module, and not only it.&lt;br /&gt;
&lt;br /&gt;
===Question types===&lt;br /&gt;
# [https://docs.moodle.org/en/Preg_question_type Preg question type] - regular expression question type, developed on more solid algorithmic basis than regex one.&lt;br /&gt;
# [[Auto-feedback shortanswer question|Auto-feedback shortanswer question &amp;quot;CorrectWriting&amp;quot; project]] and [https://docs.moodle.org/en/question/type/correctwriting user documentation] for shortanswer question which could be able to detect typos and misplaced, missing or extra words and give appropriate feedback.&lt;br /&gt;
&lt;br /&gt;
===Question behaviours===&lt;br /&gt;
# [https://docs.moodle.org/dev/Hinting_question_behaviours(VSTU) Hinting behaviours] - behaviours that would help standartise hinting from each qtype.&lt;br /&gt;
&lt;br /&gt;
===Blocks===&lt;br /&gt;
# [[Linked activities|Linked activities]] to allow editing properties of multiple activities at once.&lt;br /&gt;
# [https://docs.moodle.org/en/Formal_Languages_Block Formal languages block] which allows to scan (tokenize) and (future) parse text in several languages (currently english, C, C++).&lt;br /&gt;
# [https://docs.moodle.org/en/Auto_role_assignment_block Auto role assignment block] is useful to temporary restrict (or enhance) user abilities while doing something.&lt;br /&gt;
# [https://docs.moodle.org/en/Supervised_block Supervised block] is much better than IP filter+time control if you want students to be able to do something only under teacher supervision. Supports out of the box restricting quizzes for supervized sessions only, but very powerful when combined with previous one (auto role assignment), allowing any permission changes.&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
# [[Auto-backup library|Auto-backup library]] - adding very small information to install.xml files it is possible to automate many tedious tasks of programming backup/restore for the plugins.&lt;br /&gt;
# [[Submissions Library]] - make assignsubmission plugins usable by any activity module.&lt;br /&gt;
&lt;br /&gt;
===Grading Methods===&lt;br /&gt;
# [[Meta AGM]] - grading method which allows usage of multiple AGM&#039;s with one activity at once.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=47428</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=47428"/>
		<updated>2015-03-02T15:24:49Z</updated>

		<summary type="html">&lt;p&gt;Nixo: Fixed some grammar&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criteria allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
This module allows a teacher to define several metacriteria and define different grading methods in it. The teacher defines metacriteria by himself.&lt;br /&gt;
&lt;br /&gt;
While AGM design allows us to have only one active grading method in one gradeable area, we can create more areas (fake areas actually) for the same context. We call it &#039;metacriteria&#039;. It&#039;s safe because any other modules uses MODULENAME_grading_areas_list() to list the areas, not DB query.&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
[[image:metaagm-sd.png|400px|thumb|none|UML sequence diagram of how the teacher defines the metacriteria and what happens in DB during this process.]]&lt;br /&gt;
&lt;br /&gt;
1.1 &#039;&#039;Get the metacriteria list:&#039;&#039; list of areas for current contextid and module will be returned (except the area which Meta AGM is defined in).&lt;br /&gt;
&lt;br /&gt;
3.2.1.1: A new record with fake area for current contextid and module will be inserted to grading_areas table and a record to gradeform_metaagm_areas (see below).&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each metacriterion additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each metacriterion and a weight of grade for this metacriterion.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for Meta AGM.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;subareaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade of this metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this metacriterion.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46992</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46992"/>
		<updated>2014-12-08T06:54:22Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* DB schema */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
This module allows a teacher to define several metacriterions and define different grading methods in it. The teacher defines metacriterions by himself.&lt;br /&gt;
&lt;br /&gt;
While AGM design allows us to have only one active grading method in one gradeable area, we can create more areas (fake areas actually) for the same context. We call it &#039;metacriterions&#039;. It&#039;s safe because any other modules uses MODULENAME_grading_areas_list() to list the areas, not DB query.&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
[[image:metaagm-sd.png|400px|thumb|none|UML sequence diagram of how the teacher defines the metacriterions and what happens in DB during this process.]]&lt;br /&gt;
&lt;br /&gt;
1.1 &#039;&#039;Get the metacriterions list:&#039;&#039; list of areas for current contextid and module will be returned (except the area which Meta AGM is defined in).&lt;br /&gt;
&lt;br /&gt;
3.2.1.1: A new record with fake area for current contextid and module will be inserted to grading_areas table and a record to gradeform_metaagm_areas (see below).&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each metacriterion additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each metacriterion and a weight of grade for this metacriterion.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for Meta AGM.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;subareaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade of this metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this metacriterion.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:metaagm-erd.png&amp;diff=46991</id>
		<title>File:metaagm-erd.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:metaagm-erd.png&amp;diff=46991"/>
		<updated>2014-12-08T06:48:44Z</updated>

		<summary type="html">&lt;p&gt;Nixo: Nixo uploaded a new version of &amp;amp;quot;File:metaagm-erd.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46958</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46958"/>
		<updated>2014-11-30T22:28:31Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
This module allows a teacher to define several metacriterions and define different grading methods in it. The teacher defines metacriterions by himself.&lt;br /&gt;
&lt;br /&gt;
While AGM design allows us to have only one active grading method in one gradeable area, we can create more areas (fake areas actually) for the same context. We call it &#039;metacriterions&#039;. It&#039;s safe because any other modules uses MODULENAME_grading_areas_list() to list the areas, not DB query.&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
[[image:metaagm-sd.png|400px|thumb|none|UML sequence diagram of how the teacher defines the metacriterions and what happens in DB during this process.]]&lt;br /&gt;
&lt;br /&gt;
1.1 &#039;&#039;Get the metacriterions list:&#039;&#039; list of areas for current contextid and module will be returned (except the area which Meta AGM is defined in).&lt;br /&gt;
&lt;br /&gt;
3.2.1.1: A new record with fake area for current contextid and module will be inserted to grading_areas table and a record to gradeform_metaagm_areas (see below).&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each metacriterion additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each metacriterion and a weight of grade for this metacriterion.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade of this metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this metacriterion.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46957</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46957"/>
		<updated>2014-11-30T22:26:28Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
This module allows a teacher to define several metacriterions and define different grading methods in it. The teacher defines metacriterions by himself.&lt;br /&gt;
&lt;br /&gt;
While AGM design allows us to have only one active grading method in one gradeable area, we can create more areas (fake areas actually) for the same context. We call it &#039;metacriterions&#039;. It&#039;s safe because any other modules uses MODULENAME_grading_areas_list() to list the areas, not DB query.&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
[[image:metaagm-sd.png|400px|thumb|left|UML sequence diagram of how the teacher defines the metacriterions and what happens in DB during this process.]]&lt;br /&gt;
&lt;br /&gt;
1.1 &#039;&#039;Get the metacriterions list:&#039;&#039; list of areas for current contextid and module will be returned (except the area which Meta AGM is defined in).&lt;br /&gt;
3.2.1.1: A new record with fake area for current contextid and module will be inserted to grading_areas table and a record to gradeform_metaagm_areas (see below).&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each metacriterion additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each metacriterion and a weight of grade for this metacriterion.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable area for metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade of this metacriterion.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this metacriterion.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:metaagm-sd.png&amp;diff=46956</id>
		<title>File:metaagm-sd.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:metaagm-sd.png&amp;diff=46956"/>
		<updated>2014-11-30T22:16:01Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46955</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46955"/>
		<updated>2014-11-30T20:45:54Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
This module allows a teacher to define several subareas and define different grading methods in it. The teacher defines subareas by himself.&lt;br /&gt;
&lt;br /&gt;
While AGM design allows us to have only one active grading method, we can create more areas (fake areas actually) for the same context. We call it &#039;subareas&#039;. It&#039;s safe because any other modules uses MODULENAME_grading_areas_list() to list the areas, not DB query.&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
TODO: sequence diagram&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each subarea additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each subarea and a weight of grade for this subarea.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable subarea.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade in this subarea.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this subarea.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46923</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46923"/>
		<updated>2014-11-27T09:55:09Z</updated>

		<summary type="html">&lt;p&gt;Nixo: Added DB scheme&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
TODO: description of subareas idea&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
TODO: sequence diagram&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
[[File:metaagm-erd.png]]&lt;br /&gt;
&lt;br /&gt;
==== gradeform_metaagm_areas ====&lt;br /&gt;
Each subarea additionally listed in this table. There are weight and name fields are important. Teacher can define a human-readable name for each subarea and a weight of grade for this subarea.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Type&lt;br /&gt;
! Default&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;id&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| Auto-numbered&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;areaid&#039;&#039;&#039;&lt;br /&gt;
| bigint&lt;br /&gt;
| &lt;br /&gt;
| The gradeable subarea.&lt;br /&gt;
|-&lt;br /&gt;
| weight&lt;br /&gt;
| float&lt;br /&gt;
| 1.0&lt;br /&gt;
| Weight for grade in this subarea.&lt;br /&gt;
|-&lt;br /&gt;
| name&lt;br /&gt;
| varchar(255)&lt;br /&gt;
| &lt;br /&gt;
| Human-readable name of this subarea.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=File:metaagm-erd.png&amp;diff=46922</id>
		<title>File:metaagm-erd.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=File:metaagm-erd.png&amp;diff=46922"/>
		<updated>2014-11-27T09:36:03Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46894</id>
		<title>Meta AGM</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Meta_AGM&amp;diff=46894"/>
		<updated>2014-11-22T21:53:16Z</updated>

		<summary type="html">&lt;p&gt;Nixo: Created page with &amp;quot;== General information == &amp;#039;&amp;#039;&amp;#039;Project goal:&amp;#039;&amp;#039;&amp;#039; to be able to use multiple Advanced grading methods at one grading area.  &amp;#039;&amp;#039;&amp;#039;Project scope.&amp;#039;&amp;#039;&amp;#039; This project does not change t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== General information ==&lt;br /&gt;
&#039;&#039;&#039;Project goal:&#039;&#039;&#039; to be able to use multiple [[Advanced grading methods]] at one grading area.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Project scope.&#039;&#039;&#039; This project does not change the AGM internals and its API. Meta AGM is a grading method, the form of which is a number of another AGMs.&lt;br /&gt;
&lt;br /&gt;
== Use cases ==&lt;br /&gt;
In examples below &#039;rubric&#039; and &#039;criterial&#039; grading methods were used. Criterial is a work-in-progress method which allows teacher to define a form with a number of numerical fields, checkboxes, etc.&lt;br /&gt;
&lt;br /&gt;
=== 1. Assessment of student&#039;s program on the course of high-level programming basics ===&lt;br /&gt;
There are lot of aspects of checking the quality of program which is developed by student: efficiency, code style compliance, lab activity protocol... So we need a various grading method types to develop a set of criterions allowing us to assess all the aspects described in one assignment module.&lt;br /&gt;
&lt;br /&gt;
TODO: defined AGM example&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
TODO: description of fake areas idea&lt;br /&gt;
&lt;br /&gt;
=== How it works ===&lt;br /&gt;
TODO: sequence diagram&lt;br /&gt;
&lt;br /&gt;
=== DB schema ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
=== Backup/Restore ===&lt;br /&gt;
TODO&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Advanced grading methods]]&lt;br /&gt;
* [[Advanced grading API]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=46870</id>
		<title>VSTU projects</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=46870"/>
		<updated>2014-11-20T20:17:35Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Lead: Sychev Oleg Aleksandrovich==&lt;br /&gt;
Senior Lecturer of POAS (Software Engineering) department&lt;br /&gt;
&lt;br /&gt;
===Core patches===&lt;br /&gt;
# [[Categories editing interface improvment|Improvment of editing interface for category list]]. Moving category anywhere should require only one page reload. Developers: Sychev Oleg, Shkarupa Alex. Status: waiting reviewing!&lt;br /&gt;
# [[Javascript-interface for repeat_elements function|Javascript-interface for repeat_elements function]] - adding new blanks to the form shoudn&#039;t require page reloads.&lt;br /&gt;
# [[Forum thread subscription|Forum thread subscription]] - a long standing request to be able to subscript only to the thread, not whole forum.&lt;br /&gt;
# [[AJAX mod editing|Editing course modules without reloading ]] - adding/editing activities(resources) in AJAX mode without page reloads.&lt;br /&gt;
# [[Exporting/importing several question categories at once|Exporting/importing several question categories at once]] - changing the interface of exporting question categories.&lt;br /&gt;
# [[Capturing and sending to the server selection user piece of text on the web page|Capturing and sending to the server selection user piece of text on the web page]] - TODO.&lt;br /&gt;
# [[Save category description in Moodle XML import/export|Save category description in Moodle XML import/export]] - TODO.&lt;br /&gt;
&lt;br /&gt;
===Activity modules===&lt;br /&gt;
# [[Assignment development|New assignment-replacement module]] with support for individual tasks (with custom fields), several grading criterions, automatic graders etc.&lt;br /&gt;
# [[Subcourse module improvments|Subcourse module improvments]] - improve Subcourse module to get rid of buggy Metacourses and make it actually useful.&lt;br /&gt;
# [[Question-lesson link|A proposition how to link question engine with lesson module]] - adding only two simple functions to the question definition we could create ideal connection with the lesson module, and not only it.&lt;br /&gt;
&lt;br /&gt;
===Question types===&lt;br /&gt;
# [https://docs.moodle.org/en/Preg_question_type Preg question type] - regular expression question type, developed on more solid algorithmic basis than regex one.&lt;br /&gt;
# [[Auto-feedback shortanswer question|Auto-feedback shortanswer question &amp;quot;CorrectWriting&amp;quot; project]] and [https://docs.moodle.org/en/question/type/correctwriting user documentation] for shortanswer question which could be able to detect typos and misplaced, missing or extra words and give appropriate feedback.&lt;br /&gt;
&lt;br /&gt;
===Question behaviours===&lt;br /&gt;
# [https://docs.moodle.org/dev/Hinting_question_behaviours(VSTU) Hinting behaviours] - behaviours that would help standartise hinting from each qtype.&lt;br /&gt;
&lt;br /&gt;
===Blocks===&lt;br /&gt;
# [[Linked activities|Linked activities]] to allow editing properties of multiple activities at once.&lt;br /&gt;
# [https://docs.moodle.org/en/Formal_Languages_Block Formal languages block] which allows to scan (tokenize) and (future) parse text in several languages (currently english, C, C++).&lt;br /&gt;
# [https://docs.moodle.org/en/Auto_role_assignment_block Auto role assignment block] is useful to temporary restrict (or enhance) user abilities while doing something.&lt;br /&gt;
# [https://docs.moodle.org/en/Supervised_block Supervised block] is much better than IP filter+time control if you want students to be able to do something only under teacher supervision. Supports out of the box restricting quizzes for supervized sessions only, but very powerful when combined with previous one (auto role assignment), allowing any permission changes.&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
# [[Auto-backup library|Auto-backup library]] - adding very small information to install.xml files it is possible to automate many tedious tasks of programming backup/restore for the plugins.&lt;br /&gt;
&lt;br /&gt;
===Grading Methods===&lt;br /&gt;
# [[Meta AGM]] - grading method which allows usage of multiple AGM&#039;s with one activity at once.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=46542</id>
		<title>VSTU projects</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=VSTU_projects&amp;diff=46542"/>
		<updated>2014-10-20T17:08:13Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Lead: Sychev Oleg Aleksandrovich==&lt;br /&gt;
Senior Lecturer of POAS (Software Engineering) department&lt;br /&gt;
&lt;br /&gt;
===Core patches===&lt;br /&gt;
# [[Categories editing interface improvment|Improvment of editing interface for category list]]. Moving category anywhere should require only one page reload. Developers: Sychev Oleg, Shkarupa Alex. Status: waiting reviewing!&lt;br /&gt;
# [[Javascript-interface for repeat_elements function|Javascript-interface for repeat_elements function]] - adding new blanks to the form shoudn&#039;t require page reloads.&lt;br /&gt;
# [[Forum thread subscription|Forum thread subscription]] - a long standing request to be able to subscript only to the thread, not whole forum.&lt;br /&gt;
# [[AJAX mod editing|Editing course modules without reloading ]] - adding/editing activities(resources) in AJAX mode without page reloads.&lt;br /&gt;
# [[Exporting/importing several question categories at once|Exporting/importing several question categories at once]] - changing the interface of exporting question categories.&lt;br /&gt;
# [[Capturing and sending to the server selection user piece of text on the web page|Capturing and sending to the server selection user piece of text on the web page]] - TODO.&lt;br /&gt;
# [[Save category description in Moodle XML import/export|Save category description in Moodle XML import/export]] - TODO.&lt;br /&gt;
# [[System-wide submission methods]] - a submission methods which are usable with any plugin.&lt;br /&gt;
&lt;br /&gt;
===Activity modules===&lt;br /&gt;
# [[Assignment development|New assignment-replacement module]] with support for individual tasks (with custom fields), several grading criterions, automatic graders etc.&lt;br /&gt;
# [[Subcourse module improvments|Subcourse module improvments]] - improve Subcourse module to get rid of buggy Metacourses and make it actually useful.&lt;br /&gt;
# [[Question-lesson link|A proposition how to link question engine with lesson module]] - adding only two simple functions to the question definition we could create ideal connection with the lesson module, and not only it.&lt;br /&gt;
&lt;br /&gt;
===Question types===&lt;br /&gt;
# [https://docs.moodle.org/en/Preg_question_type Preg question type] - regular expression question type, developed on more solid algorithmic basis than regex one.&lt;br /&gt;
# [[Auto-feedback shortanswer question|Auto-feedback shortanswer question &amp;quot;CorrectWriting&amp;quot; project]] and [https://docs.moodle.org/en/question/type/correctwriting user documentation] for shortanswer question which could be able to detect typos and misplaced, missing or extra words and give appropriate feedback.&lt;br /&gt;
&lt;br /&gt;
===Question behaviours===&lt;br /&gt;
# [https://docs.moodle.org/dev/Hinting_question_behaviours(VSTU) Hinting behaviours] - behaviours that would help standartise hinting from each qtype.&lt;br /&gt;
&lt;br /&gt;
===Blocks===&lt;br /&gt;
# [[Linked activities|Linked activities]] to allow editing properties of multiple activities at once.&lt;br /&gt;
# [https://docs.moodle.org/en/Formal_Languages_Block Formal languages block] which allows to scan (tokenize) and (future) parse text in several languages (currently english, C, C++).&lt;br /&gt;
# [https://docs.moodle.org/en/Auto_role_assignment_block Auto role assignment block] is useful to temporary restrict (or enhance) user abilities while doing something.&lt;br /&gt;
# [https://docs.moodle.org/en/Supervised_block Supervised block] is much better than IP filter+time control if you want students to be able to do something only under teacher supervision. Supports out of the box restricting quizzes for supervized sessions only, but very powerful when combined with previous one (auto role assignment), allowing any permission changes.&lt;br /&gt;
&lt;br /&gt;
===Libraries===&lt;br /&gt;
# [[Auto-backup library|Auto-backup library]] - adding very small information to install.xml files it is possible to automate many tedious tasks of programming backup/restore for the plugins.&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=46541</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=46541"/>
		<updated>2014-10-20T16:46:25Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Assignment 1.9 Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
&lt;br /&gt;
== POAS Assignment Refactoring ==&lt;br /&gt;
We are planning to reorganize our code base. The main purposes are:&lt;br /&gt;
*  make it more flexible,&lt;br /&gt;
*  distribute a responsibility correctly.&lt;br /&gt;
&lt;br /&gt;
Along the way, calls of deprecated functions and methods will be removed (e. g. Logging).&lt;br /&gt;
&lt;br /&gt;
Key points are:&lt;br /&gt;
*  &#039;&#039;Namespaces.&#039;&#039; All classes will be organized using namespaces (like java packages).&lt;br /&gt;
*  &#039;&#039;Automatic class loading.&#039;&#039; Reduce usage of require().&lt;br /&gt;
*  &#039;&#039;Usage of modern API.&#039;&#039; Events 2, Logging 2, etc.&lt;br /&gt;
*  &#039;&#039;Advanced Grading Methods.&#039;&#039; The criterions will be replaced with a separate AGM plugin (POAS Criterial Grading Method or Accumulative Grading Method&amp;lt;sup&amp;gt;[Issue link?]&amp;lt;/sup&amp;gt;). The POAS Assignment will support AGM.&lt;br /&gt;
*  &#039;&#039;Usage of Assignment 2 submission methods&#039;&#039;.&lt;br /&gt;
*  &#039;&#039;A minor visual changes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Known issues:&lt;br /&gt;
*  The Assignment 2 submission methods  does not allow their usage with other plugins (MDL-47344).&lt;br /&gt;
&lt;br /&gt;
Planned namespace structure for mod_poasassignment is:&lt;br /&gt;
* &#039;&#039;&#039;classes/&#039;&#039;&#039;&lt;br /&gt;
** &#039;&#039;&#039;model/&#039;&#039;&#039;&lt;br /&gt;
*** assignment&lt;br /&gt;
*** individual_task&lt;br /&gt;
*** ...&lt;br /&gt;
*** &#039;&#039;&#039;submission/&#039;&#039;&#039;&lt;br /&gt;
**** base&lt;br /&gt;
*** &#039;&#039;&#039;distribution+strategy/&#039;&#039;&#039;&lt;br /&gt;
**** base&lt;br /&gt;
*** &#039;&#039;&#039;grader/&#039;&#039;&#039;&lt;br /&gt;
**** base&lt;br /&gt;
** &#039;&#039;&#039;view/&#039;&#039;&#039;&lt;br /&gt;
*** &#039;&#039;&#039;form/&#039;&#039;&#039;&lt;br /&gt;
*** &#039;&#039;&#039;page/&#039;&#039;&#039;&lt;br /&gt;
**** base&lt;br /&gt;
** &#039;&#039;&#039;event/&#039;&#039;&#039;&lt;br /&gt;
*** instance_available&lt;br /&gt;
*** assessable_submitted&lt;br /&gt;
*** ...&lt;br /&gt;
&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_available&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_unavailable&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\task_selected&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\assessable_submitted&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\submission_graded&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Teacher&#039;s user ID.&lt;br /&gt;
; relateduserid : Student&#039;s user ID.&lt;br /&gt;
; other-&amp;gt;isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=46353</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=46353"/>
		<updated>2014-10-02T14:19:16Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Assignment 1.9 Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
&lt;br /&gt;
== POAS Assignment Refactoring ==&lt;br /&gt;
We are planning to reorganize our code base. The main purposes are:&lt;br /&gt;
*  make it more flexible,&lt;br /&gt;
*  distribute a responsibility correctly.&lt;br /&gt;
&lt;br /&gt;
Along the way, calls of deprecated functions and methods will be removed (e. g. Logging).&lt;br /&gt;
&lt;br /&gt;
Key points are:&lt;br /&gt;
*  &#039;&#039;Namespaces.&#039;&#039; All classes will be organized using namespaces (like java packages).&lt;br /&gt;
*  &#039;&#039;Automatic class loading.&#039;&#039; Reduce usage of require().&lt;br /&gt;
*  &#039;&#039;Usage of modern API.&#039;&#039; Events 2, Logging 2, etc.&lt;br /&gt;
*  &#039;&#039;Advanced Grading Methods.&#039;&#039; The criterions will turn into a separate AGM plugin. The POAS Assignment will support AGM.&lt;br /&gt;
*  &#039;&#039;Usage of Assignment 2 submission methods&#039;&#039;.&lt;br /&gt;
*  &#039;&#039;A minor visual changes.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Known issues:&lt;br /&gt;
*  The Assignment 2 submission methods  does not allow their usage with other plugins (MDL-47344).&lt;br /&gt;
&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_available&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_unavailable&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\task_selected&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\assessable_submitted&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\submission_graded&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Teacher&#039;s user ID.&lt;br /&gt;
; relateduserid : Student&#039;s user ID.&lt;br /&gt;
; other-&amp;gt;isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44161</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44161"/>
		<updated>2014-03-16T10:44:48Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Events */ A small clarification about &amp;#039;isfinal&amp;#039;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_available&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_unavailable&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\task_selected&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\assessable_submitted&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\submission_graded&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Teacher&#039;s user ID.&lt;br /&gt;
; relateduserid : Student&#039;s user ID.&lt;br /&gt;
; other-&amp;gt;isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44160</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44160"/>
		<updated>2014-03-16T10:39:19Z</updated>

		<summary type="html">&lt;p&gt;Nixo: /* Events */ Event data changed according to Event 2 API.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_available&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_unavailable&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\task_selected&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\assessable_submitted&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\submission_graded&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; contextinstanceid : Poasassignment course module ID.&lt;br /&gt;
; userid : Teacher&#039;s user ID.&lt;br /&gt;
; relateduserid : Student&#039;s user ID.&lt;br /&gt;
; isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44159</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44159"/>
		<updated>2014-03-14T19:03:46Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_available&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\instance_unavailable&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\task_selected&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\assessable_submitted&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;\mod_poasassignment\event\submission_graded&#039;&#039;&#039;&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
; isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44014</id>
		<title>POAS Assignment development</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=POAS_Assignment_development&amp;diff=44014"/>
		<updated>2014-02-27T17:32:13Z</updated>

		<summary type="html">&lt;p&gt;Nixo: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 2.0}}&lt;br /&gt;
This was a proposition of Assignment module development from POAS department of Volgograd State Technical University. &lt;br /&gt;
We don&#039;t want to fork from core, but was forced to do it by Moodle team. So it will be a separate module, that you can use instead of standard assignment. There may be a convertor some time ago.&lt;br /&gt;
&lt;br /&gt;
New module name will be a poasassignment.&lt;br /&gt;
== Assignment 1.9 improvements ==&lt;br /&gt;
Just several simple, but useful improvements that can be done in stable version too:&lt;br /&gt;
# Usability improvement: on submission.php add a combo box to filter the content of the table: Show all/with submissions/await grading. That speed up grading much. See MDL-14238&lt;br /&gt;
# New capability: viewownsubmission. Setting it to Deny makes assignment module useful in exam context - collect student&#039;s work without their further access to it. See MDL-15356&lt;br /&gt;
# Replace link with the number of submissions (for the teacher) with more informative &amp;quot;The ___ of ___ submissions needs grading&amp;quot;. MDL-17613&lt;br /&gt;
&lt;br /&gt;
== Refactoring ==&lt;br /&gt;
Some areas of assignment can be reworked for greater flexibility and reducing code duplication. Assignment base is actualy an awful, bloated class where all things are intermixed. And any plugin inherits it fully. Some plugins have similar features too, implemented separately. Overall issue for this is MDL-17329.&lt;br /&gt;
&lt;br /&gt;
Some major improvments:&lt;br /&gt;
* &#039;types&#039; will be no longer considered separate activities, just a option in the mod_form&lt;br /&gt;
* &#039;type&#039; plugins, which defines what can be submitted, will be reduced to just that purpose, all workflow would be controlled from main module (reducing numerous duplicates and inconsistences)&lt;br /&gt;
* there will be two basic &#039;type&#039; plugins (text and files), which can be used in any combination (from no one to both)&lt;br /&gt;
** no one is effectively an offline task&lt;br /&gt;
** files (reworked upload) can serve for both single and multiple files uploads&lt;br /&gt;
* there will be possible to create new activities based on this module, inheriting it&#039;s main classes, for major workflow customisations, and they will have full access to &#039;type&#039; plugins&lt;br /&gt;
== New Features ==&lt;br /&gt;
&lt;br /&gt;
=== Teams ===&lt;br /&gt;
  This feature is on hold and may wait for a second version of module. Right now we are more focused on task distribution&lt;br /&gt;
&lt;br /&gt;
One main assumption in the assignment module is need to be eliminated is &amp;quot;one user=one submission=one grade&amp;quot;. The quite common practice is grouped assignments, where students can work in small groups on a task. So we need a teams support there. (Well, quite big work as many functions use this assumption).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Team&#039;&#039;&#039; is a group of students whose work will results in one submission. Teams features:&lt;br /&gt;
* submission is one per team, but a grade can be given on per-team or per-student basis&lt;br /&gt;
* teacher can define a minimum and maximum number of students in the team&lt;br /&gt;
* self-organization (with possibility of confirmation by teacher) or forced by teacher teams&lt;br /&gt;
* maximum date of team membership editing&lt;br /&gt;
* teacher can add themselves to teamas a mentor, then he only will be notified of events in this team&lt;br /&gt;
* &#039;roles&#039; (or workroles to avoid confusion with Moodle Roles) of people in team (either teacher or student defined) - this is a way to explain who in group will do what&lt;br /&gt;
** teacher-defined roles is a list, from which one or several roles can be selected for students&lt;br /&gt;
** if teacher doesn&#039;t want do define specific roles, students can enter text, explaining their role in the group&lt;br /&gt;
&lt;br /&gt;
=== Individual tasks ===&lt;br /&gt;
Individual tasks is quite common situation in the educational process. The module can handle tasks selection and completion.&lt;br /&gt;
&lt;br /&gt;
Individual tasks features:&lt;br /&gt;
* adding/editing/deleting of tasks by the teacher&lt;br /&gt;
* standart fields: name, description, grade factor (1 by default), min/max teamnumber (if teams activated)&lt;br /&gt;
* custom fields, which can be added in any given assignment, of several types: string, text, number, date, menu, file&lt;br /&gt;
* some fields can only be accessible to the student once he is selected a task (and it will be approved by a teacher if necessary)&lt;br /&gt;
* student&#039;s selection (with optional teacher approval), teacher-forced selection or random selection based on a student&#039;s selection of subset of tasks fields (number or menu mainly, i.e. some sort of &#039;complexity&#039; field for example)&lt;br /&gt;
* maximum dates of selection (and approval if necessary)&lt;br /&gt;
* column with task name (link to the task) when grading&lt;br /&gt;
* random filling of some task fields (number or menu mainly) on selection or approval&lt;br /&gt;
** there is some problem of misuse of random generator; they are mainly dealt with fact that student&#039;s can change task and select new without teacher&lt;br /&gt;
&lt;br /&gt;
=== User interface - tabs ===&lt;br /&gt;
Currently assignment have only two main pages: intro/submit (view.php) and grading (submission.php), so it can go away with the link in upper right corner.&lt;br /&gt;
&lt;br /&gt;
New features will require more pages, so it&#039;s better to use tabs for them. Tabs visibility will be based on user&#039;s capabilities.&lt;br /&gt;
&lt;br /&gt;
Urgent reminders will be places on top (or bottom?) of every tab with color highlighting;&lt;br /&gt;
* for students&lt;br /&gt;
** if he is late to select a task/become a member of team&lt;br /&gt;
** if he is late to submit work&lt;br /&gt;
* for teachers&lt;br /&gt;
** if student from his/her group asks to delete him from team (or task change)&lt;br /&gt;
** if there are students without task/team after date of last approval&lt;br /&gt;
&lt;br /&gt;
=== Grades aggregation ===&lt;br /&gt;
Sometimes teacher want to grade student&#039;s submissions by several grading scales and than having the computer to calculate resulting grade. Is this possible using gradebook or should be duplicated in module is under investignation.&lt;br /&gt;
&lt;br /&gt;
=== Grading semi-plugins ===&lt;br /&gt;
Sometimes assignments allow for automatic, or semi-automatic grading. It&#039;s nice to have options to have a plugin system for this.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;maybe&#039;&#039; One user can get several tasks ===&lt;br /&gt;
That needs further discussion. It&#039;s something not very uncommon in real word teaching, but somewhat difficult to cope with &amp;quot;one course module=one grade&amp;quot; thing.&lt;br /&gt;
&lt;br /&gt;
=== Tasks workflow ===&lt;br /&gt;
Let&#039;s see a task workflow in most complicated case (maximum features will be used). States names are somewhat awkward and is subject to change (can anyone propose better names?)&lt;br /&gt;
&lt;br /&gt;
* initially task is &#039;&#039;&#039;free&#039;&#039;&#039; (1)&lt;br /&gt;
* (1) student or teacher can create a team -&amp;gt; &#039;&#039;&#039;creating team&#039;&#039;&#039; (2)&lt;br /&gt;
* (2) student(s) can add themselves to the team, teacher can add students to the team (in last case student notified that he/she was added)&lt;br /&gt;
* (2) students can plead to free them from team/task, teacher can disapprove (if allowed) members or task (students is notified if they are disapproved)&lt;br /&gt;
* (2) after the team will have at least minimum number of participants -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3)&lt;br /&gt;
* (3) all (2) operations still available&lt;br /&gt;
* (3) students can confirm his will to work with team(now that he knows all it&#039;s members), teacher can approve a team - approvment automatically cleared if team membership changes (people that have approves is notified)&lt;br /&gt;
* (3) after the date of last approval, no more changes in teams available for students, (for teachers it&#039;s depends on capabilities), if there is an unapproved team the teacher will be shown (and sent) urgent reminder&lt;br /&gt;
* (3) after the students (if allowed) approved a team and task -&amp;gt; &#039;&#039;&#039;ready&#039;&#039;&#039; (4) (if teacher approvment needed) or &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students and teacher notified)&lt;br /&gt;
* (4) after teacher approval -&amp;gt; &#039;&#039;&#039;working&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (4) in case of teacher disapproval -&amp;gt; &#039;&#039;&#039;have enough people&#039;&#039;&#039; (3) (students notified)&lt;br /&gt;
* (5) any student in the team can submit work with flag &#039;please check our progress&#039; (if allowed), then teacher is notified and able to give comment but not grade (teacher notified, student&#039;s notified of comment)&lt;br /&gt;
* (5) any student in team can make a normal submit, but it (optionally) may need an approval from other members for grading -&amp;gt; &#039;&#039;&#039;await grading&#039;&#039;&#039; (6) (teacher notified)&lt;br /&gt;
* (6) the teacher can only grade a team in &#039;&#039;&#039;await grading&#039;&#039;&#039; status&lt;br /&gt;
* (6) teacher grades, but grade isn&#039;t final -&amp;gt; &#039;&#039;&#039;reworking&#039;&#039;&#039; (5) (students notified)&lt;br /&gt;
* (6) teacher gives final grade -&amp;gt; &#039;&#039;&#039;graded&#039;&#039;&#039; (7) (students notified)&lt;br /&gt;
* (7) person of higher authority will be able to override grade and add something to comment (but maybe not freely edit it, the name of the first grader and regrader will be saved in comment). (students and teacher notified)&lt;br /&gt;
&lt;br /&gt;
Well it&#039;s probably looked worse than is. The actual user will see only part of options, and all forms of approval can be disabled.&lt;br /&gt;
&lt;br /&gt;
=== Files handling ===&lt;br /&gt;
There is some confusion about files handling in current version of assignment module. This is need to be corrected. So there should be a several types of files:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;assignment&#039;&#039;&#039; files - files that is showed and accessible to all, and associated with assignment in general even if individual tasks is used (such as guidelines for it&#039;s completion that apply to all regardless of individual task);&lt;br /&gt;
# &#039;&#039;&#039;task&#039;&#039;&#039; files - some file(s) that teacher want to give students before they start to work on particular task;&lt;br /&gt;
# &#039;&#039;&#039;submission&#039;&#039;&#039; files - files that was submitted by a particular student (team);&lt;br /&gt;
# &#039;&#039;&#039;reply&#039;&#039;&#039; (comment) files - files that was uploaded by a teacher when grading submitted work, usually rewised versions of submitted files (thanks to A.T. Wyatt comment there)&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== New options ===&lt;br /&gt;
Let&#039;s see an assignment creation/editing screen. Assignment module will keep all existing options.&lt;br /&gt;
&lt;br /&gt;
New options that will be added:&lt;br /&gt;
* use individual tasks&lt;br /&gt;
* use teams&lt;br /&gt;
* last date of approval - active if tasks or teams used, time to which all considerations about group memebrship and tasks selections must be done&lt;br /&gt;
* team options (active only if teams selected)&lt;br /&gt;
** min and max count of members of team&lt;br /&gt;
** the grade will be individual or one per team&lt;br /&gt;
** if students must confirm it will to work with team (first student, who create a team, may not be happy with someone who add yourself to it later)&lt;br /&gt;
** if teacher must confirm team membership&lt;br /&gt;
** if all team members must confirm a submission before grading&lt;br /&gt;
* individual task options (active only if tasks is selected)&lt;br /&gt;
** allow using same tasks - can several students do one task or all tasks must be different?&lt;br /&gt;
** allow using same tasks in one group&lt;br /&gt;
** individual date - allow individual due dates to the task&lt;br /&gt;
** individual team members count - if teams used, can particular task override min/max number of students in team&lt;br /&gt;
** teacher must confirm task selection&lt;br /&gt;
** random task assignment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== DB structure ===&lt;br /&gt;
[[Image:db schema.jpg]]&lt;br /&gt;
&lt;br /&gt;
The new db structure have such tables:&lt;br /&gt;
* &#039;&#039;&#039;poasassignment&#039;&#039;&#039; - main table which have new options :&lt;br /&gt;
*# maxmembersontask - maximum count of members which must to do the task&lt;br /&gt;
*# minmembersontask - minimum count of members which must to do the task&lt;br /&gt;
*# mintaskonmember - minimum count of tasks for one member(needs discussion)&lt;br /&gt;
*# maxtaskonmember - maximum count of tasks for one member(needs discussion)&lt;br /&gt;
*# timedistrib - initial time for task distribution&lt;br /&gt;
*# timeconfirmation - the date after that a student not may create/come into new working group&lt;br /&gt;
*# timereception - start time for tasks reception&lt;br /&gt;
*# flags - all binary options&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_tasks&#039;&#039;&#039; - table for task list of instance of activity:&lt;br /&gt;
*# name - the name of task&lt;br /&gt;
*# descripiton - task &amp;quot;body&amp;quot;&lt;br /&gt;
*# deadline - individual date for task reception&lt;br /&gt;
*# factor - factor for grade&lt;br /&gt;
*# maxmembers - maximum workgroup members on task&lt;br /&gt;
*# minmembers - minimum workgroup members on task&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_fields&#039;&#039;&#039; - define list of custom fields:&lt;br /&gt;
*# ftype - type of the field&lt;br /&gt;
*# name - name of the field&lt;br /&gt;
*# showintable - additional column in table of tasks&lt;br /&gt;
*# maxvalue - maximum value for the field(only numbers)&lt;br /&gt;
*# minvalue - minimum value for the field(only numbers)&lt;br /&gt;
*# optional - optional field?&lt;br /&gt;
*# rndparam - if this field used to define filter for random selection of task&lt;br /&gt;
*# rndshow - if this field will get random value on task selection (number or menu fields only)&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_field_consts&#039;&#039;&#039; - define consts for the fields type of list&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_values&#039;&#039;&#039; - values for particular task/workgroup&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroups&#039;&#039;&#039; - table for teams, also submissions stuff go there&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_workgroup_members&#039;&#039;&#039; - members of teams, grade stuff go there:&lt;br /&gt;
*# userid - &lt;br /&gt;
*# grade - this is the grade for submission&lt;br /&gt;
*# submissioncomment - &lt;br /&gt;
*# format,teacher,timemarked,mailed - old fields of assignment_submissions&lt;br /&gt;
*# ownrole - role which student want implement during task execution&lt;br /&gt;
*# finalgrade - final grade(yes/no)?&lt;br /&gt;
*# deletefrom - please kick me from this working group (or task)&lt;br /&gt;
*# deletecomment - explanation why student needs to delete from this working group&lt;br /&gt;
* &#039;&#039;&#039;poasassignment_role&#039;&#039;&#039; - roles for the task:&lt;br /&gt;
*# one task have many roles&lt;br /&gt;
*# one student perform many roles&lt;br /&gt;
  Rethink tables/columns, define how a type plugin can use db, rename workgroups into teams everywhere --[[User:Oleg Sychev|Oleg Sychev]] 11:12, 11 September 2009 (UTC)&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
&lt;br /&gt;
==== Info/submit ====&lt;br /&gt;
This is an initial tab, that will work basically the same as before.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* show additional dates (i.e. dates of last approval and so on)&lt;br /&gt;
* student: show individual task (?tasks?) when the individual tasks is selected&lt;br /&gt;
* student: show task status (see workflow of the task above)&lt;br /&gt;
* student: show team members (when teams used)&lt;br /&gt;
* student: can approve team and submission, select or type his roles&lt;br /&gt;
* teacher: the number of submissions will be shown JFI as there is a tab for grading now (maybe as a link, just as in quiz now - it must be moved to down center area)&lt;br /&gt;
* teacher: the number of submissions will be showed as &amp;lt;need grading&amp;gt;/&amp;lt;all submissions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Custom fields ====&lt;br /&gt;
This tab is for managing custom fields for the tasks. The author can add/edit/delete fields there.&lt;br /&gt;
&lt;br /&gt;
==== Tasks ====&lt;br /&gt;
New tab, accessible when individual task feature activated.&lt;br /&gt;
&lt;br /&gt;
Abilities:&lt;br /&gt;
* teacher: adding, editing, deleting a task (editing and deleting assigned tasks may be prohibited)&lt;br /&gt;
* student: browsing task list, viewing task details&lt;br /&gt;
* student (without teams): selecting a task&lt;br /&gt;
* student (in team mode): see current teams(at least incomplete), create team for a task, apply for team membership&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Grading ====&lt;br /&gt;
This is an evolved grading page (submission.php), for teachers use.&lt;br /&gt;
&lt;br /&gt;
New abilities:&lt;br /&gt;
* the table will reflect a status of task (maybe with icons)&lt;br /&gt;
* individual tasks: the table will additionally reflect task name (as a link to popup with it&#039;s description) and a grade factor&lt;br /&gt;
* teams: the table (and popup for grading too) will have two modes:&lt;br /&gt;
* teams and/or individual tasks: in case any form of teacher approvment is needed, columns for approvment will be showed&lt;br /&gt;
* grade columns/popus will be showed only when grading is allowed (or if person has mod/assignment:manageanything capability)&lt;br /&gt;
*# team grades - each string represent a team&lt;br /&gt;
*# individual grades - each string represents a student, but they are sorted by team and teams is spaced somehow&lt;br /&gt;
* make an option for the teachers to make any grade final, forbidding further re-submissions and/or regrading (a person with mod/assignment:manageanything can still regrade); in teams with individual grading mode re-submission will be forbidden only when all team members receive final grade&lt;br /&gt;
* dropdown to choose whom to display in the table (and in the popup): all, with submissions only, needs grading only&lt;br /&gt;
&lt;br /&gt;
=== Capabilities ===&lt;br /&gt;
Current capabilities&lt;br /&gt;
* mod/poasassignment:view - actually quite strange capability that can completely block you from assignment&lt;br /&gt;
* mod/poasassignment:submit - ability to submit a work&lt;br /&gt;
* mod/poasassignment:grade - ability to grade submissions&lt;br /&gt;
&lt;br /&gt;
New capabilities&lt;br /&gt;
* mod/poasassignment:viewownsubmission (can be backported to 1.9) - sometimes we need to not allowing the student to see own submission (exams cases mostly)&lt;br /&gt;
* mod/poasassignment:manageanything - person with high authority, for whom don&#039;t apply usual restrictions: he can edit/delete tasks on which people worked right now, manage group membership and their tasks after an approval, override final grades and so on&lt;br /&gt;
* mod/poasassignment:managetasks - ability to create, edit and delete tasks&lt;br /&gt;
* mod/poasassignment:managefields - ability to manage custom fields of tasks&lt;br /&gt;
* mod/poasassignment:finalgrades - can make grades final&lt;br /&gt;
* mod/poasassignment:manageteams - ability to create, force students to the team, approve students (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:managetaskselection - ability to manage tasks selection for any student (teacher&#039;s ability)&lt;br /&gt;
* mod/poasassignment:manageownteam - ability to create new team, apply to existing one, confirm memebership of the others in this team (student&#039;s ability, setting it to Deny will create an task where only teachers can manage teams membership)&lt;br /&gt;
* mod/poasassignment:selectowntask - student&#039;s ability to select task (setting to Deny allows for teachers-only tasks selection)&lt;br /&gt;
* mod/poasassignment:seeotherstasks - student&#039;s ability - if he/she is able to see what tasks are selected by other people, or he can see only if it free for selection&lt;br /&gt;
&lt;br /&gt;
=== Events ===&lt;br /&gt;
Events will be added in future releases.&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! Event name&lt;br /&gt;
! Event data&lt;br /&gt;
! Description&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| poasassignment_instance_available&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
| Fired when &#039;available from&#039; time comes (if specified), instantly when creating a course element or when element become visible to the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| poasassignment_instance_unavailable&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
| Fired when time for submissions expired, course module hidden from students or deleted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| poasassignment_task_selected&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when an invidual task is selected for the student (either by himself, by teacher or automatically)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| poasassignment_answer_submitted&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
| Fired when the student adds a &#039;&#039;non-draft&#039;&#039; submission.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| poasassignment_submission_graded&lt;br /&gt;
|&lt;br /&gt;
; cmid : Poasassignment course module ID.&lt;br /&gt;
; userid : Student&#039;s user ID.&lt;br /&gt;
; isfinal : Is this grade final.&lt;br /&gt;
| Fired when the student&#039;s attempt is graded by the instructor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Assignment]]&lt;/div&gt;</summary>
		<author><name>Nixo</name></author>
	</entry>
</feed>