MainSection.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace ModulesGarden\Servers\ProxmoxVps\App\UI\Admin\Product\Sections;
  3. use ModulesGarden\Servers\ProxmoxVps\Core\Lang\Lang;
  4. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Interfaces\AdminArea;
  5. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Select;
  6. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Fields\Switcher;
  7. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\BoxSection;
  8. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  9. use function ModulesGarden\Servers\ProxmoxVps\Core\Helper\sl;
  10. class MainSection extends BoxSection implements AdminArea
  11. {
  12. protected $id = 'mainSection';
  13. protected $name = 'mainSection';
  14. protected $title = 'mainSection';
  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('leftSection');
  26. $this->rightSection = new HalfPageSection('rightSection');
  27. $this->addSection($this->leftSection)
  28. ->addSection($this->rightSection);
  29. $this->initFields();
  30. }
  31. private function initFields()
  32. {
  33. /**
  34. * @var Lang $lang
  35. */
  36. $lang = sl("lang");
  37. //Virtualization
  38. $field = new Select('customconfigoption[virtualization]');
  39. $field->setDefaultValue('qemu');
  40. $field->setDescription('tip');
  41. $this->leftSection->addField($field);
  42. //Default Node
  43. $field = new Select('customconfigoption[defaultNode]');
  44. $field->setDescription('tip');
  45. $this->rightSection->addField($field);
  46. //Check Available Resources
  47. $field = new Switcher('customconfigoption[checkResources]');
  48. $field->setDescription('tip');
  49. $this->leftSection->addField($field);
  50. //resetUsageFirstDayOfMonth
  51. $field = new Switcher('customconfigoption[resetUsageFirstDayOfMonth]');
  52. $field->setDescription('tip');
  53. $this->rightSection->addField($field);
  54. }
  55. }