58 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace Bdp\Modules\EventParticipants\Controllers;
 | 
						|
 | 
						|
use Bdp\Modules\EventParticipants\Models\Event;
 | 
						|
use Bdp\Modules\EventParticipants\Models\EventParticipant;
 | 
						|
 | 
						|
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');
 | 
						|
	}
 | 
						|
} |