kompass/modules/event-participants/Views/event-edit-form.php

109 lines
4.1 KiB
PHP
Raw Normal View History

2024-05-27 16:59:30 +02:00
<?php
use Bdp\Modules\EventParticipants\Models\Event as Event;
function kompass_print_event_edit_form(?int $event_id = null)
{
$event = null;
if (null === $event_id) {
$page = 'kompass-events&action=create-event';
} else {
$page = 'kompass-events&action=update-event&event-id=' . $event_id;
$event = Event::loadById($event_id);
}
$events_settings = BDP_LV_PLUGIN_SLUG . '-events-settings';
add_settings_section(
'events_settings',
__('Edit event', BDP_LV_PLUGIN_SLUG),
'kompass_prepare_form',
$events_settings,
['page' => $page]
);
add_settings_field(
'event_settings_1',
__('Event Name', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'event_name', 'style' => 'width: 1024px', 'value' => null !== $event ? $event->event_name : '']);
2024-05-31 20:13:27 +02:00
add_settings_field(
'event_settings_1b',
__('Organisator E-Mail', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'event_email', 'style' => 'width: 1024px', 'value' => null !== $event ? $event->event_email : '']);
2024-05-27 16:59:30 +02:00
add_settings_field(
'event_settings_2',
__('Start date', BDP_LV_PLUGIN_SLUG),
'kompass_print_datebox',
$events_settings,
'events_settings',
['setting' => 'startdatum', 'style' => 'width: 256px', 'value' => null !== $event ? $event->startdatum : '']);
add_settings_field(
'event_settings_3',
__('End date', BDP_LV_PLUGIN_SLUG),
'kompass_print_datebox',
$events_settings,
'events_settings',
['setting' => 'enddatum', 'style' => 'width: 256px', 'value' => null !== $event ? $event->enddatum : '']);
add_settings_field(
'event_settings_7',
__('Maximum participants', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'max_participants', 'style' => 'width: 256px', 'type' => 'number', 'value' => null !== $event ? $event->max_participants : 100] );
add_settings_field(
'event_settings_8',
__('Maximum volunteers', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'max_volunteers', 'style' => 'width: 256px', 'type' => 'number', 'value' => null !== $event ? $event->max_volunteers : 50] );
add_settings_field(
'event_settings_4',
__('Reduced amount', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'amount_reduced', 'style' => 'width: 256px', 'type' => 'number', 'value' => null !== $event ? $event->amount_reduced : 25, 'appendix' => 'Euro']);
add_settings_field(
'event_settings_5',
__('Default amount', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'amount_default', 'style' => 'width: 256px', 'type' => 'number', 'value' => null !== $event ? $event->amount_default : 60, 'appendix' => 'Euro']);
add_settings_field(
'event_settings_6',
__('Additional social amount', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
2024-05-31 20:49:03 +02:00
['setting' => 'amount_social', 'style' => 'width: 256px', 'type' => 'number', 'value' => null !== $event ? $event->amount_social : 100, 'appendix' => 'Euro<br />' . __('This amount gets added to the selected amount', BDP_LV_PLUGIN_SLUG)] );
2024-05-27 16:59:30 +02:00
add_settings_field(
'event_settings_9',
__('Contributing Tribes', BDP_LV_PLUGIN_SLUG),
'kompass_print_textbox',
$events_settings,
'events_settings',
['setting' => 'contributing_tribes', 'style' => 'width: 256px', 'lines' => 5, 'value' => str_replace(',', PHP_EOL, null !== $event ? $event->contributing_tribes : ''), 'appendix' => '<br />' . __('Please one line per row', BDP_LV_PLUGIN_SLUG)] );
do_settings_sections($events_settings);
submit_button();
echo '</form>';
}