Permalink
Browse files

MDL-39760: mod_assign: Add few more callback methods.

Adds lock, unlock and release_to_draft. All of them accept single parameter -
an assign_submission record.
  • Loading branch information...
1 parent f192883 commit 450fde4e16b67e80dbf8d5e79e93bfd0eddcb0ee @kabalin kabalin committed May 20, 2013
Showing with 52 additions and 0 deletions.
  1. +24 −0 mod/assign/locallib.php
  2. +28 −0 mod/assign/submissionplugin.php
View
@@ -5542,6 +5542,13 @@ protected function process_revert_to_draft($userid = 0) {
$submission->status = ASSIGN_SUBMISSION_STATUS_DRAFT;
$this->update_submission($submission, $userid, true, $this->get_instance()->teamsubmission);
+ // Give each submission plugin a chance to process the reverting to draft.
+ $plugins = $this->get_submission_plugins();
+ foreach ($plugins as $plugin) {
+ if ($plugin->is_enabled() && $plugin->is_visible()) {
+ $plugin->revert_to_draft($submission);
+ }
+ }
// Update the modified time on the grade (grader modified).
$grade = $this->get_user_grade($userid, true);
$grade->grader = $USER->id;
@@ -5578,6 +5585,15 @@ protected function process_lock($userid = 0) {
$userid = required_param('userid', PARAM_INT);
}
+ // Give each submission plugin a chance to process the locking.
+ $plugins = $this->get_submission_plugins();
+ $submission = $this->get_user_submission($userid, false);
+ foreach ($plugins as $plugin) {
+ if ($plugin->is_enabled() && $plugin->is_visible()) {
+ $plugin->lock($submission);
+ }
+ }
+
$flags = $this->get_user_flags($userid, true);
$flags->locked = 1;
$this->update_user_flags($flags);
@@ -5695,6 +5711,14 @@ protected function process_unlock($userid = 0) {
if (!$userid) {
$userid = required_param('userid', PARAM_INT);
}
+ // Give each submission plugin a chance to process the unlocking.
+ $plugins = $this->get_submission_plugins();
+ $submission = $this->get_user_submission($userid, false);
+ foreach ($plugins as $plugin) {
+ if ($plugin->is_enabled() && $plugin->is_visible()) {
+ $plugin->unlock($submission);
+ }
+ }
$flags = $this->get_user_flags($userid, true);
$flags->locked = 0;
@@ -84,4 +84,32 @@ public function submit_for_grading($submission) {
public function copy_submission( stdClass $oldsubmission, stdClass $submission) {
return true;
}
+
+ /*
+ * Carry out any extra processing required when the work is locked.
+ *
+ * @param stdClass $submission - assign_submission data
+ * @return void
+ */
+ public function lock(stdClass $submission) {
+ }
+
+ /**
+ * Carry out any extra processing required when the work is unlocked.
+ *
+ * @param stdClass $submission - assign_submission data
+ * @return void
+ */
+ public function unlock(stdClass $submission) {
+ }
+
+ /**
+ * Carry out any extra processing required when the work reverted to draft.
+ *
+ * @param stdClass $submission - assign_submission data
+ * @return void
+ */
+ public function revert_to_draft(stdClass $submission) {
+ }
+
}

0 comments on commit 450fde4

Please sign in to comment.