MDL-47397 assignfeedback_editpdf: Copy stamps to other students in team

During a team submission the stamps were attached to the user that
was graded and not to the other users. This could lead to errors when
generating the PDF for each user.
This commit is contained in:
Frederic Massart 2014-10-23 17:37:52 +08:00 committed by Dan Poltawski
parent 47ff1cd93b
commit 20942dd702

View File

@ -338,6 +338,23 @@ class page_editor {
$DB->insert_record('assignfeedback_editpdf_cmnt', $comment);
}
// Delete the existing stamps and copy the source ones.
$fs = get_file_storage();
$fs->delete_area_files($assignment->get_context()->id, 'assignfeedback_editpdf', 'stamps', $grade->id);
if ($files = $fs->get_area_files($assignment->get_context()->id,
'assignfeedback_editpdf',
'stamps',
$sourceusergrade->id,
"filename",
false)) {
foreach ($files as $file) {
$newrecord = new \stdClass();
$newrecord->contextid = $assignment->get_context()->id;
$newrecord->itemid = $grade->id;
$fs->create_file_from_storedfile($newrecord, $file);
}
}
return true;
}