EditGeneralSection.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\UI\Client\Ressource\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\Core\UI\Widget\Forms\Fields\Hidden;
  8. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Select;
  9. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Text;
  10. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\Switcher;
  11. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Sections\InputGroup;
  12. use ThurData\Servers\KerioEmail\Core\UI\Widget\Forms\Fields\InputGroupElements;
  13. /**
  14. *
  15. * Created by PhpStorm.
  16. * User: Tomasz Bielecki ( tomasz.bi@thurdata.com )
  17. * Date: 12.11.19
  18. * Time: 13:52
  19. * Class EditGeneralSection
  20. */
  21. class EditGeneralSection extends FreeFieldsSection
  22. {
  23. protected $id = 'editGeneralSection';
  24. protected $name = 'editGeneralSection';
  25. use FormExtendedTrait;
  26. public function initContent()
  27. {
  28. /**
  29. * hosting id
  30. */
  31. $hid = $this->getRequestValue('id');
  32. /**
  33. * product manager allow to check product settings
  34. */
  35. $productManager = new ProductManager();
  36. $productManager->loadByHostingId($hid);
  37. /**
  38. * add fields
  39. */
  40. $field = new Hidden('id');
  41. $this->addField($field);
  42. $email =new InputGroup('usernameGroup');
  43. $email->addInputComponent((new InputGroupElements\Text('username'))->addHtmlAttribute('readonly','true'));
  44. $email->addInputAddon('emailSign', false, '@');
  45. $email->addInputComponent((new InputGroupElements\Text('domain'))->addHtmlAttribute('readonly','true'));
  46. $this->addSection($email);
  47. $this->generateDoubleSection([new Text('display_name'), new Select('status')]);
  48. $type = new Select('type');
  49. $capacity = new Text('capacity');
  50. $this->generateDoubleSection([$type, $capacity]);
  51. $field = new Text('description');
  52. $this->addField($field);
  53. $field = new Text('notes');
  54. $this->addField($field);
  55. $autoAcceptDecline = new Switcher('auto_accept');
  56. $autoDeclineBusy = new Switcher('auto_busy');
  57. $this->generateDoubleSection([$autoAcceptDecline, $autoDeclineBusy]);
  58. }
  59. }