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:
Mark Nelson
2017-04-03 11:37:09 +08:00
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