Image( 'logo.jpg',12,6,30); // Arial bold 15 $this->SetFont('Arial','B',16); // Move to the right $this->Cell(72); // Title $this->SetTextColor(65,28,204); $this->Cell(50,10, utf8_decode('Anmeldebestätigung'),0,0,'C'); // Logo $this->Image('logo.jpg',168,6,30); // Deco $this->Image('header.png',16,45); // Line break $this->Ln(42); } // Page footer function Footer() { // Position at 1.5 cm from bottom $this->SetY(-17); // Deco $this->Image('footer.png',41,275); // Arial 8 $this->SetFont('Arial','',8); $this->SetTextColor(65,28,204); // Contact info $this->Cell(0,5, utf8_decode('Li-Dance Tanz- und Sportschule | Inh. Lydia Kolepp | Dieselstrasse 10 | 61231 Bad Nauheim'),0,1,'C'); $this->Ln(1); $this->Cell(0,5,'Telefon: 060 32 / 78 48 644 | Email: info@li-dance.com | Web: www.li-dance.com',0,1,'C'); } } function getRegistrationPdf($data) { $totalmargin = 32; $leftmargin = $totalmargin + 10; $leftcolumnwidth = 40; $fillcolumnwidth = 0; $columnheight = 10; // Instanciation of inherited class $pdf = new PDF(); $pdf->AliasNbPages(); $pdf->AddPage(); $pdf->SetFont('Arial','B', 14); $pdf->Cell($totalmargin); $pdf->Cell($fillcolumnwidth,$columnheight,'Ihre Daten',0,1); $pdf->Ln(5); $pdf->SetFont('Arial','',12); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Vorname: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->firstname , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Nachname: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->lastname , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Geburtsdatum: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->birthdate , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Geschlecht: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->gender , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Adresse: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->street . ' ' . $data->house . ', ' . $data->zip . ' ' . $data->city , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Telefon: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->phone , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'E-Mail: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->email , 0, 1); $pdf->Ln(10); $pdf->SetFont('Arial','B', 14); $pdf->Cell($totalmargin); $pdf->Cell($fillcolumnwidth,$columnheight,'Ihre Bankdaten',0,1); $pdf->Ln(5); $pdf->SetFont('Arial','',12); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Kontoinhaber: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->accountholder , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'IBAN: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->iban , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'BIC: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->bic , 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Bank: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->bank , 0, 1); $pdf->Ln(10); $pdf->SetFont('Arial','B', 14); $pdf->Cell($totalmargin); $pdf->Cell($fillcolumnwidth,$columnheight,'Ihre Mitgliedschaft:' , 0, 1); $pdf->Ln(5); $pdf->SetFont('Arial','',12); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Vertragsart: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, getRegistrationType($data->contracttype), 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Beginn ab: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->registrationFrom, 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Monatsbeitrag: ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, $data->rate, 0, 1); $pdf->Cell($leftmargin); $pdf->Cell($leftcolumnwidth, $columnheight, 'Anmeldung (einm.): ' , 0, 0); $pdf->Cell($fillcolumnwidth, $columnheight, "15,00" . chr(128) , 0, 1); return $pdf->Output('S'); } function getRegistrationType($contracttype) { if ($contracttype === 1) { return 'Flatrate'; } if ($contracttype === 2) { return 'Einzelkurs'; } if ($contracttype === 3) { return 'Breakdance'; } return 'Unbekannt'; } function getRegistrationDate() { $today = new DateTime(); $currentYear = $today->format('Y'); $currentMonth = $today->format('m'); $currentDate = $today->format('d'); if ($currentDate === 1) { return new DateTime("$currentYear-$currentMonth-01"); // Today is the 1st of the month. } elseif ($currentDate <= 20) { return new DateTime("$currentYear-$currentMonth-15"); // Return the 15th of the current month. } else { $nextMonth = $today->modify('first day of next month'); // Advance to the first day of the next month. return $nextMonth; } } function getRegistrationPrice($input_birthday, $input_contracttype) { // Convert input to DateTime object try { $birthdate = new DateTime($input_birthday); } catch (Exception $e) { return 0; // Return 0 if the birthdate is invalid } $currentDate = new DateTime(); $monthDifference = $currentDate->format('m') - $birthdate->format('m'); $age = $currentDate->format('Y') - $birthdate->format('Y'); // Adjust age if the birthdate hasn't occurred yet this year if ($monthDifference < 0 || ($monthDifference == 0 && $currentDate->format('d') < $birthdate->format('d'))) { $age--; } if ($input_contracttype === 2) { return 40; } if ($input_contracttype === 3) { return 45; } if ($age >= 4 && $age <= 6) { return 40; } elseif ($age >= 7 && $age <= 17) { return 50; } elseif ($age >= 18) { return 60; } else { return 0; } } function sendRegistrationMail($data) { $to = REGISTRATION_MAIL; $title = 'Neue Anmeldung bei Li-Dance'; $message = " Neue Anmeldung bei Li-Dance

{$data->firstname} {$data->lastname} aus {$data->city} hat sich angemeldet.

Btte bearbeite diese möglichst schnell: Zur Anmeldung

"; $header[] = 'MIME-Version: 1.0'; $header[] = 'Content-type: text/html; charset=iso-8859-1'; $header[] = 'To: ' . REGISTRATION_MAIL; $header[] = 'From: ' . REGISTRATION_FROM; $header[] = 'X-Mailer: PHP/' . phpversion(); mb_send_mail($to, $title, $message, implode("\r\n", $header)); } function sendConfirmationMail($data) { $to = "{$data->email}"; // addresses to email pdf to $from = REGISTRATION_FROM; // address message is sent from $subject = "Registrierungsbestätigung!"; // email subject $body = "

Herzlich willkommen bei Li-Dance!

" . "

Hallo {$data->firstname} {$data->lastname}!

" . "

Sie haben sich nun bei der Tanz- und Sportschule Li-Dance registriert. Im Anhang finden Sie Ihre Registrierungsbestätigung.

". "
" . "

Wenn Sie sich nicht registrieren wollten, melden Sie sich bitte unverzüglich bei uns, wir werden das Problem dann gemeinsam mit Ihnen klären.

" . "

Dies ist eine automatisch generierte E-Mail

" . "

" . "

Tanz- und Sportschule Li-Dance" . "
Inh. Lydia Kolepp" . "
Dieselstr. 10" . "
61231 Bad Nauheim" . "
Tel. 06032 7848644" . "
Mail info@li-dance.de

"; // email body $pdfLocation = $data->pdfcontent; // file location $pdfName = $data->pdfname; // pdf file name recipient will get $filetype = "application/pdf"; // type // create headers and mime boundry $eol = PHP_EOL; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers = "From: $from$eol" . "MIME-Version: 1.0$eol" . "Content-Type: multipart/mixed;$eol" . " boundary=\"$mime_boundary\""; // add html message body $message = "--$mime_boundary$eol" . "Content-Type: text/html; charset=\"iso-8859-1\"$eol" . "Content-Transfer-Encoding: 7bit$eol$eol" . $body . $eol; // fetch pdf $pdf = chunk_split(base64_encode($data->pdfcontent)); // attach pdf to email $message .= "--$mime_boundary$eol" . "Content-Type: $filetype;$eol" . " name=\"$pdfName\"$eol" . "Content-Disposition: attachment;$eol" . " filename=\"$pdfName\"$eol" . "Content-Transfer-Encoding: base64$eol$eol" . $pdf . $eol . "--$mime_boundary--"; // Send the email return mail($to, $subject, $message, $headers); } ?>