Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 53 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| ConfigInfo | |
0.00% |
0 / 53 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
| readResponse | |
0.00% |
0 / 53 |
|
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\Zmsentities\Config as Entity; |
| 11 | |
| 12 | class ConfigInfo 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' => 1])->getEntity(); |
| 24 | $config = \App::$http->readGetResult('/config/')->getEntity(); |
| 25 | |
| 26 | $mailtemplates = \App::$http->readGetResult('/mailtemplates/')->getCollection(); |
| 27 | |
| 28 | $mainProcessExample = ((new \BO\Zmsentities\Process())->getExample()); |
| 29 | $mainProcessExample->id = 987654; |
| 30 | $dateTime = new \DateTimeImmutable("2015-10-23 08:00:00", new \DateTimeZone('Europe/Berlin')); |
| 31 | $mainProcessExample->getFirstAppointment()->setDateTime($dateTime); |
| 32 | $mainProcessExample->requests[] = (new \BO\Zmsentities\Request())->getExample(); |
| 33 | |
| 34 | $processExample = ((new \BO\Zmsentities\Process())->getExample()); |
| 35 | $processExample->scope = ((new \BO\Zmsentities\Scope())->getExample()); |
| 36 | $processExample2 = clone $processExample; |
| 37 | $dateTime = new \DateTimeImmutable("2015-12-30 11:55:00", new \DateTimeZone('Europe/Berlin')); |
| 38 | $processExample2->getFirstAppointment()->setDateTime($dateTime); |
| 39 | |
| 40 | $processListExample = new \BO\Zmsentities\Collection\ProcessList(); |
| 41 | $processListExample->addEntity($processExample); |
| 42 | $processListExample->addEntity($processExample2); |
| 43 | $success = $request->getAttribute('validator')->getParameter('success')->isString()->getValue(); |
| 44 | |
| 45 | if ($request->getMethod() === 'POST') { |
| 46 | $input = $request->getParsedBody(); |
| 47 | $entity = clone $config; |
| 48 | $entity->setPreference($input['key'], $input['property'], $input['value']); |
| 49 | $entity = \App::$http->readPostResult( |
| 50 | '/config/', |
| 51 | $entity |
| 52 | )->getEntity(); |
| 53 | return \BO\Slim\Render::redirect( |
| 54 | 'configinfo', |
| 55 | array( |
| 56 | 'title' => 'Konfiguration System', |
| 57 | 'workstation' => $workstation, |
| 58 | 'config' => $config, |
| 59 | 'processExample' => $mainProcessExample, |
| 60 | 'processListExample' => $processListExample, |
| 61 | 'menuActive' => 'configinfo' |
| 62 | ), |
| 63 | array( |
| 64 | 'success' => 'config_saved' |
| 65 | ) |
| 66 | ); |
| 67 | } |
| 68 | |
| 69 | return \BO\Slim\Render::withHtml( |
| 70 | $response, |
| 71 | 'page/configinfo.twig', |
| 72 | array( |
| 73 | 'title' => 'Konfiguration System', |
| 74 | 'workstation' => $workstation, |
| 75 | 'config' => $config, |
| 76 | 'mailtemplates' => $mailtemplates, |
| 77 | 'processExample' => $mainProcessExample, |
| 78 | 'processListExample' => $processListExample, |
| 79 | 'menuActive' => 'configinfo', |
| 80 | 'success' => $success |
| 81 | ) |
| 82 | ); |
| 83 | } |
| 84 | } |