<?php
namespace Modules\Admin\ExportData\SupplierInvoices; class View_Utils_FormExport extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $form = \Engine\Form\General::create(); $criteriaFieldset = \Engine\Form\Container\Fieldset::create($this->lang['export']['fieldset']['criteria']); $form->addContainer($criteriaFieldset); $servCodeFld = new \App\Form\Input\Select_Service($this->lang['fields']['serviceCode'], 'serviceCode', $this->values['serviceCode']); $servCodeFld->showDefaultOption(true); $servCodeFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $servCodeFld->setPossibleValues(array_merge(['notApplicable' => $this->lang['notApplicable']], $servCodeFld->getPossibleValues())); $criteriaFieldset->addElement($servCodeFld); $rowTypesList = ['notApplicable', 'price', 'advance', 'discount', 'tax', 'penalty']; foreach ($rowTypesList as $rowType) { $rowTypes[$rowType] = ($rowType == 'notApplicable') ? $this->lang['notApplicable'] : $this->lang['rowTypes'][$rowType]; } $rowTypeFld = new \Engine\Form\Input\Select($this->lang['fields']['rowType'], 'rowType', $this->values['rowType']); $rowTypeFld->showDefaultOption(true); $rowTypeFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $rowTypeFld->setPossibleValues($rowTypes); $criteriaFieldset->addElement($rowTypeFld); $locationFld = new \App\Form\Input\Select_CountryCriterion($this->lang['fields']['location'], 'location', $this->values['location']); $locationFld->showDefaultOption(true); $locationFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $locationFld->setPossibleValues(array_merge(['notApplicable' => $this->lang['notApplicable']], $locationFld->getPossibleValues())); $criteriaFieldset->addElement($locationFld); $currencyFld = new \App\Form\Input\Select_Currency($this->lang['fields']['currency'], 'currency', $this->values['currency']); $currencyFld->showDefaultOption(true); $currencyFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $currencyFld->setPossibleValues($currencyFld->getPossibleValues()); $criteriaFieldset->addElement($currencyFld); $fieldsFieldset = \Engine\Form\Container\Fieldset::create($this->lang['insert']['exportFields']); $form->addContainer($fieldsFieldset); $fieldCodes = \App\Config\ExportData_Fields::getInstance()->getFieldsAll('supplierInvoices'); $activeFieldCodes = \App\Config\ExportData_Fields::getInstance()->getFieldsActive('supplierInvoices'); $inactiveFieldCodesKeys = array_diff_key($fieldCodes, $activeFieldCodes); foreach ($activeFieldCodes as $fieldCode => $fieldName) { $fieldFld = new \Engine\Form\Input\Checkbox($fieldName, 'fields['.$fieldCode.']', $this->values['fields'][$fieldCode]); $fieldsFieldset->addElement($fieldFld); } foreach ($inactiveFieldCodesKeys as $fieldCode => $fieldDetails) { $fieldFld = new \Engine\Form\Input\Checkbox($fieldDetails['name'].$this->lang['form']['fields']['inactive'], 'fields['.$fieldCode.']', $this->values['fields'][$fieldCode]); $fieldsFieldset->addElement($fieldFld); } $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }