Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
85.19% |
23 / 27 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| WarehouseSubject | |
85.19% |
23 / 27 |
|
0.00% |
0 / 1 |
3.03 | |
0.00% |
0 / 1 |
| readResponse | |
85.19% |
23 / 27 |
|
0.00% |
0 / 1 |
3.03 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @package Zmsadmin |
| 5 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG |
| 6 | **/ |
| 7 | |
| 8 | namespace BO\Zmsstatistic; |
| 9 | |
| 10 | use BO\Slim\Render; |
| 11 | use BO\Zmsstatistic\Download\WarehouseSubject as Download; |
| 12 | use Psr\Http\Message\RequestInterface; |
| 13 | use Psr\Http\Message\ResponseInterface; |
| 14 | |
| 15 | class WarehouseSubject extends BaseController |
| 16 | { |
| 17 | /** |
| 18 | * @SuppressWarnings(Param) |
| 19 | * @return ResponseInterface |
| 20 | */ |
| 21 | public function readResponse( |
| 22 | RequestInterface $request, |
| 23 | ResponseInterface $response, |
| 24 | array $args |
| 25 | ) { |
| 26 | $validator = $request->getAttribute('validator'); |
| 27 | $subjectList = \App::$http->readGetResult('/warehouse/' . $args['subject'] . '/')->getEntity(); |
| 28 | |
| 29 | $type = $validator->getParameter('type')->isString()->getValue(); |
| 30 | if ($type) { |
| 31 | $args['category'] = 'raw-' . $args['subject']; |
| 32 | $args['reports'][] = $subjectList; |
| 33 | $args['department'] = $this->department; |
| 34 | $args['organisation'] = $this->organisation; |
| 35 | return (new Download(\App::$slim->getContainer()))->readResponse($request, $response, $args); |
| 36 | } |
| 37 | if (count($subjectList['data']) == 1) { |
| 38 | return Render::redirect("WarehousePeriod", [ |
| 39 | 'subject' => $args['subject'], |
| 40 | 'subjectid' => $subjectList['data'][0][0], |
| 41 | ]); |
| 42 | } |
| 43 | |
| 44 | return Render::withHtml( |
| 45 | $response, |
| 46 | 'page/warehouseSubject.twig', |
| 47 | array( |
| 48 | 'title' => 'Kategorien', |
| 49 | 'menuActive' => 'warehouse', |
| 50 | 'dictionary' => $subjectList->dictionary, |
| 51 | 'subjectList' => $subjectList->toHashed(), |
| 52 | 'category' => $args['subject'], |
| 53 | 'categoryName' => $subjectList['title'], |
| 54 | 'workstation' => $this->workstation->getArrayCopy() |
| 55 | ) |
| 56 | ); |
| 57 | } |
| 58 | } |