UserSection.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Admin\Product\Sections;
  3. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\AdminArea;
  4. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Select;
  5. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Switcher;
  6. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Text;
  7. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Textarea;
  8. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\BoxSection;
  9. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  10. class UserSection extends BoxSection implements AdminArea
  11. {
  12. protected $id = 'userSection';
  13. protected $name = 'userSection';
  14. protected $title = 'userSection';
  15. /**
  16. * @var HalfPageSection
  17. */
  18. private $leftSection;
  19. /**
  20. * @var HalfPageSection
  21. */
  22. private $rightSection;
  23. public function initContent()
  24. {
  25. $this->leftSection = new HalfPageSection('leftSectionsdf');
  26. $this->rightSection = new HalfPageSection('rightSectionsdf');
  27. $this->addSection($this->leftSection)
  28. ->addSection($this->rightSection);
  29. $this->initFields();
  30. }
  31. private function initFields()
  32. {
  33. //One User Per VPS
  34. $field = new Switcher('customconfigoption[oneUserPerVps]');
  35. $field->setDescription('tip');
  36. $field->setDefaultValue("on");
  37. $this->leftSection->addField($field);
  38. //Username Prefix
  39. $field = new Text('customconfigoption[userPrefix]');
  40. $field->setDescription('tip');
  41. $field->setDefaultValue('proxmoxVPS_{$serviceid}');
  42. $this->rightSection->addField($field);
  43. //Realm
  44. $field = new Select('customconfigoption[realm]');
  45. $field->setDescription('tip');
  46. $field->setDefaultValue('pve');
  47. $this->leftSection->addField($field);
  48. //Comment
  49. $field = new Textarea('customconfigoption[userComment]');
  50. $field->setDescription('tip');
  51. $field->setDefaultValue('User from module ProxmoxVPS for WHMCS');
  52. $this->rightSection->addField($field);
  53. //Role
  54. $field = new Select('customconfigoption[userRole]');
  55. $field->setDescription('tip');
  56. $field->setDefaultValue('PVEVMUser');
  57. $this->leftSection->addField($field);
  58. }
  59. }