Skip to content
Snippets Groups Projects
Verified Commit 4504bbd3 authored by Till Glöggler's avatar Till Glöggler
Browse files

fixes #284, show room in tooltip

parent 46bcded3
No related branches found
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@
)
) ?>)
<? endif ?>
<?= tooltipIcon(join("\n", $request->getTimeIntervalStrings())) ?>
<?= tooltipIcon(nl2br(join("\n", $request->getTimeIntervalStrings())), false, true) ?>
<? endif ?>
</td>
<? $priority = $request->getPriority() ?>
......
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment