mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-53601 mod_assign: Feedback files are sent to all group members.
This commit is contained in:
parent
3219a4535f
commit
181c20bc52
@ -188,53 +188,61 @@ class assign_feedback_editpdf extends assign_feedback_plugin {
|
||||
* @return boolean True if the pdf has been modified, else false.
|
||||
*/
|
||||
public function is_feedback_modified(stdClass $grade, stdClass $data) {
|
||||
global $USER;
|
||||
$pagenumbercount = document_services::page_number_for_attempt($this->assignment, $grade->userid, $grade->attemptnumber);
|
||||
for ($i = 0; $i < $pagenumbercount; $i++) {
|
||||
// Select all annotations.
|
||||
$draftannotations = page_editor::get_annotations($grade->id, $i, true);
|
||||
$nondraftannotations = page_editor::get_annotations($grade->id, $i, false);
|
||||
// Check to see if the count is the same.
|
||||
if (count($draftannotations) != count($nondraftannotations)) {
|
||||
// The count is different so we have a modification.
|
||||
return true;
|
||||
} else {
|
||||
$matches = 0;
|
||||
// Have a closer look and see if the draft files match all the non draft files.
|
||||
foreach ($nondraftannotations as $ndannotation) {
|
||||
foreach ($draftannotations as $dannotation) {
|
||||
foreach ($ndannotation as $key => $value) {
|
||||
if ($key != 'id' && $value != $dannotation->{$key}) {
|
||||
continue 2;
|
||||
// We only need to know if the source user's PDF has changed. If so then all
|
||||
// following users will have the same status. If it's only an individual annotation
|
||||
// then only one user will come through this method.
|
||||
// Source user id is only added to the form if there was a pdf.
|
||||
if (!empty($data->editpdf_source_userid)) {
|
||||
$sourceuserid = $data->editpdf_source_userid;
|
||||
// Retrieve the grade information for the source user.
|
||||
$sourcegrade = $this->assignment->get_user_grade($sourceuserid, true, $grade->attemptnumber);
|
||||
$pagenumbercount = document_services::page_number_for_attempt($this->assignment, $sourceuserid, $sourcegrade->attemptnumber);
|
||||
for ($i = 0; $i < $pagenumbercount; $i++) {
|
||||
// Select all annotations.
|
||||
$draftannotations = page_editor::get_annotations($sourcegrade->id, $i, true);
|
||||
$nondraftannotations = page_editor::get_annotations($grade->id, $i, false);
|
||||
// Check to see if the count is the same.
|
||||
if (count($draftannotations) != count($nondraftannotations)) {
|
||||
// The count is different so we have a modification.
|
||||
return true;
|
||||
} else {
|
||||
$matches = 0;
|
||||
// Have a closer look and see if the draft files match all the non draft files.
|
||||
foreach ($nondraftannotations as $ndannotation) {
|
||||
foreach ($draftannotations as $dannotation) {
|
||||
foreach ($ndannotation as $key => $value) {
|
||||
if ($key != 'id' && $value != $dannotation->{$key}) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$matches++;
|
||||
}
|
||||
$matches++;
|
||||
}
|
||||
if ($matches !== count($nondraftannotations)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if ($matches !== count($nondraftannotations)) {
|
||||
// Select all comments.
|
||||
$draftcomments = page_editor::get_comments($sourcegrade->id, $i, true);
|
||||
$nondraftcomments = page_editor::get_comments($grade->id, $i, false);
|
||||
if (count($draftcomments) != count($nondraftcomments)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Select all comments.
|
||||
$draftcomments = page_editor::get_comments($grade->id, $i, true);
|
||||
$nondraftcomments = page_editor::get_comments($grade->id, $i, false);
|
||||
if (count($draftcomments) != count($nondraftcomments)) {
|
||||
return true;
|
||||
} else {
|
||||
// Go for a closer inspection.
|
||||
$matches = 0;
|
||||
foreach ($nondraftcomments as $ndcomment) {
|
||||
foreach ($draftcomments as $dcomment) {
|
||||
foreach ($ndcomment as $key => $value) {
|
||||
if ($key != 'id' && $value != $dcomment->{$key}) {
|
||||
continue 2;
|
||||
} else {
|
||||
// Go for a closer inspection.
|
||||
$matches = 0;
|
||||
foreach ($nondraftcomments as $ndcomment) {
|
||||
foreach ($draftcomments as $dcomment) {
|
||||
foreach ($ndcomment as $key => $value) {
|
||||
if ($key != 'id' && $value != $dcomment->{$key}) {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
$matches++;
|
||||
}
|
||||
$matches++;
|
||||
}
|
||||
}
|
||||
if ($matches !== count($nondraftcomments)) {
|
||||
return true;
|
||||
if ($matches !== count($nondraftcomments)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class assign_feedback_file extends assign_feedback_plugin {
|
||||
$filekey = null;
|
||||
$draftareainfo = null;
|
||||
foreach ($data as $key => $value) {
|
||||
if (strpos($key, 'files_') === 0) {
|
||||
if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
|
||||
$filekey = $key;
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,17 @@ class assign_feedback_offline extends assign_feedback_plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This plugin does not save through the normal interface so this returns false.
|
||||
*
|
||||
* @param stdClass $grade The grade.
|
||||
* @param stdClass $data Form data from the feedback form.
|
||||
* @return boolean - False
|
||||
*/
|
||||
public function is_feedback_modified(stdClass $grade, stdClass $data) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loop through uploaded grades and update the grades for this assignment
|
||||
*
|
||||
|
@ -120,8 +120,8 @@ abstract class assign_feedback_plugin extends assign_plugin {
|
||||
* @return boolean - True if the form element has been modified.
|
||||
*/
|
||||
public function is_feedback_modified(stdClass $grade, stdClass $data) {
|
||||
debugging('This plugin has not overwritten the is_feedback_modified() method. Please add this method to your plugin',
|
||||
DEBUG_DEVELOPER);
|
||||
debugging('This plugin (' . $this->get_name() . ') has not overwritten the is_feedback_modified() method.
|
||||
Please add this method to your plugin', DEBUG_DEVELOPER);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user