Skip to content

Commit

Permalink
Core SU changes: Check CM exists before using
Browse files Browse the repository at this point in the history
  • Loading branch information
sharpchi committed Sep 2, 2024
1 parent 042b9d2 commit 6c41375
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions course/moodleform_mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,12 @@ public function standard_grading_coursemodule_elements() {
// Site admins can deal with changing 18 (Grademark) to 100.
if (method_exists('\local_solsits\helper', 'is_summative_assignment')) {
global $PAGE;
$issummative = \local_solsits\helper::is_summative_assignment($PAGE->cm->id);
$gradetype = $gradeoptions['currentgradetype'] ?? null;
if ($issummative && $gradetype == GRADE_TYPE_VALUE && !is_siteadmin()) {
$mform->disabledIf('grade[modgrade_point]', 'grade[modgrade_type]', 'eq', 'point');
if (!is_null($PAGE->cm)) {
$issummative = \local_solsits\helper::is_summative_assignment($PAGE->cm->id);
$gradetype = $gradeoptions['currentgradetype'] ?? null;
if ($issummative && $gradetype == GRADE_TYPE_VALUE && !is_siteadmin()) {
$mform->disabledIf('grade[modgrade_point]', 'grade[modgrade_type]', 'eq', 'point');
}
}
}
// SU_AMEND END.
Expand Down

0 comments on commit 6c41375

Please sign in to comment.