<?php
namespace Modules\Admin\ExportData\ClientInvoices; 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($servCodeFld->getPossibleValues()); $criteriaFieldset->addElement($servCodeFld); $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($locationFld->getPossibleValues()); $criteriaFieldset->addElement($locationFld); $rowTypesList = ['price', 'commission', 'discount', 'serviceFee', 'tax', 'advance', 'penalty']; foreach ($rowTypesList as $rowType) { $rowTypes[$rowType] = $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); $clientTypesList = ['individual', 'legalEntity']; foreach ($clientTypesList as $clientType) { $clientTypes[$clientType] = $this->lang['clientTypes'][$clientType]; } $clientTypeFld = new \Engine\Form\Input\Select($this->lang['fields']['clientType'], 'clientType', $this->values['clientType']); $clientTypeFld->showDefaultOption(true); $clientTypeFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $clientTypeFld->setPossibleValues($clientTypes); $criteriaFieldset->addElement($clientTypeFld); $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); $advanceFld = new \Engine\Form\Input\Select($this->lang['fields']['advanceInvoice'], 'advanceInvoice', $this->values['advanceInvoice']); $advanceFld->showDefaultOption(true); $advanceFld->setDefaultOptionText($this->lang['list']['filters']['searchAll']); $advanceFld->setPossibleValues(['0'=>$this->globalLang['no'], '1'=>$this->globalLang['yes']]); $criteriaFieldset->addElement($advanceFld); $fieldsFieldset = \Engine\Form\Container\Fieldset::create($this->lang['insert']['exportFields']); $form->addContainer($fieldsFieldset); $fieldCodes = \App\Config\ExportData_Fields::getInstance()->getFieldsAll('clientInvoices'); $activeFieldCodes = \App\Config\ExportData_Fields::getInstance()->getFieldsActive('clientInvoices'); $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; } }