diff --git a/classes/dates.php b/classes/dates.php index 4c3edceb..fd2757bc 100644 --- a/classes/dates.php +++ b/classes/dates.php @@ -43,17 +43,25 @@ class dates extends activity_dates { protected function get_dates(): array { $starttime = $this->cm->customdata['start_time'] ?? null; $duration = $this->cm->customdata['duration'] ?? null; - $now = time(); + $recurring = $this->cm->customdata['recurring'] ?? null; + $recurrencetype = $this->cm->customdata['recurrence_type'] ?? null; + + // For meeting with no fixed time, no time info needed on course page. + if ($recurring && $recurrencetype == \ZOOM_RECURRINGTYPE_NOTIME) { + return []; + } + $dates = []; if ($starttime) { + $now = time(); if ($duration && $starttime + $duration < $now) { // Meeting has ended. $dataid = 'end_date_time'; $labelid = 'activitydate:ended'; $meetimgtimestamp = $starttime + $duration; } else { - // Meeting hasn't started / in progress, or without fixed time (doesn't have an end date or time). + // Meeting hasn't started / in progress. $dataid = 'start_time'; $labelid = $starttime > $now ? 'activitydate:starts' : 'activitydate:started'; $meetimgtimestamp = $starttime; diff --git a/lib.php b/lib.php index 2f4e4671..158db32a 100755 --- a/lib.php +++ b/lib.php @@ -1292,7 +1292,7 @@ function zoom_get_coursemodule_info($coursemodule) { global $DB; $dbparams = ['id' => $coursemodule->instance]; - $fields = 'id, intro, introformat, start_time, duration'; + $fields = 'id, intro, introformat, start_time, recurring, recurrence_type, duration'; if (!$zoom = $DB->get_record('zoom', $dbparams, $fields)) { return false; } @@ -1313,6 +1313,10 @@ function zoom_get_coursemodule_info($coursemodule) { $result->customdata['duration'] = $zoom->duration; } + // Skip the if condition for recurring and recurrence_type, the values of NULL and 0 are needed in other functions. + $result->customdata['recurring'] = $zoom->recurring; + $result->customdata['recurrence_type'] = $zoom->recurrence_type; + return $result; } @@ -1336,7 +1340,7 @@ function zoom_cm_info_dynamic(cm_info $cm) { // For unfinished meetings, override start_time with the next occurrence. // If this is a recurring meeting without fixed time, do not override - it will set start_time = 0. - if (!$finished && $moduleinstance->recurrence_type != 0) { + if (!$finished && $moduleinstance->recurrence_type != ZOOM_RECURRINGTYPE_NOTIME) { $cm->override_customdata('start_time', zoom_get_next_occurrence($moduleinstance)); } }