GeneralSection.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\EmailAccount\Sections;
  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\Sections\FreeFieldsSection;
  7. use ThurData\Servers\KerioEmail\App\Validators\PasswordsValidator;
  8. use ThurData\Servers\KerioEmail\App\Validators\RepeatPasswordValidator;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Hidden;
  10. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Password;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  12. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  13. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Number;
  14. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  15. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  16. /**
  17. *
  18. * Created by PhpStorm.
  19. * User: ThurData
  20. * Date: 12.11.19
  21. * Time: 13:39
  22. * Class GeneralSection
  23. */
  24. class GeneralSection extends FreeFieldsSection
  25. {
  26. protected $id = 'generalSection';
  27. protected $name = 'generalSection';
  28. use FormExtendedTrait;
  29. public function initContent()
  30. {
  31. /**
  32. * hosting id
  33. */
  34. $hid = $this->getRequestValue('id');
  35. /**
  36. * product manager allow to check product settings
  37. */
  38. $productManager = new ProductManager();
  39. $productManager->loadByHostingId($hid);
  40. $this->generateDoubleSection([new Text('firstname'), new Text('lastname')]);
  41. $email = new InputGroup('usernameGroup');
  42. $email->addTextField('username', false, true);
  43. $email->addInputAddon('emailSign', false, '@');
  44. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  45. $this->addSection($email);
  46. $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
  47. $this->generateDoubleSection([new Text('quota'), new Select('unit')]);
  48. $passwd = new Password('password');
  49. $passwd->setDescription('description');
  50. $passwd->addValidator(new PasswordsValidator());
  51. $passwd->notEmpty();
  52. $repPasswd = (new Password('repeat_password'))->addValidator(new RepeatPasswordValidator());
  53. $repPasswd->notEmpty();
  54. $this->generateDoubleSection([$passwd, $repPasswd]);
  55. }
  56. }