mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-36804 mod_assign - allow students to resubmit work and display a submission + grading history
This is based on work by Davo Smith with input from Fernando Oliveira (Thanks guys!).
This commit is contained in:
parent
bf6c1d0997
commit
df211804f1
26 changed files with 1839 additions and 262 deletions
|
@ -130,6 +130,30 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
|
|||
$this->set_mapping('submission', $oldid, $newitemid, false, null, $this->task->get_old_contextid());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a user_flags restore
|
||||
* @param object $data The data in object form
|
||||
* @return void
|
||||
*/
|
||||
protected function process_assign_userflags($data) {
|
||||
global $DB;
|
||||
|
||||
$data = (object)$data;
|
||||
$oldid = $data->id;
|
||||
|
||||
$data->assignment = $this->get_new_parentid('assign');
|
||||
|
||||
$data->userid = $this->get_mappingid('user', $data->userid);
|
||||
if (!empty($data->extensionduedate)) {
|
||||
$data->extensionduedate = $this->apply_date_offset($data->extensionduedate);
|
||||
} else {
|
||||
$data->extensionduedate = 0;
|
||||
}
|
||||
// Flags mailed and locked need no translation on restore.
|
||||
|
||||
$newitemid = $DB->insert_record('assign_user_flags', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a grade restore
|
||||
* @param object $data The data in object form
|
||||
|
@ -147,11 +171,20 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
|
|||
$data->timecreated = $this->apply_date_offset($data->timecreated);
|
||||
$data->userid = $this->get_mappingid('user', $data->userid);
|
||||
$data->grader = $this->get_mappingid('user', $data->grader);
|
||||
|
||||
// Handle flags restore to a different table.
|
||||
$flags = new stdClass();
|
||||
$flags->assignment = $this->get_new_parentid('assign');
|
||||
if (!empty($data->extensionduedate)) {
|
||||
$data->extensionduedate = $this->apply_date_offset($data->extensionduedate);
|
||||
} else {
|
||||
$data->extensionduedate = 0;
|
||||
$flags->extensionduedate = $this->apply_date_offset($data->extensionduedate);
|
||||
}
|
||||
if (!empty($data->mailed)) {
|
||||
$flags->mailed = $data->mailed;
|
||||
}
|
||||
if (!empty($data->locked)) {
|
||||
$flags->locked = $data->locked;
|
||||
}
|
||||
$DB->insert_record('assign_user_flags', $flags);
|
||||
|
||||
$newitemid = $DB->insert_record('assign_grades', $data);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue