MDL-27520 core_grades: accept feedback files via grade_update()

This commit is contained in:
Mark Nelson 2018-09-14 11:37:10 +08:00
parent 3cced42eb3
commit 5d7a9ea6f9
5 changed files with 158 additions and 4 deletions

View file

@ -1864,9 +1864,19 @@ class grade_item extends grade_object {
* @param int $dategraded A timestamp of when the student's work was graded
* @param int $datesubmitted A timestamp of when the student's work was submitted
* @param grade_grade $grade A grade object, useful for bulk upgrades
* @param array $feedbackfiles An array identifying the location of files we want to copy to the gradebook feedback area.
* Example -
* [
* 'contextid' => 1,
* 'component' => 'mod_xyz',
* 'filearea' => 'mod_xyz_feedback',
* 'itemid' => 2
* ];
* @return bool success
*/
public function update_raw_grade($userid, $rawgrade=false, $source=NULL, $feedback=false, $feedbackformat=FORMAT_MOODLE, $usermodified=null, $dategraded=null, $datesubmitted=null, $grade=null) {
public function update_raw_grade($userid, $rawgrade = false, $source = null, $feedback = false,
$feedbackformat = FORMAT_MOODLE, $usermodified = null, $dategraded = null, $datesubmitted=null,
$grade = null, array $feedbackfiles = []) {
global $USER;
$result = true;
@ -1929,6 +1939,7 @@ class grade_item extends grade_object {
if ($feedback !== false and !$grade->is_overridden()) {
$grade->feedback = $feedback;
$grade->feedbackformat = $feedbackformat;
$grade->feedbackfiles = $feedbackfiles;
}
// update final grade if possible