From aea34768be91e4d35edb0083131cce952cb30009 Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 29 Jul 2013 09:27:41 +0800 Subject: [PATCH] MDL-34989 assign: Do not add a param to grading_disabled - cannot be backported. Conflicts: mod/assign/locallib.php --- mod/assign/locallib.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 26ca0ed4be7..dba9f6e877c 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3846,7 +3846,15 @@ class assign { } } - if ($this->grading_disabled($userid)) { + // 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; } @@ -4842,7 +4850,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 * @return bool $gradingdisabled @@ -4972,10 +4980,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');