|
@@ -52,11 +52,15 @@ if (!$submission) {
|
|
|
|
|
|
// Get feedbacks associated with it
|
|
// Get feedbacks associated with it
|
|
$feedbacks = $DB->get_records('gradeimporter_feedback', array('submissionid' => $subid));
|
|
$feedbacks = $DB->get_records('gradeimporter_feedback', array('submissionid' => $subid));
|
|
|
|
+
|
|
|
|
+// Delete its feedbacks
|
|
foreach ($feedbacks as $feedback) {
|
|
foreach ($feedbacks as $feedback) {
|
|
- // For each feedback, deletes its files and then delete it
|
|
|
|
- delete_feedback_files($feedback);
|
|
|
|
- $DB->delete_records('gradeimporter_feedback', array('id' => $feedback->id));
|
|
|
|
|
|
+ // Deletes feedback from gradeimporter_feedback table and removes its associated files
|
|
|
|
+ delete_feedback($feedback);
|
|
|
|
+ // Recalculates gradeimporter instance grade without this feedback
|
|
|
|
+ gradeimporter_update_grades($submission, $feedback->studentid);
|
|
}
|
|
}
|
|
|
|
+
|
|
// Delete submission
|
|
// Delete submission
|
|
$DB->delete_records('gradeimporter_submission', array('id' => $submission->id));
|
|
$DB->delete_records('gradeimporter_submission', array('id' => $submission->id));
|
|
|
|
|
|
@@ -65,12 +69,12 @@ $PAGE->set_title($submission->name);
|
|
$PAGE->set_heading($course->fullname);
|
|
$PAGE->set_heading($course->fullname);
|
|
$PAGE->set_context($context);
|
|
$PAGE->set_context($context);
|
|
|
|
|
|
-$viewlink = new moodle_url('CFG->dirroot/mod/gradeimporter/view.php', array('id' => $cmid, 'edit' => 1));
|
|
|
|
|
|
+$viewlink = new moodle_url("/mod/gradeimporter/view.php", array('id' => $cmid, 'edit' => 1));
|
|
|
|
|
|
-echo $OUTPUT->header("refresh:5;url=../../view.php?id=$cmid&edit=1");
|
|
|
|
|
|
+echo $OUTPUT->header("refresh:5;url=$viewlink");
|
|
|
|
|
|
echo "<p>".get_string('deletesubmissiondata', 'gradeimporter', $submission->name)."</p>";
|
|
echo "<p>".get_string('deletesubmissiondata', 'gradeimporter', $submission->name)."</p>";
|
|
echo "<p>".get_string('deletefeedbacksdata', 'gradeimporter', count($feedbacks))."</p>";
|
|
echo "<p>".get_string('deletefeedbacksdata', 'gradeimporter', count($feedbacks))."</p>";
|
|
-echo "<p>".get_string('redirect5s', 'gradeimporter')."<a href=$viewlink>".get_string('here', 'gradeimporter')."</p>";
|
|
|
|
|
|
+echo "<p>".get_string('redirect5s', 'gradeimporter')."<a href=\"$viewlink\">".get_string('here', 'gradeimporter')."</p>";
|
|
|
|
|
|
echo $OUTPUT->footer();
|
|
echo $OUTPUT->footer();
|