Basic implementation event signup
This commit is contained in:
45
modules/event-participants/Controllers/class-ajaxrouter.php
Normal file
45
modules/event-participants/Controllers/class-ajaxrouter.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
class AjaxRouterController {
|
||||
function __construct() {
|
||||
global $_REQUEST;
|
||||
switch ($_REQUEST['method']) {
|
||||
case 'kompass_print_participant_summary':
|
||||
new MemberSummaryController();
|
||||
break;
|
||||
|
||||
case 'print_kitchen_data':
|
||||
new PrintParticipantListKitchenPdfController();
|
||||
break;
|
||||
|
||||
case 'print_kitchen_allergies_data':
|
||||
new PrintParticipantListKitchenAllergiesPdfController();
|
||||
break;
|
||||
|
||||
case 'print_signup_data':
|
||||
new PrintParticipantListSignupPdfController();
|
||||
break;
|
||||
|
||||
case 'print_medical_data':
|
||||
new PrintParticipantListMedicalPdfController();
|
||||
break;
|
||||
|
||||
case 'print_drink_data':
|
||||
new PrintParticipantListDrinkingPdfController();
|
||||
break;
|
||||
|
||||
case 'print_drink_alcoholic_data':
|
||||
new PrintParticipantListDrinkingAlcoholicPdfController();
|
||||
break;
|
||||
|
||||
case 'print_photo_data':
|
||||
new PrintParticipantListPhotoPdfController();
|
||||
break;
|
||||
|
||||
default:
|
||||
echo 'No "method" specified.';
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class ArchiveEvent {
|
||||
public function __construct() {
|
||||
global $_REQUEST, $dbHandler;
|
||||
|
||||
$dbHandler->updateRows(MainController::KOMPASS_EVENTS_EVENTS, ['signup_allowed' => false, 'archived' => true], ['id' => $_REQUEST['event-id']]);
|
||||
kompass_print_message_box(__('Event archived successfully.', BDP_LV_PLUGIN_SLUG));
|
||||
|
||||
new ListEventsController();
|
||||
}
|
||||
}
|
16
modules/event-participants/Controllers/class-closeevent.php
Normal file
16
modules/event-participants/Controllers/class-closeevent.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class CloseEvent {
|
||||
public function __construct() {
|
||||
global $_REQUEST, $dbHandler;
|
||||
|
||||
$dbHandler->updateRows(MainController::KOMPASS_EVENTS_EVENTS, ['signup_allowed' => false], ['id' => $_REQUEST['event-id']]);
|
||||
kompass_print_message_box(__('Event closed for signup', BDP_LV_PLUGIN_SLUG));
|
||||
|
||||
new ListEventsController();
|
||||
}
|
||||
}
|
41
modules/event-participants/Controllers/class-createevent.php
Normal file
41
modules/event-participants/Controllers/class-createevent.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class CreateEvent {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$use_data = ['event_name', 'startdatum', 'enddatum','max_participants', 'max_volunteers', 'amount_reduced', 'amount_default', 'amount_social', 'contributing_tribes'];
|
||||
$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']);
|
||||
|
||||
$post_data['contributing_tribes'] = str_replace( PHP_EOL, ',', $post_data['contributing_tribes'] );
|
||||
|
||||
$new_event_id = $dbHandler->insertRows(
|
||||
'kompass_veranstaltungen_index',
|
||||
$post_data,
|
||||
);
|
||||
kompass_print_message_box(__('Event created successfull.', BDP_LV_PLUGIN_SLUG));
|
||||
|
||||
$pageName = $post_data['event_name'] . ' - ' .__('Registration', BDP_LV_PLUGIN_SLUG);
|
||||
$page_id = wp_insert_post(array(
|
||||
'post_title' => $pageName,
|
||||
'post_content' => '{{event-' . $new_event_id . '}}',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
));
|
||||
|
||||
new ListEventsController();
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class DeleteMemberController {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
$participant = EventParticipant::loadById($_REQUEST['participant-id']);
|
||||
|
||||
$dbHandler->deleteFromDb(MainController::KOMPASS_EVENTS_PARTICIPANTS, ['id' => $participant->id]);
|
||||
|
||||
|
||||
kompass_print_message_box(__('The participant was deleted.', BDP_LV_PLUGIN_SLUG));
|
||||
new ListGroupsAndMembersController($participant->eventId);
|
||||
}
|
||||
}
|
12
modules/event-participants/Controllers/class-editevent.php
Normal file
12
modules/event-participants/Controllers/class-editevent.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event as Event;
|
||||
|
||||
class EditEvent {
|
||||
public function __construct() {
|
||||
global $_GET, $_REQUEST, $dbHandler;
|
||||
kompass_print_event_edit_form($_GET['event-id']);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class EventGroupMailFormController {
|
||||
public function __construct() {
|
||||
global $_REQUEST;
|
||||
$group = $_REQUEST['group'];
|
||||
$recipients = [];
|
||||
foreach (EventParticipant::list_for_event($_REQUEST['event-id']) as $participant) {
|
||||
if ($participant->teilnahme !== $group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_1) . '>';
|
||||
if (!in_array($recipient, $recipients) && str_contains($participant->email_1, '@')) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
if ('' != $participant->email_2 && str_contains($participant->email_2, '@')) {
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_2) . '>';
|
||||
if (!in_array($recipient, $recipients)) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$recipients = array_unique($recipients);
|
||||
$to = implode(', ', $recipients);
|
||||
kompass_print_mail_compose($to, "[KoPfiLa '24] - ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class EventLocalGroupMailFormController {
|
||||
public function __construct() {
|
||||
global $_REQUEST;
|
||||
$group = $_REQUEST['group'];
|
||||
$recipients = [];
|
||||
foreach (EventParticipant::list_for_event($_REQUEST['event-id']) as $participant) {
|
||||
if ($participant->stamm !== $group) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_1) . '>';
|
||||
if (!in_array($recipient, $recipients) && str_contains($participant->email_1, '@')) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
if ('' != $participant->email_2 && str_contains($participant->email_2, '@')) {
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_2) . '>';
|
||||
if (!in_array($recipient, $recipients)) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$recipients = array_unique($recipients);
|
||||
$to = implode(', ', $recipients);
|
||||
kompass_print_mail_compose($to, "[KoPfiLa '24] - ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class EventMailFormController {
|
||||
public function __construct() {
|
||||
global $_REQUEST;
|
||||
$recipients = [];
|
||||
foreach (EventParticipant::list_for_event($_REQUEST['event-id']) as $participant) {
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_1) . '>';
|
||||
if (!in_array($recipient, $recipients) && str_contains($participant->email_1, '@')) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
if ('' != $participant->email_2 && str_contains($participant->email_2, '@')) {
|
||||
$recipient = $participant->vorname . ' <' . strtolower($participant->email_2) . '>';
|
||||
if (!in_array($recipient, $recipients)) {
|
||||
$recipients[] = $recipient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$recipients = array_unique($recipients);
|
||||
$to = implode(', ', $recipients);
|
||||
kompass_print_mail_compose($to, "[KoPfiLa '24] - ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
|
||||
class ListGroupsAndMembersController {
|
||||
public function __construct(?int $event_id = null) {
|
||||
if (!isset($_GET['event-id']) && null === $event_id) {
|
||||
wp_die('Invalid url given');
|
||||
}
|
||||
|
||||
if (isset($_GET['event-id'])) {
|
||||
$event_id = $_GET['event-id'];
|
||||
}
|
||||
$active_tab = 'tab1';
|
||||
if (isset($_GET['tab'])) {
|
||||
$active_tab = $_GET['tab'];
|
||||
}
|
||||
|
||||
|
||||
$event = Event::loadById($event_id);
|
||||
|
||||
$admin_link = admin_url('admin.php?page=kompass-events&action=');
|
||||
include dirname(__FILE__) . '/../Templates/Partials/admin/tab-control.php';
|
||||
}
|
||||
}
|
227
modules/event-participants/Controllers/class-main.php
Normal file
227
modules/event-participants/Controllers/class-main.php
Normal file
@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Libs\FileAccess;
|
||||
use SearchMemberRequest;
|
||||
|
||||
|
||||
class MainController
|
||||
{
|
||||
public const KOMPASS_EVENTS_EVENTS = 'kompass_veranstaltungen_index';
|
||||
public const KOMPASS_EVENTS_GROUPS = 'kompass_veranstaltungen_gruppen';
|
||||
public const KOMPASS_EVENTS_PARTICIPANTS = 'kompass_veranstaltungen_teilis';
|
||||
|
||||
public static function setup()
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
$charset = $wpdb->get_charset_collate();
|
||||
$fileReader = new FileAccess();
|
||||
foreach ([self::KOMPASS_EVENTS_EVENTS, self::KOMPASS_EVENTS_GROUPS, self::KOMPASS_EVENTS_PARTICIPANTS] as $table) {
|
||||
$sqlTable = $wpdb->prefix . $table;
|
||||
$sql = "SHOW TABLES LIKE '$sqlTable'";
|
||||
|
||||
$result = $wpdb->get_var( $sql );
|
||||
if ( $result == $sqlTable ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$sqlSetup = str_replace(
|
||||
'%tablename%',
|
||||
$sqlTable,
|
||||
$fileReader->get_contents( WP_PLUGIN_DIR . '/' . BDP_LV_PLUGIN_SLUG . '/lib/database/' . $table . '.sql' ) );
|
||||
|
||||
$sqlSetup = str_replace('%charset%', $charset, $sqlSetup);
|
||||
$sqlSetup = str_replace('%prefix%', $wpdb->prefix, $sqlSetup);
|
||||
|
||||
|
||||
|
||||
dbDelta( $sqlSetup );
|
||||
}
|
||||
|
||||
}
|
||||
public function __construct()
|
||||
{
|
||||
global $dbHandler;
|
||||
|
||||
add_menu_page(
|
||||
__('Events', BDP_LV_PLUGIN_SLUG),
|
||||
__('Events', BDP_LV_PLUGIN_SLUG),
|
||||
'send_mails',
|
||||
'kompass-events',
|
||||
[$this, 'router'],
|
||||
'dashicons-tickets-alt',
|
||||
3
|
||||
);
|
||||
|
||||
foreach ($dbHandler->readFromDb( self::KOMPASS_EVENTS_EVENTS, ['archived' => false]) as $currentEvent) {
|
||||
add_submenu_page(
|
||||
'kompass-events',
|
||||
$currentEvent->event_name,
|
||||
$currentEvent->event_name,
|
||||
'show_groups',
|
||||
'kompass-events&action=show-event&event-id=' . $currentEvent->id,
|
||||
[ $this, 'router' ]);
|
||||
}
|
||||
|
||||
add_submenu_page(
|
||||
'kompass-events',
|
||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
||||
__('New Event', BDP_LV_PLUGIN_SLUG),
|
||||
'show_groups',
|
||||
'kompass-events&action=new-event',
|
||||
[ $this, 'router' ]);
|
||||
}
|
||||
|
||||
|
||||
public function router()
|
||||
{
|
||||
if (isset($_REQUEST['action'])) {
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'show-event':
|
||||
new ListGroupsAndMembersController();
|
||||
break;
|
||||
|
||||
case 'show-participant':
|
||||
if (isset($_REQUEST['save'])) {
|
||||
new UpdateMemberDetailsController();
|
||||
}
|
||||
|
||||
new MemberDetailsController();
|
||||
break;
|
||||
|
||||
case 'delete-participant':
|
||||
new DeleteMemberController();
|
||||
break;
|
||||
|
||||
case 'update-participant-amount':
|
||||
new UpdateMemberAmountController();
|
||||
break;
|
||||
|
||||
case 'open-event':
|
||||
new OpenEvent();
|
||||
break;
|
||||
|
||||
case 'close-event':
|
||||
new CloseEvent();
|
||||
break;
|
||||
|
||||
case 'archive-event':
|
||||
new ArchiveEvent();
|
||||
break;
|
||||
|
||||
case 'edit-event':
|
||||
new EditEvent();
|
||||
break;
|
||||
|
||||
case 'update-event':
|
||||
new UpdateEvent();
|
||||
break;
|
||||
|
||||
case 'new-event':
|
||||
new NewEvent();
|
||||
break;
|
||||
|
||||
case 'create-event':
|
||||
new CreateEvent();
|
||||
break;
|
||||
|
||||
case 'kompass_print_participant_mail_form':
|
||||
new MemberMailFormController();
|
||||
break;
|
||||
|
||||
case 'send-mail-to-all':
|
||||
new EventMailFormController();
|
||||
break;
|
||||
|
||||
case 'send-mail-to-group':
|
||||
new EventGroupMailFormController();
|
||||
break;
|
||||
|
||||
case 'send-mail-to-local-group':
|
||||
new EventLocalGroupMailFormController();
|
||||
break;
|
||||
|
||||
case 'searchmember':
|
||||
$memberList = SearchMemberRequest::listByName($_POST['member_name']);
|
||||
new PrintMemberListController($memberList);
|
||||
break;
|
||||
|
||||
case 'create_group_form':
|
||||
new CreateGroupController();
|
||||
break;
|
||||
|
||||
case 'update-group':
|
||||
\UpdateGroupAction::execute(['gruppen_name' => $_REQUEST['kompass_groups_group_name']],
|
||||
(int)$_REQUEST['group_id']);
|
||||
|
||||
new PrintGroupsController();
|
||||
break;
|
||||
|
||||
case 'create-group':
|
||||
$data = ['gruppen_name' => $_REQUEST['kompass_groups_group_name']];
|
||||
\CreateGroupAction::execute($data);
|
||||
new PrintGroupsController();
|
||||
break;
|
||||
|
||||
case 'new-member':
|
||||
new CreateMemberController();
|
||||
break;
|
||||
|
||||
case 'create-member':
|
||||
$userData = \CreateGroupMemberDataAction::execute($_REQUEST);
|
||||
if (count($userData['errors']) === 0) {
|
||||
$memberId = \CreateGroupMemberAction::execute( $userData['data'] );
|
||||
new PrintMemberController($memberId);
|
||||
} else {
|
||||
kompass_print_message_box(implode('<br />', $userData['errors']), 'error');
|
||||
new CreateMemberController($userData['rawData']);
|
||||
exit;
|
||||
}
|
||||
new PrintGroupsController();
|
||||
break;
|
||||
|
||||
case 'show-members':
|
||||
$memberList = \ListMemberRequest::listForGroup((int)$_REQUEST['group-id']);
|
||||
new PrintMemberListController($memberList);
|
||||
break;
|
||||
|
||||
case 'show-member':
|
||||
new PrintMemberController((int)$_REQUEST['member-id']);
|
||||
break;
|
||||
|
||||
case 'compose-mail':
|
||||
current_user_can('send_mails');
|
||||
break;
|
||||
|
||||
case 'delete-group':
|
||||
if (current_user_can('delete_groups')) {
|
||||
}
|
||||
break;
|
||||
case 'edit-group':
|
||||
if (current_user_can('edit_groups')) {
|
||||
kompass_edit_group_form($_REQUEST['group-id']);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
new ListEventsController();
|
||||
}
|
||||
} else {
|
||||
|
||||
new ListEventsController();
|
||||
}
|
||||
}
|
||||
|
||||
private function listMembers()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function printMembers(array $memberList)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class MemberDetailsController {
|
||||
public function __construct() {
|
||||
if (!isset($_GET['participant'])) {
|
||||
wp_die('Invalid url given');
|
||||
}
|
||||
|
||||
$participant_id = $_GET['participant'];
|
||||
$participant = EventParticipant::loadById($participant_id);
|
||||
|
||||
$admin_link = admin_url('admin.php?page=kompass-events&action=');
|
||||
include dirname(__FILE__) . '/../Templates/participant-details.php';
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class MemberMailFormController {
|
||||
public function __construct() {
|
||||
global $_REQUEST;
|
||||
$participant = EventParticipant::loadById($_REQUEST['participant-id']);
|
||||
if ($participant->email_1 === $participant->email_2) {
|
||||
$participant->email_2 = '';
|
||||
}
|
||||
|
||||
$to = $participant->vorname . ' <' . $participant->email_1 .'>' .
|
||||
('' !== $participant->email_2 ? ', ' . $participant->vorname . ' <' . $participant->email_2 .'>' : '');
|
||||
kompass_print_mail_compose($to, "[KoPfiLa '24] - ");
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class MemberSummaryController {
|
||||
public function __construct() {
|
||||
global $_REQUEST;
|
||||
$participant = EventParticipant::loadById($_REQUEST['participant-id']);
|
||||
include dirname(__FILE__) . '/../Templates/participant-summary.php';
|
||||
}
|
||||
}
|
11
modules/event-participants/Controllers/class-newevent.php
Normal file
11
modules/event-participants/Controllers/class-newevent.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event as Event;
|
||||
|
||||
class NewEvent {
|
||||
public function __construct() {
|
||||
kompass_print_event_edit_form();
|
||||
|
||||
}
|
||||
}
|
16
modules/event-participants/Controllers/class-openevent.php
Normal file
16
modules/event-participants/Controllers/class-openevent.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class OpenEvent {
|
||||
public function __construct() {
|
||||
global $_REQUEST, $dbHandler;
|
||||
|
||||
$dbHandler->updateRows(MainController::KOMPASS_EVENTS_EVENTS, ['signup_allowed' => true], ['id' => $_REQUEST['event-id']]);
|
||||
kompass_print_message_box(__('Event opened for signup', BDP_LV_PLUGIN_SLUG));
|
||||
|
||||
new ListEventsController();
|
||||
}
|
||||
}
|
10
modules/event-participants/Controllers/class-printevents.php
Normal file
10
modules/event-participants/Controllers/class-printevents.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
class ListEventsController {
|
||||
public function __construct() {
|
||||
kompass_print_events_overview();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListDrinkingPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Getränkeliste (alkoholfrei) für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Geburtsdatum</td>' .
|
||||
'<td>Getränke</td>';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$group_name = ['participant' => 'Teili', 'volunteer' => 'Teami', 'other' => 'Sonstige'];
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->vorname .
|
||||
('' != $participant->pfadiname ? '<br /> (' . $participant->pfadiname . ')' : '') . '</td>' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' .
|
||||
\DateTime::createFromFormat( 'Y-m-d', $participant->geburtsdatum )->format( 'd.m.Y' ) . '<br />' .
|
||||
'(' . $participant->get_age() . ' Jahre)</td>' .
|
||||
'<td style="padding-right: 150px; border-style: solid; border-width: 1px;"></td></tr>';
|
||||
if ( $i == 12 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Anmeldeliste.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListDrinkingAlcoholicPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Getränkeliste (alkoholisch) für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Geburtsdatum</td>' .
|
||||
'<td>Anzahl Bier</td>' .
|
||||
'<td>Anzahl Wein</td>';
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$group_name = ['participant' => 'Teili', 'volunteer' => 'Teami', 'other' => 'Sonstige'];
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
if ($participant->get_age() < 16) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->vorname .
|
||||
('' != $participant->pfadiname ? '<br /> (' . $participant->pfadiname . ')' : '') . '</td>' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' .
|
||||
\DateTime::createFromFormat( 'Y-m-d', $participant->geburtsdatum )->format( 'd.m.Y' ) . '<br />' .
|
||||
'(' . $participant->get_age() . ' Jahre)</td>' .
|
||||
'<td style="padding-right: 150px; border-style: solid; border-width: 1px;"></td>' .
|
||||
'<td style="padding-right: 150px; border-style: solid; border-width: 1px;"></td></tr>';
|
||||
if ( $i == 12 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Anmeldeliste.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\BathRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListKitchenAllergiesPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Zusatz zur Küchenliste für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Allergien</td>' .
|
||||
'<td>Essgewohnheit</td>' .
|
||||
'<td>Anreise</td>' .
|
||||
'<td>Abreise</td>';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
if ($participant->allergien == '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $participant->vorname . '<br /><br /></td>' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .$participant->allergien . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .$participant->essgewohnheit . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .\DateTime::createFromFormat('Y-m-d', $participant->anreise)->format('d.m.Y') . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .\DateTime::createFromFormat('Y-m-d', $participant->abreise)->format('d.m.Y'). '</td></tr>';
|
||||
if ( $i == 13 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Zusatz Küchenliste.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListKitchenPdfController {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$event = Event::loadById($_REQUEST['event-id']);
|
||||
$participantList = EventParticipant::list_for_event($event->id);
|
||||
|
||||
$output = '<html><body><h1>' . $event->event_name . ' - Küchenübersicht</h1><br />';
|
||||
|
||||
$startDate = \DateTime::createFromFormat('Y-m-d', $event->startdatum);
|
||||
$endDate = \DateTime::createFromFormat('Y-m-d', $event->enddatum);
|
||||
|
||||
$output.='<br /><br /><table style="border-spacing: 0; width: 100%;">' .
|
||||
'<tr>' .
|
||||
'<td rowspan="2" style="text-align: center; font-weight: bold;">Datum</td>' .
|
||||
'<td style="border-style:solid solid none solid; border-width: 1px; text-align: center; font-weight: bold;" colspan="2">Frühstück</td>' .
|
||||
'<td style="border-style:solid solid none none; border-width: 1px; text-align: center; font-weight: bold;" colspan="2">Mittag</td>' .
|
||||
'<td style="border-style:solid solid none none; border-width: 1px; text-align: center; font-weight: bold;" colspan="2">Abend</td></tr><tr>' .
|
||||
'<td style="border-style:none solid none solid; border-width: 1px; text-align: center; font-weight: bold;">vegetarisch</td>' .
|
||||
'<td style="border-style:none solid none none; border-width: 1px; text-align: center; font-weight: bold;">vegan</td>' .
|
||||
'<td style="border-style:none solid none none; border-width: 1px; text-align: center; font-weight: bold;">vegetarisch</td>' .
|
||||
'<td style="border-style:none solid none none; border-width: 1px; text-align: center; font-weight: bold;">vegan</td>' .
|
||||
'<td style="border-style:none solid none none; border-width: 1px; text-align: center; font-weight: bold;">vegetarisch</td>' .
|
||||
'<td style="border-style:none solid none none; border-width: 1px; border-style:none solid none none; border-width: 1px; text-align: center; font-weight: bold;">vegan</td>' .
|
||||
'</tr>';
|
||||
|
||||
for ($curDate = $startDate; $curDate->getTimestamp() <= $endDate->getTimestamp(); $curDate->modify('+1 day')) {
|
||||
|
||||
$vegetarischEssen = EatingRequest::send($participantList,'vegetarisch', $curDate);
|
||||
$veganEssen = EatingRequest::send($participantList,'vegan', $curDate);
|
||||
|
||||
$output .= '<tr style="border-width: 1px; border-style: solid; height: 60px;">';
|
||||
$output .= '<td style="border-width: 1px; border-style: solid;">' . $curDate->format('d.m.Y') . '</td>';
|
||||
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $vegetarischEssen['1'] . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $veganEssen['1'] . '</td>';
|
||||
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $vegetarischEssen['2'] . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $veganEssen['2'] . '</td>';
|
||||
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $vegetarischEssen['3'] . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: solid;">' . $veganEssen['3'] . '</td>';
|
||||
|
||||
$output .= '</tr>';
|
||||
}
|
||||
|
||||
|
||||
$output .= '</table></body></html>';
|
||||
|
||||
kompass_create_pdf($output,$event->event_name . ' Küchenübersicht.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\BathRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListMedicalPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Erste-Hilfe-Liste für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%; page-break-after: always";">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Alter</td>' .
|
||||
'<td>Badeerlaubnis</td>' .
|
||||
'<td>Allergien</td>' .
|
||||
'<td>Medikamente</td>' .
|
||||
'<td>Bemerkungen</td>';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $participant->vorname . '<br /><br /></td>' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="padding-right: 10px; border-style: solid; border-width: 1px;">' . $participant->get_age() . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' . BathRequest::send($participant) . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .$participant->allergien . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .$participant->medikamente . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' .$participant->anmerkungen . '</td></tr>';
|
||||
if ( $i == 10 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Saniteam.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListPhotoPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>' . $event_name . ' - Foto-Erlaubnis</h1><br />' .
|
||||
'<br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td style="border-style:solid none solid solid; border-width: 1px; text-align: center; font-weight: bold;">Name</td>' .
|
||||
'<td style="border-style:solid none solid solid; border-width: 1px; text-align: center; font-weight: bold;" >Foto-Erlaubnis Social-Media</td>' .
|
||||
'<td style="border-style:solid none solid solid; border-width: 1px; text-align: center; font-weight: bold;" >Foto-Erlaubnis Print-Media</td>' .
|
||||
'<td style="border-style:solid none solid solid; border-width: 1px; text-align: center; font-weight: bold;" >Foto-Erlaubnis Webseite(n)</td>' .
|
||||
'<td style="border-style:solid none solid solid; border-width: 1px; text-align: center; font-weight: bold;" >Foto-Erlaubnis Partner-Mailings</td>' .
|
||||
'<td style="border-style:solid solid solid solid; border-width: 1px; text-align: center; font-weight: bold;" >Foto-Erlaubnis Interne Archive</td>' .
|
||||
'</tr>';
|
||||
}
|
||||
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$event = Event::loadById($_REQUEST['event-id']);
|
||||
$participantList = EventParticipant::list_for_event($event->id);
|
||||
|
||||
$output = '<html><body>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
foreach ($participantList as $participant) {
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i++;
|
||||
$output .= '<tr style="">';
|
||||
$output .= '<td style="height: 60px; border-width: 1px; border-style: none solid solid solid;">' . $participant->vorname . ($participant->pfadiname != '' ? ' (' . $participant->pfadiname . ')' : '') . ' ' . $participant->nachname . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: none solid solid none;">' . ($participant->foto_socialmedia == true ? 'X' : '---') . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: none solid solid none;">' . ($participant->foto_print == true ? 'X' : '---') . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: none solid solid none;">' . ($participant->foto_webseite == true ? 'X' : '---') . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: none solid solid none;">' . ($participant->foto_partner == true ? 'X' : '---') . '</td>';
|
||||
$output .= '<td style="text-align: center; border-width: 1px; border-style: none solid solid none;">' . ($participant->foto_intern == true ? 'X' : '---') . '</td>';
|
||||
|
||||
$output .= '</tr>';
|
||||
if ( $i == 8 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</body></html>';
|
||||
|
||||
kompass_create_pdf($output,$event->event_name . ' Foto-Erlaubnis.pdf', 'landscape');
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\Event;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\AnwesenheitRequest;
|
||||
use Bdp\Modules\EventParticipants\Reqeust\EatingRequest;
|
||||
|
||||
|
||||
class PrintParticipantListSignupPdfController {
|
||||
|
||||
private function get_table_header(string $event_name) : string {
|
||||
return '<h1>Teili-Liste für ' . $event_name . '</h1><br /><br /><br /><br /><table style="border-spacing: 0; width: 100%;page-break-after: always">' .
|
||||
'<tr>' .
|
||||
'<td>Vorname</td>' .
|
||||
'<td>Nachname</td>' .
|
||||
'<td>Teili-Gruppe</td>' .
|
||||
'<td>Stamm</td>' .
|
||||
'<td>Geburtsdatum</td>' .
|
||||
'<td>Datum</td>' .
|
||||
'<td>Tage</td>' .
|
||||
'<td>Unterschrift</td>';
|
||||
}
|
||||
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$group_name = ['participant' => 'Teili', 'volunteer' => 'Teami', 'other' => 'Sonstige'];
|
||||
|
||||
$event = Event::loadById( $_REQUEST['event-id'] );
|
||||
$output = '';
|
||||
|
||||
$i = 0;
|
||||
foreach ( $event->tribes as $tribe => $participants ) {
|
||||
if ( count( $participants ) == 0 ) {
|
||||
continue;
|
||||
}
|
||||
foreach ( $participants as $participant ) {
|
||||
|
||||
|
||||
if ( $i == 0 ) {
|
||||
$output .= $this->get_table_header( $event->event_name );
|
||||
}
|
||||
$i ++;
|
||||
|
||||
$output .= '<tr style="min-height: 80px; height: 80px; border-style: solid; border-width: 1px;">' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->vorname .
|
||||
('' != $participant->pfadiname ? '<br /> (' . $participant->pfadiname . ')' : '') . '</td>' .
|
||||
'<td style="width: 150px; border-style: solid; border-width: 1px;">' . $participant->nachname . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $group_name[$participant->teilnahme] . '</td>' .
|
||||
'<td style="padding-right: 100px; border-style: solid; border-width: 1px;">' . $tribe . '</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' .
|
||||
\DateTime::createFromFormat( 'Y-m-d', $participant->geburtsdatum )->format( 'd.m.Y' ) . '<br />' .
|
||||
'(' . $participant->get_age() . ' Jahre)</td>' .
|
||||
'<td style="padding-right: 50px; border-style: solid; border-width: 1px;">' .
|
||||
\DateTime::createFromFormat( 'Y-m-d', $participant->anreise )->format( 'd.m.Y' ) . ' - ' .
|
||||
\DateTime::createFromFormat( 'Y-m-d', $participant->abreise )->format( 'd.m.Y' ) . '</td>' .
|
||||
'<td style="border-style: solid; border-width: 1px;">' . AnwesenheitRequest::send($participant) . '</td>' .
|
||||
'<td style="padding-right: 150px; border-style: solid; border-width: 1px;"></td></tr>';
|
||||
if ( $i == 12 ) {
|
||||
$output .= '</table>';
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '</table></body></html>';
|
||||
kompass_create_pdf($output,$event->event_name . ' Anmeldeliste.pdf', 'landscape');
|
||||
}
|
||||
}
|
78
modules/event-participants/Controllers/class-signup.php
Normal file
78
modules/event-participants/Controllers/class-signup.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Libs\FileAccess;
|
||||
use function Bdp\Modules\EventParticipants\Views\registrationForm;
|
||||
|
||||
class ParticipationSignupController
|
||||
{
|
||||
public static function saveRegistration(array $postedData) : string {
|
||||
global $dbHandler;
|
||||
|
||||
$participation_types = ['other', 'participant', 'volunteer'];
|
||||
if (isset($postedData['foto']) && is_array($postedData['foto'])) {
|
||||
foreach ($postedData['foto'] as $fotoData) {
|
||||
$postedData['foto_' . $fotoData] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($postedData['badeerlaubnis'] == '') {
|
||||
$postedData['badeerlaubnis'] = 'complete';
|
||||
}
|
||||
if (isset($postedData['zusatzbeitrag'])) {
|
||||
(int)$postedData['beitrag'] += (int)$postedData['zusatzbeitrag'];
|
||||
unset($postedData['zusatzbeitrag']);
|
||||
}
|
||||
|
||||
unset($postedData['foto']);
|
||||
unset($postedData['_dsgvo_accept']);
|
||||
$postedData['teilnahme'] = $participation_types[$postedData['gruppe_id']];
|
||||
unset($postedData['gruppe_id']);
|
||||
if (null == $dbHandler->insertRows(MainController::KOMPASS_EVENTS_PARTICIPANTS, $postedData)) {
|
||||
$errorPage = file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/error.webseite.php');
|
||||
$errorPage = sprintf($errorPage,
|
||||
$postedData['vorname']
|
||||
);
|
||||
|
||||
wp_mail('thomas@pfadfinden-halle.de', 'Anmeldung für Pfingstlager fehlerhaft', print_r($postedData, true));
|
||||
|
||||
return $errorPage;
|
||||
}
|
||||
|
||||
|
||||
$successMail = file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/done.email.php');
|
||||
$successMail = sprintf($successMail,
|
||||
$postedData['vorname'],
|
||||
\DateTime::createFromFormat('Y-m-d', $postedData['anreise'])->format('d.m.Y'),
|
||||
\DateTime::createFromFormat('Y-m-d', $postedData['abreise'])->format('d.m.Y'),
|
||||
ucfirst($postedData['essgewohnheit'])
|
||||
);
|
||||
|
||||
|
||||
$successPage = file_get_contents(dirname(__FILE__) . '/../Templates/Partials/Registration/done.webseite.php');
|
||||
$successPage = sprintf($successPage,
|
||||
$postedData['vorname'],
|
||||
\DateTime::createFromFormat('Y-m-d', $postedData['anreise'])->format('d.m.Y'),
|
||||
\DateTime::createFromFormat('Y-m-d', $postedData['abreise'])->format('d.m.Y'),
|
||||
ucfirst($postedData['essgewohnheit'])
|
||||
);
|
||||
|
||||
$sent = wp_mail(
|
||||
$postedData['email_1'],
|
||||
'Anmeldung zum Pfingstlager 2024 in Taucha',
|
||||
$successMail,
|
||||
['Reply-To: thomas@pfadfinden-halle.de', 'Content-Type: text/html; charset=UTF-8']);
|
||||
|
||||
|
||||
if ('' !== $postedData['email_2']) {
|
||||
$sent = wp_mail(
|
||||
$postedData['email_2'],
|
||||
'Anmeldung zum Pfingstlager 2024 in Taucha',
|
||||
$successMail,
|
||||
['Reply-To: thomas@pfadfinden-halle.de', 'Content-Type: text/html; charset=UTF-8']);
|
||||
}
|
||||
|
||||
return $successPage;
|
||||
}
|
||||
}
|
25
modules/event-participants/Controllers/class-signuppage.php
Normal file
25
modules/event-participants/Controllers/class-signuppage.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Libs\FileAccess;
|
||||
use function Bdp\Modules\EventParticipants\Views\registrationForm;
|
||||
|
||||
class EventSignupPageController
|
||||
{
|
||||
public static function print_signup_page($content) : string {
|
||||
// Der zu ersetzende String
|
||||
$pattern = '/{{event-(\d+)}}/';
|
||||
|
||||
if (preg_match($pattern, $content, $matches)) {
|
||||
if (isset($_POST['eventId'])) {
|
||||
$content = preg_replace($pattern, ParticipationSignupController::saveRegistration($_POST), $content);
|
||||
} else {
|
||||
$eventId = $matches[1];
|
||||
$url = str_replace(get_site_url(), '', get_permalink());
|
||||
$content = preg_replace( $pattern, registrationForm( $eventId, $url ), $content );
|
||||
}
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
}
|
33
modules/event-participants/Controllers/class-updateevent.php
Normal file
33
modules/event-participants/Controllers/class-updateevent.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class UpdateEvent {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$use_data = ['event_name', 'startdatum', 'enddatum','max_participants', 'max_volunteers', 'amount_reduced', 'amount_default', 'amount_social', 'contributing_tribes'];
|
||||
$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']);
|
||||
|
||||
$post_data['contributing_tribes'] = str_replace( PHP_EOL, ',', $post_data['contributing_tribes'] );
|
||||
|
||||
$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();
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class UpdateMemberAmountController {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$amount = str_replace(',', '.', $_POST['beitrag_bezahlt']);
|
||||
$dbHandler->updateRows(
|
||||
'kompass_veranstaltungen_teilis',
|
||||
['beitrag_bezahlt' => $amount],
|
||||
['id' => $_POST['participant-id']]
|
||||
);
|
||||
kompass_print_message_box(__('Participation data updated successfull.', BDP_LV_PLUGIN_SLUG));
|
||||
$participant = EventParticipant::loadById($_REQUEST['participant-id']);
|
||||
new ListGroupsAndMembersController($participant->eventId);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace Bdp\Modules\EventParticipants\Controllers;
|
||||
|
||||
use Bdp\Modules\EventParticipants\Models\EventGroup;
|
||||
use Bdp\Modules\EventParticipants\Models\EventParticipant;
|
||||
|
||||
class UpdateMemberDetailsController {
|
||||
public function __construct() {
|
||||
global $_POST, $_REQUEST, $dbHandler;
|
||||
|
||||
$dbHandler->updateRows('kompass_veranstaltungen_teilis', $_POST, ['id' => $_GET['participant']]);
|
||||
|
||||
kompass_print_message_box(__('Participation data updated successfull.', BDP_LV_PLUGIN_SLUG));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user