Lines
97.05%
33 / 34
Functions and Methods
0.00%
0 / 1
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| TicketprinterStatusByScope | 97.05% | 33 / 34 | 0.00% | 0 / 1 | 6 | 0.00% | 0 / 1 | |||
| readResponse | 97.05% | 33 / 34 | 0.00% | 0 / 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\Mellon\Validator; | |
| 11 | use BO\Slim\Render; | |
| 12 | use BO\Zmsentities\Exception\UserAccountMissingRights; | |
| 13 | ||
| 14 | class TicketprinterStatusByScope extends BaseController | |
| 15 | { | |
| 16 | /** | |
| 17 | * | |
| 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/', [ | |
| 27 | 'resolveReferences' => 1, | |
| 28 | 'gql' => Helper\GraphDefaults::getWorkstation() | |
| 29 | ])->getEntity(); | |
| 30 | $success = $request->getAttribute('validator')->getParameter('success')->isString()->getValue(); | |
| 31 | if (!$workstation->getUseraccount()->hasPermissions(['ticketprinter', 'scope'])) { | |
| 32 | throw new UserAccountMissingRights(); | |
| 33 | } | |
| 34 | $scopeId = Validator::value($args['id'])->isNumber()->getValue(); | |
| 35 | $scope = \App::$http->readGetResult('/scope/' . $scopeId . '/', [ | |
| 36 | 'gql' => Helper\GraphDefaults::getScope() | |
| 37 | ])->getEntity(); | |
| 38 | ||
| 39 | $input = $request->getParsedBody(); | |
| 40 | if (is_array($input) && array_key_exists('save', $input)) { | |
| 41 | $scope->status['ticketprinter']['deactivated'] = $input['kioskausgabe']; | |
| 42 | $workstation->scope['status']['ticketprinter']['deactivated'] = $input['kioskausgabe']; | |
| 43 | if ($input['hinweis']) { | |
| 44 | if (! isset($scope->preferences['ticketprinter'])) { | |
| 45 | $scope->preferences['ticketprinter'] = []; | |
| 46 | } | |
| 47 | } | |
| 48 | $scope->preferences['ticketprinter']['deactivatedText'] = $input['hinweis']; | |
| 49 | $scope = \App::$http->readPostResult('/scope/' . $scope->id . '/', $scope)->getEntity(); | |
| 50 | ||
| 51 | return Render::redirect('ticketprinterStatusByScope', ['id' => $scopeId], [ | |
| 52 | 'success' => 'ticketprinter_deactivated_' . $scope->status['ticketprinter']['deactivated'] | |
| 53 | ]); | |
| 54 | } | |
| 55 | ||
| 56 | return Render::withHtml( | |
| 57 | $response, | |
| 58 | 'page/ticketprinterStatus.twig', | |
| 59 | array( | |
| 60 | 'title' => 'Wartenummernausgabe am Kiosk', | |
| 61 | 'menuActive' => 'ticketprinterStatus', | |
| 62 | 'workstation' => $workstation, | |
| 63 | 'scope' => $scope->getArrayCopy(), | |
| 64 | 'success' => $success | |
| 65 | ) | |
| 66 | ); | |
| 67 | } | |
| 68 | } |