Skip to content

Commit

Permalink
Merge pull request #529 from ncstate-delta/fix/no-fixed-time-meeting-…
Browse files Browse the repository at this point in the history
…remove-time-info-display

remove date and time display on course page for no fixed time meetings
  • Loading branch information
jrchamp authored Oct 12, 2023
2 parents 910bcd8 + 07fc965 commit 3d02a35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 10 additions & 2 deletions classes/dates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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));
}
}
Expand Down

0 comments on commit 3d02a35

Please sign in to comment.