<?php
namespace Modules\Admin\QcRules; 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(3); $form->showResetButton(); $entityFld = new \Engine\Form\Input\Select($this->lang['index']['filters']['entity'], 'filters[entity]', $fieldsValues['entity']); $possibleVals = []; foreach($this->globalCfg['qcRules']['entities'] as $ent=>$nada) { $possibleVals[$ent] = $this->globalLang['QcRules']['entities'][$ent]; } $entityFld->setPossibleValues($possibleVals); $entityFld->showDefaultOption(); $form->addElement($entityFld); $idOfRule = new \Engine\Form\Input\Text($this->lang['index']['filters']['id'], 'filters[id]', $fieldsValues['id']); $form->addElement($idOfRule); $statusFld = new \Engine\Form\Input\Select($this->lang['index']['filters']['status'], 'filters[status]', $fieldsValues['status']); $statusesList = [ "active" => $this->lang['index']['status']['activeFilter'], "inactive" => $this->lang['index']['status']['inactiveFilter'], ]; $statusFld->showDefaultOption(); $statusFld->setPossibleValues($statusesList); $form->addElement($statusFld); $nameOfRule = new \Engine\Form\Input\Text($this->lang['index']['filters']['nameOfRule'], 'filters[nameOfRule]', $fieldsValues['nameOfRule']); $form->addElement($nameOfRule); $corporate = new \App\Form\Input\Autocomplete_Corporate($this->lang['index']['filters']['corporate'], 'filters[corporate]', $fieldsValues['corporate']); $form->addElement($corporate); $segment = new \App\Form\Input\Select_CorporateSegment($this->lang['index']['filters']['segment'], 'filters[segment]', $fieldsValues['segment']); $segment->showDefaultOption(); $form->addElement($segment); $trust = new \App\Form\Input\Autocomplete_CorporateTrust($this->lang['index']['filters']['trust'], 'filters[trust]', $fieldsValues['trust']); $form->addElement($trust); $form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing'); $form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters()); return $form; } }