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.
This commit is contained in:
@@ -5542,6 +5542,13 @@ class assign {
|
||||
$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 @@ class assign {
|
||||
$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 @@ class assign {
|
||||
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 @@ abstract class assign_submission_plugin extends assign_plugin {
|
||||
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) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user