From a1990f18ef525e2189d857c8a17584201a41be17 Mon Sep 17 00:00:00 2001 From: skodak Date: Sun, 30 Nov 2008 21:34:29 +0000 Subject: [PATCH] MDL-11259 stats report: do not show links to logs if not having required capability; backported from HEAD --- course/report/stats/report.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/course/report/stats/report.php b/course/report/stats/report.php index 00cffdf357a..40a8014431b 100644 --- a/course/report/stats/report.php +++ b/course/report/stats/report.php @@ -142,10 +142,14 @@ $a[] = $stat->line2; } if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) { - $a[] = '' - .get_string('course').' ' .get_string('logs').' '; + if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_COURSE, $course->id))) { + $a[] = '' + .get_string('course').' ' .get_string('logs').' '; + } else { + $a[] = ''; + } } $table->data[] = $a; } @@ -195,10 +199,14 @@ krsort($rolesdata); $row = array_merge(array($times[$time]),$rolesdata); if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) { - $row[] = '' - .get_string('course').' ' .get_string('logs').' '; + if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_COURSE, $course->id))) { + $row[] = '' + .get_string('course').' ' .get_string('logs').' '; + } else { + $row[] = ''; + } } $table->data[] = $row; }