updated menu structure

This commit is contained in:
Thomas Günther 2024-03-16 16:58:00 +01:00
parent d2c74a158a
commit 49f1ebc5ba
9 changed files with 105 additions and 93 deletions

View File

@ -2,6 +2,7 @@
<ul>
<li>Google- und Bing-Verifizierung nun auch im Plugin möglich</li>
<li>Neue Nutzerrollen</li>
<li>Update in Menüstruktur</li>
</ul>
<h4>Version 4.3.7</h4>

View File

@ -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',

View File

@ -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()

View File

@ -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"

View File

@ -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 '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab1" method="post">';
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings');
submit_button();
echo '<input type="hidden" name="tab" value="tab4" />';
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" />';
submit_button();
echo '</form>';
break;
case 'tab2':

View File

@ -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',

View File

@ -0,0 +1,66 @@
<?php
$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' => ''
];
}
?>
<table class="form-table">
<tr>
<th style="width: 200px" scope="row"></th>
<th></th>
<td style="width: 50px;"></td>
<td></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Gelb:</th>
<th><input type="text" name="category[yellow]" value="<?php echo $categories['yellow']; ?>" /></th>
<td style="width: 50px;" class="bdp_cal_event_yellow"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Blau:</th>
<th><input type="text" name="category[blue]" value="<?php echo $categories['blue']; ?>" /></th>
<td class="bdp_cal_event_blue"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Rot:</th>
<th><input type="text" name="category[red]" value="<?php echo $categories['red']; ?>" /></th>
<td class="bdp_cal_event_red"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Grün:</th>
<th><input type="text" name="category[green]" value="<?php echo $categories['green']; ?>" /></th>
<td class="bdp_cal_event_green"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Fuchsia:</th>
<th><input type="text" name="category[fuchsia]" value="<?php echo $categories['fuchsia']; ?>" /></th>
<td class="bdp_cal_event_fuchsia"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Orange:</th>
<th><input type="text" name="category[orange]" value="<?php echo $categories['orange']; ?>" /></th>
<td class="bdp_cal_event_orange"></td>
</tr>
<tr>
<th style="width: 210px;" scope="row">Grau:</th>
<th>Standard</th>
<td class="bdp_cal_event_grey"></td>
</tr>
</table>

View File

@ -0,0 +1,18 @@
<?php
add_settings_section(
'custom_settings_section',
__('Calendar settings', BDP_LV_PLUGIN_SLUG),
'custom_settings_section_callback',
BDP_LV_PLUGIN_SLUG . '-calendar-settings'
);
$seo_settings_page = BDP_LV_PLUGIN_SLUG . '-calendar-settings';
add_settings_field(
'kompass_cal_1',
__('Calendar URL', BDP_LV_PLUGIN_SLUG),
'_kompass_limit_logins_settings_callback',
$seo_settings_page,
'custom_settings_section',
['setting' => 'bdp_calendar_source_url', 'style' => 'width: 1024px']);

View File

@ -1,86 +0,0 @@
<?php
echo '<h1>Kalender-Einstellungen</h1>';
if (isset($_POST['submit'])) {
echo '<div id="bdp_success">Die Einstellungen wurden gespeichert.</div>';
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' => ''
];
}
?>
<form method="post" action="admin.php?page=bdp-kompass%2Fmodules%2Findex.php&loadmodule=calendar">
<fieldset class="bdp_cal_inner">
<legend>Datenabfrage</legend>
<table>
<tr style="vertical-align: top;">
<td>Kalender-URL:</td>
<td><input class="long_text" type="text" name="ical_url" id="ical_url" required
value = "<?php echo get_option('bdp_calendar_source_url', ''); ?>"
><br />
<label style="font-weight: normal; color: #a0a0a0; font-style: italic">
Bitte gib hier die URL zur .ics - Datei eures Kalenbders im Wiki ein.
</label>
</td>
</tr>
</table>
</fieldset>
<fieldset class="bdp_cal_inner">
<legend>Labels</legend>
<table>
<tr>
<td>Gelb:</td>
<td><input type="text" name="category[yellow]" value="<?php echo $categories['yellow']; ?>" /></td>
<td class="bdp_cal_event_yellow"></td>
</tr>
<tr>
<td>Blau:</td>
<td><input type="text" name="category[blue]" value="<?php echo $categories['blue']; ?>" /></td>
<td class="bdp_cal_event_blue"></td>
</tr>
<tr>
<td>Rot:</td>
<td><input type="text" name="category[red]" value="<?php echo $categories['red']; ?>" /></td>
<td class="bdp_cal_event_red"></td>
</tr>
<tr>
<td>Grün:</td>
<td><input type="text" name="category[green]" value="<?php echo $categories['green']; ?>" /></td>
<td class="bdp_cal_event_green"></td>
</tr>
<tr>
<td>Fuchsia:</td>
<td><input type="text" name="category[fuchsia]" value="<?php echo $categories['fuchsia']; ?>" /></td>
<td class="bdp_cal_event_fuchsia"></td>
</tr>
<tr>
<td>Orange:</td>
<td><input type="text" name="category[orange]" value="<?php echo $categories['orange']; ?>" /></td>
<td class="bdp_cal_event_orange"></td>
</tr>
<tr>
<td>Grau:</td>
<td>Standard</td>
<td class="bdp_cal_event_grey"></td>
</tr>
</table>
<input class="button" type="submit" name="submit" value="Einstellungen speichern">
</form>