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