Skip to content

Commit b170be8

Browse files
authored
Merge branch 'main' into feature/moodle-playground-preview
2 parents 51bb8b9 + 0c91cab commit b170be8

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

lib.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,3 +1365,34 @@ function zoom_cm_info_dynamic(cm_info $cm) {
13651365
function zoom_apply_filter_on_meeting_name($name, $options) {
13661366
return substr(format_string($name, true, $options + ['escape' => false]), 0, 200);
13671367
}
1368+
1369+
/**
1370+
* Checks whether a given calendar event should be visible to the user.
1371+
*
1372+
* @param calendar_event $event The calendar event object.
1373+
* @param ?int $userid User ID.
1374+
* @return bool True if visible, false otherwise.
1375+
*/
1376+
function mod_zoom_core_calendar_is_event_visible(calendar_event $event, $userid = null) {
1377+
global $USER;
1378+
1379+
// Only check our events.
1380+
if (empty($event->instance) || $event->modulename !== 'zoom') {
1381+
return false;
1382+
}
1383+
1384+
try {
1385+
$modinfo = get_fast_modinfo($event->courseid, $userid ?? $USER->id);
1386+
$cm = $modinfo->instances['zoom'][$event->instance] ?? null;
1387+
1388+
if (empty($cm)) {
1389+
return false;
1390+
}
1391+
1392+
// Return the user's visibility for the module.
1393+
return $cm->uservisible;
1394+
} catch (\moodle_exception $e) {
1395+
// Hide the event if the activity module does not exist.
1396+
return false;
1397+
}
1398+
}

0 commit comments

Comments
 (0)