diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 240f4534d5a..e472da5d5f7 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4086,7 +4086,15 @@ class assign { } } - if ($this->grading_disabled($userid, false)) { + // See if this user grade is locked in the gradebook. + $gradinginfo = grade_get_grades($this->get_course()->id, + 'mod', + 'assign', + $this->get_instance()->id, + array($userid)); + if ($gradinginfo && + isset($gradinginfo->items[0]->grades[$userid]) && + $gradinginfo->items[0]->grades[$userid]->locked) { return false; } @@ -5137,7 +5145,7 @@ class assign { /** - * Determine if this users grade is locked or overridden. + * Determine if this users grade can be edited. * * @param int $userid - The student userid * @param bool $checkworkflow - whether to include a check for the workflow state. @@ -5274,10 +5282,11 @@ class assign { if (!$gradingdisabled) { $gradingelement = $mform->addElement('text', 'grade', $name); $mform->addHelpButton('grade', 'gradeoutofhelp', 'assign'); - $mform->setType('grade', PARAM_TEXT); + $mform->setType('grade', PARAM_RAW); } else { $mform->addElement('hidden', 'grade', $name); $mform->hardFreeze('grade'); + $mform->setType('grade', PARAM_RAW); $strgradelocked = get_string('gradelocked', 'assign'); $mform->addElement('static', 'gradedisabled', $name, $strgradelocked); $mform->addHelpButton('gradedisabled', 'gradeoutofhelp', 'assign');