diff options
author | Simon Rettberg | 2019-01-29 09:22:28 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-01-29 09:22:28 +0100 |
commit | f538335087e18ad5950eee0ec1c9654fff5addc5 (patch) | |
tree | 1c5b8ca7d76898fe13e851a5277c62415dba751d /modules-available | |
parent | [locationinfo] Suppress XML parsing error spam (diff) | |
download | slx-admin-f538335087e18ad5950eee0ec1c9654fff5addc5.tar.gz slx-admin-f538335087e18ad5950eee0ec1c9654fff5addc5.tar.xz slx-admin-f538335087e18ad5950eee0ec1c9654fff5addc5.zip |
[locationinfo] HisInOne: Properly handle multiple plannedDates
If a course has been running for several semesters, older plannedDate
entries tend to have no individualDate entries. Ignore those and don't
error_log about it.
Diffstat (limited to 'modules-available')
-rw-r--r-- | modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php index 22b1d8fb..c71623b3 100644 --- a/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php +++ b/modules-available/locationinfo/inc/coursebackend/coursebackend_hisinone.inc.php @@ -271,6 +271,7 @@ class CourseBackend_HisInOne extends CourseBackend $eventDetails = array_merge($eventDetails, $event); } $name = false; + $now = time(); foreach ($eventDetails as $event) { foreach (array('/hisdefaulttext', '/hisshorttext', @@ -293,6 +294,12 @@ class CourseBackend_HisInOne extends CourseBackend foreach ($planElements as $planElement) { if (empty($planElement['hisplannedDates'])) continue; + $checkDate = $this->getArrayPath($planElement, '/hisplannedDates/hisplannedDate/hisenddate'); + if (!empty($checkDate) && strtotime($checkDate[0]) + 86400 < $now) + continue; // Course ended + $checkDate = $this->getArrayPath($planElement, '/hisplannedDates/hisplannedDate/hisstartdate'); + if (!empty($checkDate) && strtotime($checkDate[0]) - 86400 > $now) + continue; // Course didn't start yet $unitPlannedDates = $this->getArrayPath($planElement, '/hisplannedDates/hisplannedDate/hisindividualDates/hisindividualDate'); if ($unitPlannedDates === false) { |