If a user does not have the 'moodle/calendar:manageentries' capability then an E_WARNING
can be generated by the core_calendar_external::get_calendar_events() method, that an
expected array is null
This patch creates an array that is missing when a user does not have the capability.
// Let us findout courses that we can return events from.
if (!$hassystemcap) {
+ $courses = enrol_get_my_courses('id');
+ $courses = array_keys($courses);
foreach ($params['events']['courseids'] as $id) {
try {
$context = context_course::instance($id);
'warningcode' => 'nopermissions',
'message' => 'No access rights in course context '.$e->getMessage().$e->getTraceAsString()
);
- continue;
}
}
} else {