kompass/modules/event-participants/Views/events-registration-form.php

86 lines
2.7 KiB
PHP
Raw Normal View History

2024-05-27 16:59:30 +02:00
<?php
namespace Bdp\Modules\EventParticipants\Views;
use Bdp\Modules\EventParticipants\Models\Event;
function registrationForm(int $eventId, string $targetPage) : string
{
global $dbHandler;
$event = Event::loadById($eventId);
if (!$event->signup_allowed) {
return '<h2>Derzeit ist keine Anmeldung für diese Veranstaltung möglich.</h2>';
}
$registerForm = file_get_contents(dirname(__FILE__) . '/../Templates/register-form.php');
$registerForm = str_replace(
'{{altersstufe}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/altersstufe.php'),
$registerForm
);
$registerForm = str_replace(
'{{persönliche daten eltern}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/ansprechpartner.php'),
$registerForm
);
$registerForm = str_replace(
'{{persönliche daten}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/kontaktdaten.php'),
$registerForm
);
$registerForm = str_replace(
'{{anreise}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/anreise.php'),
$registerForm
);
$registerForm = str_replace(
'{{gruppe}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/gruppe.php'),
$registerForm
);
$registerForm = str_replace(
'{{beitrag}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/beitrag.php'),
$registerForm
);
$registerForm = str_replace(
'{{fotoerlaubnis}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/fotoerlaubnis.php'),
$registerForm
);
$registerForm = str_replace(
'{{allergien}}',
file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/allergien.php'),
$registerForm
);
2024-06-01 11:16:07 +02:00
$tribes_array = unserialize($event->contributing_tribes);
$tribes = '';
foreach ($tribes_array as $tribe) {
$tribes .= '<option value="' . $tribe . '">' . $tribe . '</option>';
}
2024-05-27 16:59:30 +02:00
$registerForm = str_replace('{{startdate}}', $event->startdatum, $registerForm);
$registerForm = str_replace('{{enddate}}', $event->enddatum, $registerForm);
$registerForm = str_replace('{{amount_reduced}}', $event->amount_reduced, $registerForm);
$registerForm = str_replace('{{amount_default}}', $event->amount_default, $registerForm);
$registerForm = str_replace('{{amount_social}}', $event->amount_social, $registerForm);
2024-06-01 11:16:07 +02:00
$registerForm = str_replace('{{beteiligte_gruppen}}', $tribes, $registerForm);
2024-05-27 16:59:30 +02:00
$registerForm = str_replace('{{URL}}', $targetPage, $registerForm);
$registerForm = str_replace('{{eventId}}', $eventId, $registerForm);
$registerForm = str_replace('{{BDP_LV_PLUGIN_URL}}', BDP_LV_PLUGIN_URL, $registerForm);
return $registerForm;
}