MDL-57878 core_calendar: extended bailout callback
Do not display completion related events if completion is disabled. Part of MDL-55611 epic.
This commit is contained in:
committed by
Damyon Wiese
parent
7925aab94f
commit
74588eecc4
@@ -125,7 +125,21 @@ class core_container {
|
||||
|
||||
$cm = $instances[$dbrow->modulename][$dbrow->instance];
|
||||
|
||||
return !(bool)$cm->uservisible;
|
||||
if (!$cm->uservisible) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ok, now check if we are looking at a completion event.
|
||||
if ($dbrow->eventtype === \core_completion\api::COMPLETION_EVENT_TYPE_DATE_COMPLETION_EXPECTED) {
|
||||
// Need to have completion enabled before displaying these events.
|
||||
$course = new \stdClass();
|
||||
$course->id = $dbrow->courseid;
|
||||
$completion = new \completion_info($course);
|
||||
|
||||
return (bool) !$completion->is_enabled($cm);
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
self::$coursecache,
|
||||
self::$modulecache
|
||||
|
||||
Reference in New Issue
Block a user