<?php
namespace Modules\Admin\Config\Gds\Profiles\Fields; 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); $fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['category'], 'filters[category]', $fieldsValues['category']); $fld->setPossibleValues([ 'corporate' => $this->lang['index']['categories']['corporate'], 'customer' => $this->lang['index']['categories']['customer'], ]); $fld->showDefaultOption(); $form->addElement($fld); $fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['type'], 'filters[type]', $fieldsValues['type']); $fld->setPossibleValues([ 'static' => $this->lang['index']['types']['static'], 'dynamic' => $this->lang['index']['types']['dynamic'], ]); $fld->showDefaultOption(); $form->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['index']['filters']['label'], 'filters[label]', $fieldsValues['label']); $form->addElement($fld); $fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['inputType'], 'filters[inputType]', $fieldsValues['inputType']); $fld->setPossibleValues([ 'text' => $this->lang['formFields']['inputTypes']['text'], 'textarea' => $this->lang['formFields']['inputTypes']['textarea'], 'radio' => $this->lang['formFields']['inputTypes']['radio'], 'select' => $this->lang['formFields']['inputTypes']['select'], ]); $fld->showDefaultOption(); $form->addElement($fld); $listObj = new \App\EntityList\GdsProfilesTemplates(); $listObj->setColumns(['name', 'category']); $listObj->setOrderBy('name', 'ASC'); $tpls = $listObj->exportRecords(); $values = []; foreach ($tpls as $tpl) { $values[$tpl['id']] = sprintf("%s (%s)", $tpl['name'], $this->lang['index']['categories'][$tpl['category']]); } $fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['idProfileTemplate'], 'filters[idProfileTemplate]', $fieldsValues['idProfileTemplate']); $fld->setPossibleValues($values); $fld->showDefaultOption(); $form->addElement($fld); $fld = new \Engine\Form\Input\Select($this->lang['index']['filters']['gds'], 'filters[gds]', $fieldsValues['gds']); $fld->setPossibleValues([ 'amadeus' => 'Amadeus', 'sabre' => 'Sabre', 'galileo' => 'Galileo', 'worldspan' => 'Worldspan', 'apollo' => 'Apollo', ]); $fld->showDefaultOption(); $form->addElement($fld); $form->setJsCallback('MVC.listing.installedHandlers["listing"].reloadAndResetListing'); $form->loadMissingDefaultValues($this->values['listingParams']->getDefaultFilters()); return $form; } } 