From 4504bbd3514eca64959f0baed2be481fa261041f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Gl=C3=B6ggler?= <till@gundk.it> Date: Fri, 8 Oct 2021 14:08:42 +0200 Subject: [PATCH] fixes #284, show room in tooltip --- app/views/resources/_common/_request_tr.php | 2 +- lib/models/resources/ResourceRequest.class.php | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/views/resources/_common/_request_tr.php b/app/views/resources/_common/_request_tr.php index 3a2f235561a..3deefe86c5a 100644 --- a/app/views/resources/_common/_request_tr.php +++ b/app/views/resources/_common/_request_tr.php @@ -83,7 +83,7 @@ ) ) ?>) <? endif ?> - <?= tooltipIcon(join("\n", $request->getTimeIntervalStrings())) ?> + <?= tooltipIcon(nl2br(join("\n", $request->getTimeIntervalStrings())), false, true) ?> <? endif ?> </td> <? $priority = $request->getPriority() ?> diff --git a/lib/models/resources/ResourceRequest.class.php b/lib/models/resources/ResourceRequest.class.php index 58e2f915f0b..ccc9270cb4f 100644 --- a/lib/models/resources/ResourceRequest.class.php +++ b/lib/models/resources/ResourceRequest.class.php @@ -1195,16 +1195,27 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen public function getTimeIntervalStrings() { $strings = []; - $intervals = $this->getTimeIntervals(); + $intervals = $this->getTimeIntervals(false, true); foreach ($intervals as $interval) { + $room = ''; + $date = call_user_func([$interval['range'], 'find'], $interval['range_id']); + if ($room_obj = Room::find($date->room_booking->resource_id)) { + $room = $room_obj->name; + } + $same_day = (date('Ymd', $interval['begin']) == date('Ymd', $interval['end']) ); if ($same_day) { - $strings[] = strftime('%a %x %R', $interval['begin']) . ' - ' . strftime('%R', $interval['end']); + $strings[] = strftime('%a. %x %R', $interval['begin']) + . ' - ' . strftime('%R', $interval['end']) + . ($room ? ', '. $room : ''); } else { - $strings[] = strftime('%a %x %R', $interval['begin']) . ' - ' . strftime('%a %x %R', $interval['end']); + $strings[] = strftime('%a. %x %R', $interval['begin']) + . ' - ' . strftime('%a %x %R', $interval['end']) + . ($room ? ', '. $room : ''); } + } return $strings; } -- GitLab