BackupSection.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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\Sections\BoxSection;
  8. use ModulesGarden\Servers\ProxmoxVps\Core\UI\Widget\Forms\Sections\HalfPageSection;
  9. class BackupSection extends BoxSection implements AdminArea
  10. {
  11. protected $id = 'backupSection';
  12. protected $name = 'backupSection';
  13. protected $title = 'backupSection';
  14. /**
  15. * @var HalfPageSection
  16. */
  17. private $leftSection;
  18. /**
  19. * @var HalfPageSection
  20. */
  21. private $rightSection;
  22. public function initContent()
  23. {
  24. $this->leftSection = new HalfPageSection('leftSection');
  25. $this->rightSection = new HalfPageSection('rightSection');
  26. $this->addSection($this->leftSection)
  27. ->addSection($this->rightSection);
  28. $this->initFields();
  29. }
  30. private function initFields()
  31. {
  32. //Storage
  33. $field = new Select('customconfigoption[backupStorage]');
  34. $field->setDescription('tip');
  35. $this->leftSection->addField($field);
  36. //Backups Routing
  37. $field = new Switcher('customconfigoption[backupRouting]');
  38. $field->setDescription('tip');
  39. $field->setDefaultValue("on");
  40. $this->rightSection->addField($field);
  41. //Store The Backup For X Days
  42. $field = new Text('customconfigoption[backupStoreDays]');
  43. $field->setDescription('tip');
  44. $this->leftSection->addField($field);
  45. }
  46. }