61 lines
3.5 KiB
PHP
61 lines
3.5 KiB
PHP
<?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');
|
|
}
|
|
} |