Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
24 / 24 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Calldisplay | |
100.00% |
24 / 24 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| readResponse | |
100.00% |
24 / 24 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package Zmsadmin |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsadmin; |
| 9 | |
| 10 | use BO\Mellon\Validator; |
| 11 | use BO\Zmsentities\Department; |
| 12 | use BO\Zmsentities\Collection\DepartmentList; |
| 13 | |
| 14 | class Calldisplay extends BaseController |
| 15 | { |
| 16 | /** |
| 17 | * @SuppressWarnings(Param) |
| 18 | * @return \Psr\Http\Message\ResponseInterface |
| 19 | */ |
| 20 | #[\Override] |
| 21 | public function readResponse( |
| 22 | \Psr\Http\Message\RequestInterface $request, |
| 23 | \Psr\Http\Message\ResponseInterface $response, |
| 24 | array $args |
| 25 | ): \Psr\Http\Message\ResponseInterface { |
| 26 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 1])->getEntity(); |
| 27 | $scopeId = $workstation['scope']['id']; |
| 28 | $entityId = Validator::value($scopeId)->isNumber()->getValue(); |
| 29 | |
| 30 | $config = \App::$http->readGetResult('/config/')->getEntity(); |
| 31 | |
| 32 | $entity = \App::$http->readGetResult( |
| 33 | '/scope/' . $entityId . '/organisation/', |
| 34 | ['resolveReferences' => 3] |
| 35 | )->getEntity(); |
| 36 | |
| 37 | $departments = new DepartmentList(); |
| 38 | |
| 39 | foreach ($entity->departments as $departmentData) { |
| 40 | $department = (new Department($departmentData))->withCompleteScopeList(); |
| 41 | $departments->addEntity($department); |
| 42 | } |
| 43 | |
| 44 | return \BO\Slim\Render::withHtml( |
| 45 | $response, |
| 46 | 'page/calldisplay.twig', |
| 47 | array( |
| 48 | 'title' => 'Aufrufanzeige', |
| 49 | 'config' => $config->getArrayCopy(), |
| 50 | 'organisation' => $entity->getArrayCopy(), |
| 51 | 'departments' => $departments->getArrayCopy(), |
| 52 | 'workstation' => $workstation, |
| 53 | 'menuActive' => 'calldisplay' |
| 54 | ) |
| 55 | ); |
| 56 | } |
| 57 | } |