<?php
 namespace Modules\Admin\Cities; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $CFG = \Engine\Loader_Cfg::getInstance()->getGlobal(); $cfg = \Entity\City::loadCFG(); $form = \Engine\Form\General::create(); $form->setStyle('width', '300'); $form->addContainer(\Engine\Form\Container\Fieldset::create()); $fld = new \App\Form\Input\Autocomplete_Country($this->lang['index']['filters']['country'], 'countryCode', $this->values['countryCode']); $fld->importFromConfig($cfg['countryCode']); if ($this->controller->getAction()=='update') { $fld->setDisabled(); } $form->addElement($fld); if ($CFG['useAlternativeNames']['cities']) { $fld = new \App\Form\Input\AlternativeText($this->lang['formFields']['name'], 'name', $this->values['name']); } else { $fld = new \Engine\Form\Input\Text($this->lang['formFields']['name'], 'name', $this->values['name']); } $fld->importFromConfig($cfg['name']); $form->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['formFields']['code3'], 'code3', $this->values['code3']); $fld->importFromConfig($cfg['code3']); $form->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['formFields']['codeLocal'], 'codeLocal', $this->values['codeLocal']); $fld->importFromConfig($cfg['codeLocal']); $form->addElement($fld); if ($CFG['useAlternativeNames']['cityDistricts']) { $fld = new \App\Form\Input\AlternativeText($this->lang['formFields']['district'], 'district', $this->values['district']); } else { $fld = new \Engine\Form\Input\Text($this->lang['formFields']['district'], 'district', $this->values['district']); } $fld->importFromConfig($cfg['district']); $form->addElement($fld); if ($CFG['useAlternativeNames']['cityRegions']) { $fld = new \App\Form\Input\AlternativeText($this->lang['formFields']['region'], 'region', $this->values['region']); } else { $fld = new \Engine\Form\Input\Text($this->lang['formFields']['region'], 'region', $this->values['region']); } $fld->importFromConfig($cfg['region']); $form->addElement($fld); $fld = new \Engine\Form\Input\Text($this->lang['formFields']['areaCode'], 'areaCode', $this->values['areaCode']); $fld->importFromConfig($cfg['areaCode']); $form->addElement($fld); if ($this->controller->getAction()=='update') { $form->addElement(new \Engine\Form\Input\Hidden('', 'id', $this->values['id'])); } $form->addElement(new \Engine\Form\Input\Hidden('', 'parent', $this->values['parent'])); $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } }