From 49f1ebc5bab4fd2ed1384424674811042ee6ec16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Sat, 16 Mar 2024 16:58:00 +0100 Subject: [PATCH] updated menu structure --- changelog | 1 + includes/frontend-functions.php | 4 +- includes/setup.php | 1 + lang/bdp-kompass_de_DE.po | 6 ++ .../Controllers/SettingsPage.php | 13 ++- .../Controllers/OptionsPage.php | 3 +- modules/calendar/Views/categories-partial.php | 66 ++++++++++++++ modules/calendar/Views/settings-form.php | 18 ++++ modules/calendar/internal/index.php | 86 ------------------- 9 files changed, 105 insertions(+), 93 deletions(-) create mode 100644 modules/calendar/Views/categories-partial.php create mode 100644 modules/calendar/Views/settings-form.php delete mode 100644 modules/calendar/internal/index.php diff --git a/changelog b/changelog index dd71608..5856621 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,7 @@

Version 4.3.7

diff --git a/includes/frontend-functions.php b/includes/frontend-functions.php index 0d53ac9..60b858c 100644 --- a/includes/frontend-functions.php +++ b/includes/frontend-functions.php @@ -67,12 +67,12 @@ function bdp_add_menu_mein_lv() { 3 ); - add_submenu_page($mainSlug, + /*add_submenu_page($mainSlug, 'calendar_settings', 'Kalender-Einstellungen', 'manage_options', $moduleLoad . 'calendar' - ); + );*/ add_submenu_page($mainSlug, 'calendar_settings', diff --git a/includes/setup.php b/includes/setup.php index 2ded9b0..d0b2a0c 100644 --- a/includes/setup.php +++ b/includes/setup.php @@ -24,6 +24,7 @@ require_once (BDP_LV_PLUGIN_DIR . '/modules/seo/seo.php'); require_once (BDP_LV_PLUGIN_DIR . '/modules/calendar/calendar.php'); require_once (BDP_LV_PLUGIN_DIR . '/includes/frontend-functions.php'); +require_once (BDP_LV_PLUGIN_DIR . '/modules/calendar/Views/settings-form.php'); require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php'); function kompass_admin_init() diff --git a/lang/bdp-kompass_de_DE.po b/lang/bdp-kompass_de_DE.po index 82c1ec4..c21fd3c 100644 --- a/lang/bdp-kompass_de_DE.po +++ b/lang/bdp-kompass_de_DE.po @@ -1,6 +1,12 @@ msgid "kompass" msgstr "kompass" +msgid "Calendar settings" +msgstr "Kalender-Einstellungen" + +msgid "Calendar URL" +msgstr "Kalender-Adresse" + msgid "SEO-Options" msgstr "Suchmaschinen-Einstellungen" diff --git a/modules/KompassSettings/Controllers/SettingsPage.php b/modules/KompassSettings/Controllers/SettingsPage.php index 3566b5e..5923617 100644 --- a/modules/KompassSettings/Controllers/SettingsPage.php +++ b/modules/KompassSettings/Controllers/SettingsPage.php @@ -7,7 +7,8 @@ class SettingsPage { public function __construct() { - add_options_page(BDP_LV_PLUGIN_SLUG . '-kompass', + add_options_page( + __('kompass', BDP_LV_PLUGIN_SLUG) . ' - ' . __('Settings', BDP_LV_PLUGIN_SLUG), __('kompass', BDP_LV_PLUGIN_SLUG) . ' - ' . __('Settings', BDP_LV_PLUGIN_SLUG), 'manage_options', BDP_LV_PLUGIN_SLUG . '-Kompass-settings', @@ -22,6 +23,9 @@ class SettingsPage if (isset($_REQUEST['update_options']) && $_REQUEST['update_options'] == true) { switch ($tab) { case 'tab1': + update_option('bdp_calendar_categories', json_encode($_POST['category'])); + update_option('bdp_calendar_source_url', $_POST['ical_url']); + $showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG); break; case 'tab2': @@ -53,9 +57,10 @@ class SettingsPage switch ($tab) { case 'tab1': echo '
'; - do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings'); - submit_button(); - echo ''; + do_settings_sections(BDP_LV_PLUGIN_SLUG . '-calendar-settings'); + require_once BDP_LV_PLUGIN_DIR . '/modules/calendar/Views/categories-partial.php'; + echo ''; + submit_button(); echo '
'; break; case 'tab2': diff --git a/modules/LimitLoginAttempts/Controllers/OptionsPage.php b/modules/LimitLoginAttempts/Controllers/OptionsPage.php index f4ae80b..73e5e3e 100644 --- a/modules/LimitLoginAttempts/Controllers/OptionsPage.php +++ b/modules/LimitLoginAttempts/Controllers/OptionsPage.php @@ -6,7 +6,8 @@ class OptionsPage { public function __construct() { - add_options_page(BDP_LV_PLUGIN_SLUG . '-limit-login-attempts', + add_options_page( + __('Login-Protection', BDP_LV_PLUGIN_SLUG), __('Login-Protection', BDP_LV_PLUGIN_SLUG), 'manage_options', BDP_LV_PLUGIN_SLUG . '-limit-login-attempts', diff --git a/modules/calendar/Views/categories-partial.php b/modules/calendar/Views/categories-partial.php new file mode 100644 index 0000000..7934d68 --- /dev/null +++ b/modules/calendar/Views/categories-partial.php @@ -0,0 +1,66 @@ + 'Meute', + 'blue' => 'Sippe', + 'red' => 'Runde', + 'green' => 'Stammesführung', + 'fuchsia' => '', + 'orange' => '' + ]; +} +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Gelb:
Blau:
Rot:
Grün:
Fuchsia:
Orange:
Grau:Standard
\ No newline at end of file diff --git a/modules/calendar/Views/settings-form.php b/modules/calendar/Views/settings-form.php new file mode 100644 index 0000000..34d117b --- /dev/null +++ b/modules/calendar/Views/settings-form.php @@ -0,0 +1,18 @@ + 'bdp_calendar_source_url', 'style' => 'width: 1024px']); diff --git a/modules/calendar/internal/index.php b/modules/calendar/internal/index.php deleted file mode 100644 index 1e77c22..0000000 --- a/modules/calendar/internal/index.php +++ /dev/null @@ -1,86 +0,0 @@ -Kalender-Einstellungen'; -if (isset($_POST['submit'])) { - echo '
Die Einstellungen wurden gespeichert.
'; - update_option('bdp_calendar_categories', json_encode($_POST['category'])); - update_option('bdp_calendar_source_url', $_POST['ical_url']); -} - -$categories = get_option('bdp_calendar_categories', null); -if (null !== $categories) { - $categories = json_decode($categories, true); -} else { - $categories = [ - 'yellow' => 'Meute', - 'blue' => 'Sippe', - 'red' => 'Runde', - 'green' => 'Stammesführung', - 'fuchsia' => '', - 'orange' => '' - ]; -} -?> -
-
- Datenabfrage - - - - - - -
Kalender-URL:
- -
-
- -
- Labels - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Gelb:
Blau:
Rot:
Grün:
Fuchsia:
Orange:
Grau:Standard
- -