MDL-66213 report_loglive: Do not look up course 0

This commit is contained in:
Andrew Nicols 2020-01-14 13:53:39 +08:00 committed by Sara Arjona
parent f6fe70d075
commit 16d4515411

View File

@ -174,6 +174,10 @@ class report_loglive_renderable implements renderable {
$filter = new \stdClass();
if (!empty($this->course)) {
$filter->courseid = $this->course->id;
$context = context_course::instance($filter->courseid);
if (!has_capability('moodle/site:viewanonymousevents', $context)) {
$filter->anonymous = 0;
}
} else {
$filter->courseid = 0;
}
@ -181,11 +185,6 @@ class report_loglive_renderable implements renderable {
$filter->date = $this->date;
$filter->orderby = $this->order;
$context = context_course::instance($filter->courseid);
if (!has_capability('moodle/site:viewanonymousevents', $context)) {
$filter->anonymous = 0;
}
return $filter;
}