updated menu structure

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

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>