diff --git a/grade/grading/form/lib.php b/grade/grading/form/lib.php index 1bf9582e0e9..3508cfa1301 100644 --- a/grade/grading/form/lib.php +++ b/grade/grading/form/lib.php @@ -135,7 +135,7 @@ abstract class gradingform_controller { if ($this->is_form_available()) { return null; } - return get_string('gradingformunavailable', 'grades'); + return get_string('gradingformunavailable', 'grading'); } /** diff --git a/lang/en/grades.php b/lang/en/grades.php index 912ad04f776..944b9da01cf 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -289,7 +289,6 @@ $string['gradetype_help'] = 'There are 4 grade types: Only value and scale grade types may be aggregated. The grade type for an activity-based grade item is set on the activity settings page.'; $string['gradeview'] = 'View grade'; $string['gradeweighthelp'] = 'Grade weight help'; -$string['gradingformunavailable'] = 'Please note: this form is not available for grading at the moment. Simple grading method will be used until form has a valid status.'; $string['groupavg'] = 'Group average'; $string['hidden'] = 'Hidden'; $string['hidden_help'] = 'If ticked, grades are hidden from students. A hidden until date may be set if desired, to release grades after grading is completed.'; diff --git a/lang/en/grading.php b/lang/en/grading.php index e96266e2f7f..c84946bf892 100644 --- a/lang/en/grading.php +++ b/lang/en/grading.php @@ -32,6 +32,7 @@ $string['changeactivemethod'] = 'Change active grading method to'; $string['clicktoclose'] = 'click to close'; $string['exc_gradingformelement'] = 'Unable to instantiate grading form element'; $string['formnotavailable'] = 'Advanced grading method was selected to use but the grading form is not available yet. You may need to define it first via a link in the Settings block.'; +$string['gradingformunavailable'] = 'Please note: the advanced grading form is not ready at the moment. Simple grading method will be used until the form has a valid status.'; $string['gradingmanagement'] = 'Advanced grading'; $string['gradingmanagementtitle'] = 'Advanced grading: {$a->component} ({$a->area})'; $string['gradingmethod'] = 'Grading method'; diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index b81e64111da..7288f4bd4c0 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1068,12 +1068,19 @@ class assignment_base { } elseif ($assignment->assignmenttype == 'uploadsingle') { $mformdata->fileui_options = array('subdirs'=>0, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL); } - if ($controller = get_grading_manager($this->context, 'mod_assignment', 'submission')->get_active_controller()) { - $itemid = null; - if (!empty($submission->id)) { - $itemid = $submission->id; + $advancedgradingwarning = false; + $gradingmanager = get_grading_manager($this->context, 'mod_assignment', 'submission'); + if ($gradingmethod = $gradingmanager->get_active_method()) { + $controller = $gradingmanager->get_controller($gradingmethod); + if ($controller->is_form_available()) { + $itemid = null; + if (!empty($submission->id)) { + $itemid = $submission->id; + } + $mformdata->advancedgradinginstance = $controller->create_instance($USER->id, $itemid); + } else { + $advancedgradingwarning = $controller->form_unavailable_notification(); } - $mformdata->advancedgradinginstance = $controller->create_instance($USER->id, $itemid); } $submitform = new mod_assignment_grading_form( null, $mformdata ); @@ -1102,6 +1109,9 @@ class assignment_base { echo $OUTPUT->heading(get_string('feedback', 'assignment').': '.fullname($user, true)); // display mform here... + if ($advancedgradingwarning) { + echo $OUTPUT->notification($advancedgradingwarning, 'error'); + } $submitform->display(); $customfeedback = $this->custom_feedbackform($submission, true);