From b2e76ba7d8420cdf0b790680690d647c6485694e Mon Sep 17 00:00:00 2001 From: Henning Bostelmann Date: Tue, 25 Apr 2017 11:57:19 +0100 Subject: [PATCH] MDL-57957 mod_assign: show feedback file in absence of grade item --- mod/assign/locallib.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index f32def9a70c..f992d36c26b 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -4862,17 +4862,19 @@ class assign { } $cangrade = has_capability('mod/assign:grade', $this->get_context()); + $hasgrade = $this->get_instance()->grade != GRADE_TYPE_NONE && + !is_null($gradebookgrade) && !is_null($gradebookgrade->grade); + $gradevisible = $cangrade || $this->get_instance()->grade == GRADE_TYPE_NONE || + (!is_null($gradebookgrade) && !$gradebookgrade->hidden); // If there is a visible grade, show the summary. - if (!is_null($gradebookgrade) && (!is_null($gradebookgrade->grade) || !$emptyplugins) - && ($cangrade || !$gradebookgrade->hidden)) { + if (($hasgrade || !$emptyplugins) && $gradevisible) { $gradefordisplay = null; $gradeddate = null; $grader = null; $gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions'); - // Only show the grade if it is not hidden in gradebook. - if (!is_null($gradebookgrade->grade) && ($cangrade || !$gradebookgrade->hidden)) { + if ($hasgrade) { if ($controller = $gradingmanager->get_active_controller()) { $menu = make_grades_menu($this->get_instance()->grade); $controller->set_grade_range($menu, $this->get_instance()->grade > 0);