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

59 lines
2.3 KiB
PHP
Raw Normal View History

2024-05-27 16:59:30 +02:00
<?php
namespace Bdp\Modules\EventParticipants\Controllers;
use Bdp\Modules\EventParticipants\Models\Event;
use Bdp\Modules\EventParticipants\Reqeust\BathRequest;
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');
}
}