diff --git a/grade/lib.php b/grade/lib.php index b03820624f9..cb551e80d4a 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -3050,7 +3050,7 @@ abstract class grade_helper { * @return array */ public static function get_plugins_reports($courseid) { - global $SITE; + global $SITE, $CFG; if (self::$gradereports !== null) { return self::$gradereports; @@ -3064,6 +3064,11 @@ abstract class grade_helper { continue; } + // Remove outcomes report if outcomes not enabled. + if ($plugin === 'outcomes' && empty($CFG->enableoutcomes)) { + continue; + } + // Remove ones we can't see if (!has_capability('gradereport/'.$plugin.':view', $context)) { continue; diff --git a/grade/report/outcomes/index.php b/grade/report/outcomes/index.php index 605a0233d6e..b4e87ac673b 100644 --- a/grade/report/outcomes/index.php +++ b/grade/report/outcomes/index.php @@ -39,6 +39,10 @@ $context = context_course::instance($course->id); require_capability('gradereport/outcomes:view', $context); +if (empty($CFG->enableoutcomes)) { + redirect(course_get_url($course), get_string('outcomesdisabled', 'core_grades')); +} + // First make sure we have proper final grades. grade_regrade_final_grades_if_required($course); diff --git a/grade/tests/behat/grade_view.feature b/grade/tests/behat/grade_view.feature index 3c24b8f9afe..1af115e917b 100644 --- a/grade/tests/behat/grade_view.feature +++ b/grade/tests/behat/grade_view.feature @@ -71,7 +71,6 @@ Feature: We can enter in grades and view reports from the gradebook Scenario: Grade a grade item and ensure the results display correctly in the gradebook When I navigate to "View > User report" in the course gradebook And "Grader report" "link" should exist - And "Outcomes report" "link" should exist And the "Select all or one user" select box should contain "All users (1)" And I log out And I log in as "student1" diff --git a/lang/en/grades.php b/lang/en/grades.php index 17946e658fe..cbf76d34af0 100644 --- a/lang/en/grades.php +++ b/lang/en/grades.php @@ -599,6 +599,7 @@ $string['outcomescoursecustom'] = 'Custom used (no remove)'; $string['outcomescoursenotused'] = 'Standard not used'; $string['outcomescourseused'] = 'Standard used (no remove)'; $string['outcomescustom'] = 'Custom outcomes'; +$string['outcomesdisabled'] = 'Outcomes are not enabled'; $string['outcomeshortname'] = 'Short name'; $string['outcomesstandard'] = 'Standard outcomes'; $string['outcomesstandardavailable'] = 'Available standard outcomes';