Integrated mareike dashboard theme

This commit is contained in:
2024-07-31 17:53:07 +02:00
parent 5e107d36ca
commit 923d76c085
8 changed files with 397 additions and 56 deletions

View File

@ -5,6 +5,16 @@ namespace Bdp\Modules\KompassSettings\Controllers;
class SettingsPage
{
public static function add_menu() {
add_submenu_page('options-general.php',
'kompass Einstellungen',
'kompass Einstellungen',
'manage_options',
'kompass-settings',
['Bdp\Modules\KompassSettings\Controllers\SettingsPage', 'kompass_settings_page_new']
);
}
public function __construct()
{
add_options_page(
@ -13,6 +23,34 @@ class SettingsPage
'manage_options',
BDP_LV_PLUGIN_SLUG . '-Kompass-settings',
[$this, 'option_page'],2048);
add_options_page(
__('Mail', BDP_LV_PLUGIN_SLUG) . ' - ' . __('Settings', BDP_LV_PLUGIN_SLUG),
__('Mail', BDP_LV_PLUGIN_SLUG) . ' - ' . __('Settings', BDP_LV_PLUGIN_SLUG),
'manage_options',
BDP_LV_PLUGIN_SLUG . '-Kompass-mail-settings',
[$this, 'mail_option_page'],2048);
}
public static function kompass_settings_page_new() {
if (isset($_POST['save'])) {
update_option('paged_used_for_state', false);
update_option('user_can_register', false);
update_option('use_mareike_theme', false);
if (isset($_POST['used_for_state'])) { update_option('paged_used_for_state', true); }
if (isset($_POST['self_register'])) { update_option('user_can_register', true); }
if (isset($_POST['use_mareike_theme'])) { update_option('use_mareike_theme', true); }
kompass_print_message_box('Die Einstellungen wurden gespeichert.');
}
require BDP_LV_PLUGIN_DIR . '/settings/views/settings.php';
return;
}
@ -22,13 +60,13 @@ class SettingsPage
$tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'tab1';
if (isset($_REQUEST['update_options']) && $_REQUEST['update_options'] == true) {
switch ($tab) {
case 'tab1':
case 'tab2':
update_option('bdp_calendar_categories', json_encode($_POST['category']));
update_option('bdp_calendar_source_url', $_POST['bdp_calendar_source_url']);
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
break;
case 'tab2':
case 'tab3':
update_option('kompass_seo_google_verification', $_POST['kompass_seo_google_verification']);
update_option('kompass_seo_bing_verification', $_POST['kompass_seo_bing_verification']);
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
@ -55,19 +93,19 @@ class SettingsPage
<div class="tab-content">
<?php
switch ($tab) {
case 'tab1':
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab1" method="post">';
case 'tab2':
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab2" method="post">';
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-calendar-settings');
require_once BDP_LV_PLUGIN_DIR . '/modules/calendar/Views/categories-partial.php';
echo '<input type="hidden" name="tab" value="tab1" />';
echo '<input type="hidden" name="tab" value="tab2" />';
submit_button();
echo '</form>';
break;
case 'tab2':
case 'tab3':
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings" method="post">';
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings');
submit_button();
echo '<input type="hidden" name="tab" value="tab2" />';
echo '<input type="hidden" name="tab" value="tab3" />';
echo '</form>';
break;
}