AddRessourceForm.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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\Models\ClassOfService;
  5. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Repository\ClassOfServices;
  6. use ThurData\Servers\KerioEmail\App\Traits\FormExtendedTrait;
  7. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Forms\SortedFieldForm;
  8. use ThurData\Servers\KerioEmail\App\UI\Admin\Custom\Sections\RowSection;
  9. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Providers\RessourceDataProvider;
  10. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Sections\AdditionalSection;
  11. use ThurData\Servers\KerioEmail\App\UI\Client\Ressource\Sections\GeneralSection;
  12. use ThurData\Servers\KerioEmail\App\Validators\PasswordsValidator;
  13. use ThurData\Servers\KerioEmail\App\Validators\RepeatPasswordValidator;
  14. use function ThurData\Servers\KerioEmail\Core\Helper\di;
  15. use ThurData\Servers\KerioEmail\Core\UI\Interfaces\ClientArea;
  16. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\BaseForm;
  17. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  18. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Password;
  19. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  20. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  21. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\FormConstants;
  22. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\HalfPageSection;
  23. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  24. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  25. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\RawSection;
  26. /**
  27. *
  28. * Created by PhpStorm.
  29. * User: ThurData
  30. * Date: 10.09.19
  31. * Time: 13:06
  32. * Class AddRessourceForm
  33. */
  34. class AddRessourceForm extends SortedFieldForm implements ClientArea
  35. {
  36. use FormExtendedTrait;
  37. protected $id = 'addRessourceForm';
  38. protected $name = 'addRessourceForm';
  39. protected $title = 'addRessourceForm';
  40. public function initContent()
  41. {
  42. $this->setFormType(FormConstants::CREATE);
  43. $this->setProvider(new RessourceDataProvider());
  44. $this->initFields();
  45. $this->loadDataToForm();
  46. }
  47. public function initFields()
  48. {
  49. $email = new InputGroup('usernameGroup');
  50. $email->addTextField('name', false, true);
  51. $email->addInputAddon('emailSign', false, '@');
  52. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  53. $this->addSection($email);
  54. $this->generateDoubleSection([new Text('description'), new Select('type')]);
  55. $this->generateDoubleSection([new Select('manager'), new Select('status')]);
  56. }
  57. }