| Code Coverage | ||||||||||
| Lines | Functions and Methods | Classes and Traits | ||||||||
| Total |  | 100.00% | 26 / 26 |  | 100.00% | 1 / 1 | CRAP |  | 100.00% | 1 / 1 | 
| Useraccount |  | 100.00% | 26 / 26 |  | 100.00% | 1 / 1 | 4 |  | 100.00% | 1 / 1 | 
| readResponse |  | 100.00% | 26 / 26 |  | 100.00% | 1 / 1 | 4 | |||
| 1 | <?php | 
| 2 | |
| 3 | /** | 
| 4 | * | 
| 5 | * @package Zmsadmin | 
| 6 | * @copyright BerlinOnline Stadtportal GmbH & Co. KG | 
| 7 | * | 
| 8 | */ | 
| 9 | |
| 10 | namespace BO\Zmsadmin; | 
| 11 | |
| 12 | use BO\Zmsentities\Collection\UseraccountList as Collection; | 
| 13 | use Psr\Http\Message\RequestInterface; | 
| 14 | use Psr\Http\Message\ResponseInterface; | 
| 15 | |
| 16 | class Useraccount extends BaseController | 
| 17 | { | 
| 18 | /** | 
| 19 | * @SuppressWarnings(Param) | 
| 20 | * @return ResponseInterface | 
| 21 | */ | 
| 22 | public function readResponse( | 
| 23 | RequestInterface $request, | 
| 24 | ResponseInterface $response, | 
| 25 | array $args | 
| 26 | ) { | 
| 27 | $workstation = \App::$http->readGetResult('/workstation/', ['resolveReferences' => 2])->getEntity(); | 
| 28 | $success = $request->getAttribute('validator')->getParameter('success')->isString()->getValue(); | 
| 29 | $ownerList = \App::$http->readGetResult('/owner/', array('resolveReferences' => 2))->getCollection(); | 
| 30 | |
| 31 | $useraccountList = new Collection(); | 
| 32 | if ($workstation->hasSuperUseraccount()) { | 
| 33 | $useraccountList = \App::$http->readGetResult("/useraccount/", ["resolveReferences" => 0])->getCollection(); | 
| 34 | } else { | 
| 35 | $departmentListIds = $workstation->getUseraccount()->getDepartmentList()->getIds(); | 
| 36 | |
| 37 | $departmentUseraccountList = \App::$http | 
| 38 | ->readGetResult('/department/' . implode(',', $departmentListIds) . '/useraccount/') | 
| 39 | ->getCollection(); | 
| 40 | |
| 41 | if (! empty($departmentUseraccountList)) { | 
| 42 | $useraccountList = $useraccountList->addList($departmentUseraccountList)->withoutDublicates(); | 
| 43 | } | 
| 44 | } | 
| 45 | |
| 46 | return \BO\Slim\Render::withHtml( | 
| 47 | $response, | 
| 48 | 'page/useraccount.twig', | 
| 49 | array( | 
| 50 | 'title' => 'Nutzer', | 
| 51 | 'menuActive' => 'useraccount', | 
| 52 | 'workstation' => $workstation, | 
| 53 | 'useraccountList' => ($useraccountList) ? | 
| 54 | $useraccountList->sortByCustomStringKey('id') : | 
| 55 | new Collection(), | 
| 56 | 'ownerlist' => $ownerList, | 
| 57 | 'success' => $success, | 
| 58 | ) | 
| 59 | ); | 
| 60 | } | 
| 61 | } |