This commit is contained in:
Jun Pataleta 2022-07-11 20:35:18 +08:00
commit 0cb0516211
5 changed files with 11 additions and 4 deletions

View File

@ -2921,7 +2921,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;
@ -2935,6 +2935,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;

View File

@ -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);

View File

@ -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 the "jump" select box should contain "Grader report"
And the "jump" select box should contain "Outcomes report"
And the "Select all or one user" select box should contain "All users (1)"
And I log out
And I log in as "student1"

View File

@ -101,7 +101,6 @@ class general_action_bar_test extends advanced_testcase {
'View' => [
'Grader report',
'Grade history',
'Outcomes report',
'Overview report',
'Single view',
'User report',
@ -152,7 +151,6 @@ class general_action_bar_test extends advanced_testcase {
'View' => [
'Grader report',
'Grade history',
'Outcomes report',
'Overview report',
'Single view',
'User report',

View File

@ -600,6 +600,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';