<?php
namespace Modules\Orders\Details\GeneralDetails; class View_Utils_FormAdmin extends \App\Mvc\View_Utils_FormAbstract { public function getForm() { $entityCfg=\Entity\Order::loadCFG(); $accessLevel = \App\UserAccess\CurrentUserAccessFast::getInstance()->getAccessOptionValue('reservationChangeResponsibleUser'); $form = \Engine\Form\General::create(); $form->addContainer(\Engine\Form\Container\Fieldset::create($this->lang['fieldsets']['sectionTitle'])); $reservationCode = new \Engine\Form\Input\Text($this->lang['formFields']['reservationCode'], 'reservationCode', $this->values['reservationCode']); $reservationCode->importFromConfig($entityCfg['reservationCode']); $form->addElement($reservationCode); $reservationType = new \App\Form\Input\Select_OrderType($this->lang['formFields']['reservationType'], 'resType', $this->values['resType']); $reservationType->setMandatory(\App\Config\OrderTypes::getInstance()->getMandatory()); $reservationType->showDefaultOption(); $reservationType->setDefaultOptionText($this->lang['chooseResServType']); $form->addElement($reservationType); $servicesType = new \App\Form\Input\Select_OrderServicesType($this->lang['formFields']['servicesType'], 'servicesType', $this->values['servicesType']); $servicesType->setMandatory(\App\Config\OrderServicesTypes::getInstance()->getMandatory()); $servicesType->showDefaultOption(); $servicesType->setDefaultOptionText($this->lang['chooseResServType']); $form->addElement($servicesType); $flag = new \App\Form\Input\OrderFlag($this->lang['formFields']['flag'], 'flag', $this->values['flag']); $flag->setMandatory(\App\Config\OrderFlags::getInstance()->getMandatory()); if (!\App\UserAccess\CurrentUserAccessFast::getInstance()->getAccessOptionValue('Modules/Orders/Details/OrderFlag')) { $flag->setDisabled(); } $flag->showDefaultOption(); $flag->setDefaultOptionText($this->lang['otherInfo']['noFlags']); $form->addElement($flag); $miceProject = new \App\Form\Input\Autocomplete_MiceProject($this->lang['formFields']['miceProject'], 'idMiceProject', $this->values['idMiceProject']); $form->addElement($miceProject); $description = new \Engine\Form\Input\Textarea($this->lang['formFields']['description'], 'description', $this->values['description']); $description->importFromConfig($entityCfg['description']); $form->addElement($description); $comments = new \Engine\Form\Input\Textarea($this->lang['formFields']['comments'], 'comments', $this->values['comments']); $comments->importFromConfig($entityCfg['comments']); $form->addElement($comments); $contactPerson = new \App\Form\Input\Autocomplete_ContactPersonCorporate($this->lang['formFields']['contactPerson'], 'idContactPerson', $this->values['idContactPerson']); $form->addElement($contactPerson); $idUser = new \App\Form\Input\Autocomplete_User($this->lang['formFields']['respUser'], 'idUser', $this->values['idUser']); $idUser->importFromConfig($entityCfg['idUser']); if (!$accessLevel) { $idUser->setDisabled(true); } elseif ($accessLevel=='deptAndOff') { $idUser->setFilters('idOffice', CURRENT_ID_OFFICE); $idUser->setFilters('idDepartment', CURRENT_ID_DEPT); } elseif ($accessLevel=='office') { $idUser->setFilters('idOffice', CURRENT_ID_OFFICE); } $form->addElement($idUser); $idDepartment = new \App\Form\Input\Autocomplete_Department($this->lang['formFields']['respDept'], 'idDepartment', $this->values['idDepartment']); $idDepartment->importFromConfig($entityCfg['idDepartment']); if (!$accessLevel) { $idDepartment->setDisabled(true); } $form->addElement($idDepartment); $form->addElement(new \Engine\Form\Input\Hidden('', $this->submitButtonName, 1)); return $form; } } 