EditRessourceForm.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Forms;
  3. use ThurData\Servers\KerioEmail\App\Libs\Product\ProductManager;
  4. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository\ClassOfServices;
  5. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  6. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Forms\SortedFieldForm;
  7. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\RowSection;
  8. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Providers\RessourceDataProvider;
  9. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Providers\EditRessourceDataProvider;
  10. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Sections\EditAdditionalSection;
  11. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Sections\EditGeneralSection;
  12. use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
  13. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  14. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  15. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  16. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\FormConstants;
  17. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\HalfPageSection;
  18. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  19. use ThurData\Servers\KerioEmail\Core\UI\Widget\Modals\BaseEditModal;
  20. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  21. /**
  22. *
  23. * Created by PhpStorm.
  24. * User: ThurData
  25. * Date: 18.09.19
  26. * Time: 09:29
  27. * Class EditRessourceForm
  28. */
  29. class EditRessourceForm extends SortedFieldForm implements ClientArea
  30. {
  31. use FormExtendedTrait;
  32. protected $id = 'editRessourceForm';
  33. protected $name = 'editRessourceForm';
  34. protected $title = 'editRessourceForm';
  35. public function initContent()
  36. {
  37. $this->setFormType(FormConstants::UPDATE);
  38. $this->setProvider(new EditRessourceDataProvider());
  39. $this->initFields();
  40. $this->loadDataToForm();
  41. }
  42. public function initFields()
  43. {
  44. $this->addField((new Hidden('id')));
  45. $email = new InputGroup('usernameGroup');
  46. $email->addInputComponent((new InputGroupElements\Text('name'))->addHtmlAttribute('readonly','true'));
  47. $email->addInputAddon('emailSign', false, '@');
  48. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  49. $this->addSection($email);
  50. $this->generateDoubleSection([new Text('description'), new Select('type')]);
  51. $this->generateDoubleSection([new Select('manager'), new Select('status')]);
  52. }
  53. }