navigation MDL-14632 Improved display conditions for progress report

This commit is contained in:
Sam Hemelryk 2010-04-27 03:18:58 +00:00
parent 83f1fa9c4d
commit b6a56aeae0

View File

@ -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', ''));
}