Lines
100.00%
28 / 28
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| CalendarPage | 100.00% | 28 / 28 | 100.00% | 1 / 1 | 6 | 100.00% | 1 / 1 | |||
| readResponse | 100.00% | 28 / 28 | 100.00% | 1 / 1 | 6 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | /** | |
| 4 | * @package Zmsadmin | |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | |
| 6 | **/ | |
| 7 | ||
| 8 | namespace BO\Zmsadmin; | |
| 9 | ||
| 10 | use BO\Zmsentities\Scope; | |
| 11 | use BO\Zmsentities\Collection\ScopeList; | |
| 12 | ||
| 13 | class CalendarPage extends BaseController | |
| 14 | { | |
| 15 | /** | |
| 16 | * @SuppressWarnings(Param) | |
| 17 | * @return \Psr\Http\Message\ResponseInterface | |
| 18 | */ | |
| 19 | #[\Override] | |
| 20 | public function readResponse( | |
| 21 | \Psr\Http\Message\RequestInterface $request, | |
| 22 | \Psr\Http\Message\ResponseInterface $response, | |
| 23 | array $args | |
| 24 | ): \Psr\Http\Message\ResponseInterface { | |
| 25 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity(); | |
| 26 | ||
| 27 | $validator = $request->getAttribute('validator'); | |
| 28 | $selectedDate = $validator->getParameter('selecteddate')->isString()->getValue(); | |
| 29 | $slotType = $validator->getParameter('slotType')->isString()->getValue(); | |
| 30 | $slotsRequired = $validator->getParameter('slotsRequired')->isNumber()->getValue(); | |
| 31 | $selectedScopeId = $validator->getParameter('selectedscope')->isNumber()->getValue(); | |
| 32 | ||
| 33 | $scope = Helper\AppointmentFormHelper::readSelectedScope($request, $workstation); | |
| 34 | $scope = ($scope) ? $scope : new Scope($workstation->scope); | |
| 35 | $calendar = new Helper\Calendar($selectedDate); | |
| 36 | ||
| 37 | $scopeList = ($selectedScopeId) | |
| 38 | ? (new ScopeList())->addEntity($scope) | |
| 39 | : (new Helper\ClusterHelper($workstation))->getScopeList(); | |
| 40 | ||
| 41 | $slotsRequired = ($scope && $scope->getPreference('appointment', 'multipleSlotsEnabled')) ? $slotsRequired : 0; | |
| 42 | return \BO\Slim\Render::withHtml( | |
| 43 | $response, | |
| 44 | 'block/calendar/calendarMonth.twig', | |
| 45 | array( | |
| 46 | 'title' => 'Kalender', | |
| 47 | 'calendar' => $calendar, | |
| 48 | 'selectedDate' => ($selectedDate) ? $selectedDate : \App::$now->format('Y-m-d'), | |
| 49 | 'selectedYear' => $calendar->getDateTime()->format('Y'), | |
| 50 | 'selectedWeek' => $calendar->getDateTime()->format('W'), | |
| 51 | 'dayoffList' => $scope->getDayoffList(), | |
| 52 | 'scopeList' => $scopeList, | |
| 53 | 'monthList' => $calendar->readMonthListByScopeList($scopeList, $slotType, $slotsRequired), | |
| 54 | 'workstation' => $workstation | |
| 55 | ) | |
| 56 | ); | |
| 57 | } | |
| 58 | } |