diff --git a/course/report/progress/lib.php b/course/report/progress/lib.php index ac83729cfdb..1ef6fef6cde 100644 --- a/course/report/progress/lib.php +++ b/course/report/progress/lib.php @@ -33,7 +33,16 @@ */ function progress_report_extend_navigation($navigation, $course, $context) { global $CFG, $OUTPUT; - if (has_capability('coursereport/progress:view', $context)) { + + $showonnavigation = has_capability('coursereport/progress:view', $context); + $group=groups_get_course_group($course,true); // Supposed to verify group + if($group===0 && $course->groupmode==SEPARATEGROUPS) { + $showonnavigation = ($showonnavigation && has_capability('moodle/site:accessallgroups', $context)); + } + + $completion = new completion_info($course); + $showonnavigation = ($showonnavigation && $completion->is_enabled() && count($completion->get_activities())>0); + if ($showonnavigation) { $url = new moodle_url('/course/report/progress/index.php', array('course'=>$course->id)); $navigation->add(get_string('completionreport','completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', '')); }