From 724c8c7ed9b57831926edd8ac5239d4903c4b788 Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Tue, 23 Apr 2024 12:19:34 +0200 Subject: [PATCH] set user_id or group_id when calling calendar/date/add from sidebar --- app/controllers/calendar/calendar.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/calendar/calendar.php b/app/controllers/calendar/calendar.php index 85b5b433dc2..27048fb3c98 100644 --- a/app/controllers/calendar/calendar.php +++ b/app/controllers/calendar/calendar.php @@ -12,7 +12,7 @@ class Calendar_CalendarController extends AuthenticatedController } - protected function buildSidebar($schedule = false) + protected function buildSidebar($schedule = false, $user_id = '', $group_id = '') { $sidebar = Sidebar::get(); @@ -25,9 +25,15 @@ class Calendar_CalendarController extends AuthenticatedController ['data-dialog' => 'size=default'] ); } else { + $params = []; + if ($user_id) { + $params['user_id'] = $user_id; + } elseif ($group_id) { + $params['group_id'] = $group_id; + } $actions->addLink( _('Termin anlegen'), - $this->url_for('calendar/date/add'), + $this->url_for('calendar/date/add', $params), Icon::create('add'), ['data-dialog' => 'size=auto'] ); @@ -181,7 +187,11 @@ class Calendar_CalendarController extends AuthenticatedController throw new AccessDeniedException(_('Sie dürfen diesen Kalender nicht sehen!')); } - $this->buildSidebar(false); + $this->buildSidebar( + false, + $calendar_owner ? $calendar_owner->id : '', + $selected_group ? $selected_group->id : '' + ); $sidebar = Sidebar::get(); -- GitLab