Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

113 Zeilen
4.6KB

  1. <?php
  2. namespace domain\Setting\SettingDetails\Admin;
  3. use domain\Setting\SettingDefinition;
  4. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageIconSetting;
  5. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageSetting;
  6. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTitleSetting;
  7. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTypeSetting;
  8. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageUpdatedAtSetting;
  9. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageDisplaySetting;
  10. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageIconSetting;
  11. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageSetting;
  12. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTitleSetting;
  13. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTypeSetting;
  14. use domain\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting;
  15. use domain\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting;
  16. use domain\Setting\SettingDetails\Admin\General\BulkMailerAdminSetting;
  17. use domain\Setting\SettingDetails\Admin\General\ForumFlarumUrlAdminSetting;
  18. use domain\Setting\SettingDetails\Admin\General\MailerAdminSetting;
  19. use domain\Setting\SettingDetails\Admin\General\MaximumNumberProducersAdminSetting;
  20. use domain\Setting\SettingDetails\Admin\General\SupportOnlineAdminSetting;
  21. use domain\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageDisplaySetting;
  22. class AdminSettingDefinition extends SettingDefinition
  23. {
  24. const SECTION_GENERAL = 'general';
  25. const SUBSECTION_GENERAL = 'general.main';
  26. const SECTION_ALERT_MESSAGE = 'alertmessage';
  27. const SUBSECTION_ALERT_MESSAGE_GLOBAL = 'alertmessage.global';
  28. const SUBSECTION_ALERT_MESSAGE_SUPPORT = 'alertmessage.support';
  29. public function getSettingDetails(): array
  30. {
  31. return [
  32. self::SECTION_GENERAL => [
  33. self::SUBSECTION_GENERAL => [
  34. new SupportOnlineAdminSetting(),
  35. new AdministratorEmailAdminSetting(),
  36. new AdministratorPhoneNumberAdminSetting(),
  37. new MaximumNumberProducersAdminSetting(),
  38. new ForumFlarumUrlAdminSetting(),
  39. new MailerAdminSetting(),
  40. new BulkMailerAdminSetting(),
  41. ]
  42. ],
  43. self::SECTION_ALERT_MESSAGE => [
  44. self::SUBSECTION_ALERT_MESSAGE_GLOBAL => [
  45. new AdminAlertMessageDisplaySetting(),
  46. new AdminAlertMessageTypeSetting(),
  47. new AdminAlertMessageIconSetting(),
  48. new AdminAlertMessageTitleSetting(),
  49. new AdminAlertMessageSetting(),
  50. new AdminAlertMessageUpdatedAtSetting(),
  51. ],
  52. self::SUBSECTION_ALERT_MESSAGE_SUPPORT => [
  53. new AdminSupportAlertMessageDisplaySetting(),
  54. new AdminSupportAlertMessageTypeSetting(),
  55. new AdminSupportAlertMessageIconSetting(),
  56. new AdminSupportAlertMessageTitleSetting(),
  57. new AdminSupportAlertMessageSetting(),
  58. ],
  59. ]
  60. ];
  61. }
  62. public function getSectionLabels(): array
  63. {
  64. return [
  65. self::SECTION_GENERAL => 'General',
  66. self::SUBSECTION_GENERAL => 'General',
  67. self::SECTION_ALERT_MESSAGE => 'Message d\'alerte',
  68. self::SUBSECTION_ALERT_MESSAGE_GLOBAL => 'Global',
  69. self::SUBSECTION_ALERT_MESSAGE_SUPPORT => 'Support'
  70. ];
  71. }
  72. public function getSectionsArray(): array
  73. {
  74. $sectionsArray = [];
  75. foreach($this->getSettingDetails() as $sectionName => $subsectionsArray) {
  76. $sectionsArray[] = [
  77. 'name' => $sectionName,
  78. 'nameDisplay' => $this->getSectionLabelBySectionName($sectionName),
  79. ];
  80. }
  81. return $sectionsArray;
  82. }
  83. public function getSettingDetailsFlat(): array
  84. {
  85. $settingDetailsFlatArray = [];
  86. foreach($this->getSettingDetails() as $sectionsArray) {
  87. foreach($sectionsArray as $subsectionsArray) {
  88. foreach($subsectionsArray as $settingDetail) {
  89. $settingDetailsFlatArray[] = $settingDetail;
  90. }
  91. }
  92. }
  93. return $settingDetailsFlatArray;
  94. }
  95. public function getSectionLabelBySectionName(string $sectionName): string
  96. {
  97. return $this->getSectionLabels()[$sectionName];
  98. }
  99. }