Skip to content
Snippets Groups Projects
Commit 6a497115 authored by Moritz Strohm's avatar Moritz Strohm Committed by David Siegfried
Browse files

resources/search/rooms: link to booking plan of the searched time range begin, re #95

parent e07ed1c8
No related branches found
No related tags found
No related merge requests found
......@@ -93,6 +93,21 @@ class Resources_SearchController extends AuthenticatedController
}
PageLayout::postMessage($message);
}
$this->booking_plan_action_params = [];
if ($this->form_submitted) {
//Check if the time range criteria has been set.
//If so, set the begin date as parameter for the
//booking plan action URL.
$criteria = $room_search_widget->getSelectedCriteria();
if (isset($criteria['special__time_range']) && $criteria['special__time_range']) {
$begin = $criteria['special__time_range']['range']['begin'];
if ($begin instanceof DateTime) {
$this->booking_plan_action_params['defaultDate'] = $begin->format('Y-m-d');
}
}
}
}
}
}
......@@ -19,7 +19,7 @@
);
if ($room->userHasPermission($current_user, 'autor')) {
$actions->addLink(
$room->getActionLink('booking_plan'),
$room->getActionLink('booking_plan', $booking_plan_action_params),
_('Wochenbelegung'),
Icon::create('timetable'),
['target' => '_blank']
......@@ -33,7 +33,7 @@
} else {
if ($room->booking_plan_is_public && Config::get()->RESOURCES_SHOW_PUBLIC_ROOM_PLANS) {
$actions->addLink(
$room->getActionLink('booking_plan'),
$room->getActionLink('booking_plan', $booking_plan_action_params),
_('Belegungsplan'),
Icon::create('timetable'),
['data-dialog' => 'size=big']
......
......@@ -20,7 +20,8 @@
$current_user,
'admin'
),
'cliboard_widget_id' => $clipboard_widget_id
'cliboard_widget_id' => $clipboard_widget_id,
'booking_plan_action_params' => $booking_plan_action_params
]
) ?>
<? endforeach ?>
......
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