<?php
namespace Bdp\Modules\EventParticipants\Controllers;

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] - ");
    }
}