<?php
 namespace Modules\Admin\Config\Balances\Numbers; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $balanceNumberObj = \App\Config\OrderNumber::getInstance(); $allowedResetCriteria = $balanceNumberObj->getAllowedCriteria(); $numberMaxLength = $balanceNumberObj->getAllowedNumberMaxLength(); $form = \Engine\Form\General::create(); $formContainer = \Engine\Form\Container\Fieldset::create($this->lang['index']['fieldset']); $form->addContainer($formContainer); $form->setStyle('width', 300); $fld = new \Engine\Form\Input\Checkboxes($this->lang['index']['fields']['criteria'], 'criteria', $this->values['criteria']); $criteriaFields = []; foreach($allowedResetCriteria as $crit) { $criteriaFields[$crit] = "<strong>".$this->lang['index']['fields']['criteriaLabels'][$crit]."</strong> ".$this->lang['index']['fields']['criteriaLabelDesc'][$crit]; } $fld->setPossibleValues($criteriaFields); $fld->setStyle('renderMode', 'block'); $fld->setDetails($this->lang['index']['fieldsDescriptions']['criteria']); $formContainer->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['index']['fields']['length'], 'numberLength', $this->values['numberLength']); $fld->setValidator(['type'=>'int', 'minValue'=>0, 'maxValue'=>$numberMaxLength]); $fld->setDetails($this->lang['index']['fieldsDescriptions']['length'] ); $formContainer->addElement($fld); $prefixAndSuffixValues = "<b>{idUser}</b>, <b>{userRemark:variableName}</b>, <b>{idDepartment}</b>, <b>{departmentCode}</b>,  <b>{idOffice}</b>, <b>{officeIataCode}</b>,  <b>{officeName}</b>, <b>{year}</b>,  <b>{month}</b>,  <b>{day}</b>"; $prefixAndSuffixInfo = sprintf($this->lang['index']['fieldsDescriptions']['prefixAndSuffix'], $prefixAndSuffixValues); $fld = new \Engine\Form\Input\Text($this->lang['index']['fields']['prefix'], 'prefix', $this->values['prefix']); $fld->setDetails($this->lang['index']['fieldsDescriptions']['prefix'].' '.$prefixAndSuffixInfo); $formContainer->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['index']['fields']['suffix'], 'suffix', $this->values['suffix']); $fld->setDetails($this->lang['index']['fieldsDescriptions']['suffix'].' '.$prefixAndSuffixInfo); $formContainer->addElement($fld); $formContainer->addElement(new \Engine\Form\Input\Hidden(null, 'save', 1)); $form->addButton(new \Engine\Form\Button\Submit('save')); return $form; } }