MDL-11259 stats report: do not show links to logs if not having required capability; backported from HEAD
This commit is contained in:
@@ -142,10 +142,14 @@
|
||||
$a[] = $stat->line2;
|
||||
}
|
||||
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
|
||||
$a[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='.
|
||||
$course->id.'&chooselog=1&showusers=1&showcourses=1&user='
|
||||
.$userid.'&date='.usergetmidnight($stat->timeend-(60*60*24)).'">'
|
||||
.get_string('course').' ' .get_string('logs').'</a> ';
|
||||
if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$a[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='.
|
||||
$course->id.'&chooselog=1&showusers=1&showcourses=1&user='
|
||||
.$userid.'&date='.usergetmidnight($stat->timeend-(60*60*24)).'">'
|
||||
.get_string('course').' ' .get_string('logs').'</a> ';
|
||||
} 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[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='
|
||||
.$course->id.'&chooselog=1&showusers=1&showcourses=1&user='.$userid
|
||||
.'&date='.usergetmidnight($time-(60*60*24)).'">'
|
||||
.get_string('course').' ' .get_string('logs').'</a> ';
|
||||
if (has_capability('coursereport/log:view', get_context_instance(CONTEXT_COURSE, $course->id))) {
|
||||
$row[] = '<a href="'.$CFG->wwwroot.'/course/report/log/index.php?id='
|
||||
.$course->id.'&chooselog=1&showusers=1&showcourses=1&user='.$userid
|
||||
.'&date='.usergetmidnight($time-(60*60*24)).'">'
|
||||
.get_string('course').' ' .get_string('logs').'</a> ';
|
||||
} else {
|
||||
$row[] = '';
|
||||
}
|
||||
}
|
||||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user