<?php
namespace Modules\Admin\Config\OAuth2\RefreshTokens; class View_Utils_FormFilters extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $fieldsValues = $this->values['listingParams']->getFilters(); $form=\Engine\Form\Filters::create(); $form->setColumns(2); $form->showResetButton(); $tokenId = new \Engine\Form\Input\Text($this->lang['index']['filters']['tokenId'], 'filters[tokenId]', $fieldsValues['tokenId']); $form->addElement($tokenId); $listObj = new \App\EntityList\OAuth2Clients(); $listObj->setColumns(['clientId', 'name']); $listObj->setFilter('isEnabled', '=', 1); $listObj->setOrderBy('name', 'ASC'); $apps = $listObj->exportRecords(); $application = new \Engine\Form\Input\Select($this->lang['index']['filters']['clientId'], 'filters[clientId]', $fieldsValues['clientId']); $application->setDefaultOptionText("= all ="); $application->showDefaultOption(); foreach ($apps as $app) { $application->setPossibleValue($app['clientId'], sprintf("%s (%s)", $app['name'], $app['clientId'])); } $form->addElement($application); $idUser = new \App\Form\Input\Autocomplete_User($this->lang['index']['filters']['idUser'], 'filters[idUser]', $fieldsValues['idUser']); $form->addElement($idUser); $status = new \Engine\Form\Input\Select($this->lang['index']['filters']['status'], 'filters[status]', $fieldsValues['status']); $status->setPossibleValues([ 'active' => 'Active', 'revoked' => 'Revoked', ]); $status->setDefaultOptionText("= all ="); $status->showDefaultOption(); $form->addElement($status); $form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing'); $form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters()); return $form; } }