public function setRolesAction() { if (!PermissionChecker::check(Role::CO)) { return $this->redirect()->toRoute('account', ['action' => 'noright']); } $form = new SearchUserForm(); $request = $this->getRequest(); $paginator = $this->getAccountTable()->getUsersAndAbove(true); $page = (int) $this->params()->fromQuery('page', 1); $name = $this->params()->fromQuery('name', ''); $role = $this->params()->fromQuery('role', ''); $account = new Account(); $form->setInputFilter($account->getUserSearchInputFilter()); $form->setData(['name' => $name, 'role' => $role]); if ($form->isValid()) { $account->exchangeArray($form->getData()); $paginator = $this->getAccountTable()->getUsersAndAbove(true, $name, $role); } $role_strings = Role::getAllRoles(); $paginator->setCurrentPageNumber($page); $paginator->setItemCountPerPage(25); return ['form' => $form, 'users' => $paginator, 'role_strings' => $role_strings]; }