kompass/modules/event-participants/Controllers/class-updateevent.php

30 lines
1.1 KiB
PHP
Raw Normal View History

2024-05-27 16:59:30 +02:00
<?php
namespace Bdp\Modules\EventParticipants\Controllers;
class UpdateEvent {
public function __construct() {
global $_POST, $_REQUEST, $dbHandler;
2024-05-31 20:13:27 +02:00
$use_data = ['event_name', 'event_email', 'startdatum', 'enddatum','max_participants', 'max_volunteers', 'amount_reduced', 'amount_default', 'amount_social', 'contributing_tribes'];
2024-05-27 16:59:30 +02:00
$post_data = [];
foreach ($_POST as $key => $value) {
if (in_array($key, $use_data)) {
$post_data[$key] = $value;
}
};
$post_data['amount_reduced'] = str_replace(',', '.', $_POST['amount_reduced']);
$post_data['amount_default'] = str_replace(',', '.', $_POST['amount_default']);
$post_data['amount_social'] = str_replace(',', '.', $_POST['amount_social']);
2024-06-01 11:07:03 +02:00
$post_data['contributing_tribes'] = serialize( explode(PHP_EOL, $post_data['contributing_tribes'] ) );
2024-05-27 16:59:30 +02:00
$dbHandler->updateRows(
'kompass_veranstaltungen_index',
$post_data,
['id' => $_REQUEST['event-id']]
);
kompass_print_message_box(__('Event data updated successfull.', BDP_LV_PLUGIN_SLUG));
new EditEvent();
}
}