public function __construct()
 {
     parent::__construct('searchuserform');
     $this->add(['name' => 'name', 'type' => 'Text', 'options' => ['label' => 'Username'], 'attributes' => ['class' => 'form-control']]);
     $this->add(['name' => 'role', 'type' => 'Select', 'options' => ['label' => 'Role', 'value_options' => \Account\Model\Role::getRoleArray()], 'attributes' => ['class' => 'form-control', 'multiple' => 'multiple']]);
     $this->add(['name' => 'submit', 'type' => 'Submit', 'attributes' => ['class' => 'btn btn-success', 'value' => 'Search']]);
 }
 public function indexAction()
 {
     $members = $this->getAccountTable()->getMembers()->toArray();
     for ($i = 0; $i < count($members); $i++) {
         $members[$i]['role'] = Role::convertToRole((int) $members[$i]['role']);
     }
     return new ViewModel(['members' => $members]);
 }
 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];
 }