diff --git a/lib/calendar/calendars_controller.php b/lib/calendar/calendars_controller.php index 5478710..25d5529 100644 --- a/lib/calendar/calendars_controller.php +++ b/lib/calendar/calendars_controller.php @@ -13,4 +13,18 @@ public function checkPerm() return false; } } + + protected function getSelectDay() + { + $request_day = rex_request('day', 'string', rex_cookie('calendar_day', 'string', '')); // 20112019 Ymd + setcookie('calendar_day', $request_day, time() + 60 + 60 * 24, '/screen/calendars/'); + + return $request_day; + } + + protected function removeSelectDay() + { + setcookie('calendar_day', '', -1, '/screen/calendars/'); + unset($_COOKIE['calendar_day']); + } } diff --git a/lib/calendar/calendars_controller_screen.php b/lib/calendar/calendars_controller_screen.php index 94e7d0d..1dc17c8 100644 --- a/lib/calendar/calendars_controller_screen.php +++ b/lib/calendar/calendars_controller_screen.php @@ -12,6 +12,7 @@ public function controller($function) { if (!in_array($function, $this->functions)) { $function = $this->function_default; + $this->removeSelectDay(); } $this->function = $function; @@ -230,7 +231,8 @@ public function getDayPage($p = []) $s1_content = ''; $s2_content = ''; - $request_day = rex_request('day', 'string'); // 20112019 Ymd + $request_day = $this->getSelectDay(); + if (!$day = DateTime::createFromFormat('Ymd', $request_day)) { $day = new DateTime(); } @@ -332,7 +334,8 @@ public function getWeekPage($p = []) $s1_content = ''; $s2_content = ''; - $request_day = rex_request('day', 'string'); // 20112019 Ymd + $request_day = $request_day = $this->getSelectDay(); + if (!$day = DateTime::createFromFormat('Ymd', $request_day)) { $day = new DateTime(); } @@ -458,7 +461,7 @@ public function getCustomerplanPage($p = []) $s1_content = ''; $s2_content = ''; - $request_day = rex_request('day', 'string'); // 20112019 Ymd + $request_day = $this->getSelectDay(); // 20112019 Ymd // Ansichten: // - 14 tägig