diff options
| author | Ron Lucke <lucke@elan-ev.de> | 2025-12-12 12:00:21 +0100 |
|---|---|---|
| committer | Ron Lucke <lucke@elan-ev.de> | 2025-12-12 12:00:21 +0100 |
| commit | aaa6ee164a42ac476b3f6db650fb40afcaa04648 (patch) | |
| tree | 410460e8a3dde9e8e6a223235dd576f7b5c6f12c /lib/models/Courseware/StructuralElement.php | |
| parent | e75bfaf30a1643da6522f42d0312810182a5918a (diff) | |
Zeitgesteuerte Inhalte werden nicht sichtbar
Closes #6113
Merge request studip/studip!4646
Diffstat (limited to 'lib/models/Courseware/StructuralElement.php')
| -rw-r--r-- | lib/models/Courseware/StructuralElement.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/models/Courseware/StructuralElement.php b/lib/models/Courseware/StructuralElement.php index 58b01e2..50ba714 100644 --- a/lib/models/Courseware/StructuralElement.php +++ b/lib/models/Courseware/StructuralElement.php @@ -494,9 +494,23 @@ class StructuralElement extends \SimpleORMap implements \PrivacyObject, \Feedbac return false; } - return - (empty($this->visible_start_date) || $this->visible_start_date <= strtotime('today')) - && (empty($this->visible_end_date) || $this->visible_end_date >= strtotime('today')); + $todayStart = strtotime('today'); + $todayDateInt = (int) date('Ymd', $todayStart); + + $isAfterStart = true; + if (!empty($this->visible_start_date)) { + $startDateInt = (int) date('Ymd', $this->visible_start_date); + $isAfterStart = $startDateInt <= $todayDateInt; + } + + $isBeforeEnd = true; + if (!empty($this->visible_end_date)) { + $endDateString = date('Y-m-d', $this->visible_end_date) . ' 23:59:59'; + $visibleEndOfDay = strtotime($endDateString); + $isBeforeEnd = $visibleEndOfDay >= $todayStart; + } + + return $isAfterStart && $isBeforeEnd; } private function hasReadContentApproval($user): bool |
