Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-24328 completion Check criteria are set before showing links to r…

…eport
  • Loading branch information...
commit c8ea6c60ab388a8df363102ed079927616fdc32f 1 parent 503e7bf
@srynot4sale srynot4sale authored
View
9 course/report/completion/lib.php
@@ -37,9 +37,10 @@ function completion_report_extend_navigation($navigation, $course, $context) {
global $CFG, $OUTPUT;
if (has_capability('coursereport/completion:view', $context)) {
- require_once($CFG->libdir.'/completionlib.php');
-
- $url = new moodle_url('/course/report/completion/index.php', array('course'=>$course->id));
- $navigation->add(get_string('pluginname','coursereport_completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
+ $completion = new completion_info($course);
+ if ($completion->is_enabled() && $completion->has_criteria()) {
+ $url = new moodle_url('/course/report/completion/index.php', array('course'=>$course->id));
+ $navigation->add(get_string('pluginname','coursereport_completion'), $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));
+ }
}
}
View
4 course/report/completion/mod.php
@@ -6,9 +6,9 @@
if (has_capability('coursereport/completion:view', $context)) {
$completion = new completion_info($course);
- if ($completion->is_enabled()) {
+ if ($completion->is_enabled() && $completion->has_criteria()) {
echo '<p>';
- echo '<a href="'.$CFG->wwwroot.'/course/report/completion/index.php?course='.$course->id.'">'.get_string('coursecompletionreport','completion').'</a>';
+ echo '<a href="'.$CFG->wwwroot.'/course/report/completion/index.php?coursetest='.$course->id.'">'.get_string('coursecompletionreport','completion').'</a>';
echo '</p>';
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.