SettingsContainer.php 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /* * ********************************************************************
  3. * Wordpress_Manager Product developed. (Dec 7, 2017)
  4. * *
  5. *
  6. * CREATED BY MODULESGARDEN -> http://modulesgarden.com
  7. * CONTACT -> contact@modulesgarden.com
  8. *
  9. *
  10. * This software is furnished under a license and may be used and copied
  11. * only in accordance with the terms of such license and with the
  12. * inclusion of the above copyright notice. This software or any other
  13. * copies thereof may not be provided or otherwise made available to any
  14. * other person. No title to and ownership of the software is hereby
  15. * transferred.
  16. *
  17. *
  18. * ******************************************************************** */
  19. namespace ModulesGarden\ProxmoxAddon\App\UI\Settings\Pages;
  20. use ModulesGarden\ProxmoxAddon as main;
  21. use ModulesGarden\ProxmoxAddon\App\UI\Settings\Providers\SettingProvider;
  22. use ModulesGarden\ProxmoxAddon\App\UI\Settings\Sections\CronSection;
  23. use ModulesGarden\ProxmoxAddon\App\UI\Settings\Sections\GeneralSection;
  24. use ModulesGarden\ProxmoxAddon\Core\UI\Interfaces\AdminArea;
  25. use ModulesGarden\ProxmoxAddon\Core\UI\Widget\Forms\BaseStandaloneFormExtSections;
  26. /**
  27. * SettingsContainer
  28. */
  29. class SettingsContainer extends BaseStandaloneFormExtSections implements AdminArea
  30. {
  31. protected $id = 'settings';
  32. protected $name = 'settings';
  33. protected $title = null;
  34. public function initContent()
  35. {
  36. //SettingProvider
  37. $this->setProvider(new SettingProvider());
  38. //Crons
  39. $this->addSection(new CronSection('cron'));
  40. //General
  41. $general = new GeneralSection('general');
  42. //LoadBalancer
  43. $loadBalancer = new main\App\UI\Settings\Sections\LoadBalancerSection('loadBalancer');
  44. //Minimum VMID
  45. $field = new main\Core\UI\Widget\Forms\Fields\Text('proxmoxVPSMinimumVMID');
  46. $field->addValidator(new main\App\UI\Validators\NumberValidator(1, 100000000 * 100000000 * 100000000));
  47. $field->setLabelWidth(12);
  48. $field->setDefaultValue(100);
  49. $general->addField($field);
  50. //debug
  51. $field = new main\Core\UI\Widget\Forms\Fields\Switcher('debug');
  52. $field->setDescription('description');
  53. $general->addField($field);
  54. //Count VMs
  55. $field = new main\Core\UI\Widget\Forms\Fields\Text('vmsWeight');
  56. $field->addValidator(new main\App\UI\Validators\NumberValidator(1, null));
  57. $field->setLabelWidth(12);
  58. $field->setDescription('description');
  59. $field->setDefaultValue(1000);
  60. $loadBalancer->addField($field);
  61. //Weight CPU
  62. $field = new main\Core\UI\Widget\Forms\Fields\Text('cpuWeight');
  63. $field->addValidator(new main\App\UI\Validators\NumberValidator(1, null));
  64. $field->setLabelWidth(12);
  65. $field->setDescription('description');
  66. $field->setDefaultValue(1);
  67. $loadBalancer->addField($field);
  68. //Weight Disk
  69. $field = new main\Core\UI\Widget\Forms\Fields\Text('diskWeight');
  70. $field->addValidator(new main\App\UI\Validators\NumberValidator(1, null));
  71. $field->setLabelWidth(12);
  72. $field->setDescription('description');
  73. $field->setDefaultValue(1);
  74. $loadBalancer->addField($field);
  75. //Weight RAM
  76. $field = new main\Core\UI\Widget\Forms\Fields\Text('ramWeight');
  77. $field->addValidator(new main\App\UI\Validators\NumberValidator(1, null));
  78. $field->setLabelWidth(12);
  79. $field->setDescription('description');
  80. $field->setDefaultValue(1);
  81. $loadBalancer->addField($field);
  82. //Section
  83. $this->addSection($general);
  84. $this->addSection($loadBalancer);
  85. $this->loadDataToForm();
  86. }
  87. }