<?php
/* ******************************************************
    Sertifikat TOEFL Kursus
    Created By: ardiansyah@fmipa.unila.ac.id
    Created Date: 29/03/2020
    Last Edit: 03/04/2020
    
    ***************************************************** */
    
include "header.php";


$spasi = 5;

$pdf = new PDF('P', 'mm', 'A4');

$pdf->setBgSertifikat('../images/sertifikat-toefl-kursus.jpg', 0);

$pdf->SetLeftMargin(30);
$pdf->SetTopMargin(70);
$pdf->AddFont('MonotypeCorsiva', '', 'MonotypeCorsiva.php');
$pdf->AddFont('ComicSans', '', 'COMIC.php');
$pdf->AddFont('Script', '', 'SCRIPTBL.php');

$pdf->AddPage();

$pdf->SetFont('MonotypeCorsiva', 'U', 20);
$pdf->Cell(150, 8, 'CERTIFICATE', 0, 1, 'C');

$pdf->SetFont('', '', 11);
$pdf->Cell(150, $spasi, 'Number: '.$sertifikat_number, 0, 1, 'C');

$pdf->Ln();
$pdf->SetFont('ComicSans', '', 11);
$pdf->Cell(150, $spasi, 'This is to certify that', 0, 1, 'C');

$pdf->Ln();
$pdf->SetFont('Script', '', 20);
$pdf->Cell(150, $spasi+2, $nama, 0, 1, 'C');

$pdf->Ln();
$pdf->SetFont('ComicSans', '', 11);
$pdf->MultiCell(150, $spasi, 'Has successfully completed a 24-hour Intensive English Course at The Language Center University of Lampung', 0, 'J');

$pdf->Ln();
$pdf->Write($spasi, 'NPM');
$pdf->SetX(80);
$pdf->Write($spasi, ':');
$pdf->SetX(83);
$pdf->Write($spasi, $ID);
$pdf->Ln();

$pdf->Write($spasi, 'Date of Birth');
$pdf->SetX(80);
$pdf->Write($spasi, ':');
$pdf->SetX(83);

if(strpos($tgl_lahir, '/')  == true)
{
    $birth_date = $tgl_lahir;
}
else
{
    $unix_date = ($tgl_lahir - 25569) * 86400;
    $birth_date = gmdate("d/m/Y", $unix_date);
}
$pdf->Write($spasi, $birth_date);
$pdf->Ln();

$pdf->Write($spasi, 'Test Date');
$pdf->SetX(80);
$pdf->Write($spasi, ':');
$pdf->SetX(83);
$pdf->SetFont('MonotypeCorsiva', '', 15);
$pdf->Write($spasi, date_format($date_tes, "F j"));
$pdf->SubWrite($spasi, ordinal(date_format($date_tes, "j")),'', 10, 4);
$pdf->Write($spasi, ', '. date_format($date_tes, "Y"));
$pdf->Ln();

$pdf->SetFont('ComicSans', '', 11);
$pdf->Write($spasi, 'Scaled Scores');
$pdf->SetX(80);
$pdf->Write($spasi, ':');
$pdf->Ln();

$pdf->SetX(50);
$pdf->Write($spasi, '* Listening Comprehension');
$pdf->SetX(120);
$pdf->Write($spasi, ':');
$pdf->SetX(123);
$pdf->Write($spasi, strtoupper($lis));
$pdf->Ln();

$pdf->SetX(50);
$pdf->Write($spasi, '* Structure and Written Expression');
$pdf->SetX(120);
$pdf->Write($spasi, ':');
$pdf->SetX(123);
$pdf->Write($spasi, strtoupper($str));
$pdf->Ln();

$pdf->SetX(50);
$pdf->Write($spasi, '* Reading Comprehension');
$pdf->SetX(120);
$pdf->Write($spasi, ':');
$pdf->SetX(123);
$pdf->Write($spasi, strtoupper($rv));
$pdf->Ln();

$pdf->SetX(70);
$pdf->Write($spasi, 'Total Score');
$pdf->SetX(120);
$pdf->Write($spasi, ':');
$pdf->SetX(123);
$pdf->Write($spasi, $skor);
$pdf->Ln(8);

$pdf->MultiCell(150, $spasi, 'In recognition of the completion, this certificate is awarded by The Language Center University of Lampung', 0, 'J');

$pdf->Ln();
$pdf->SetFont('MonotypeCorsiva', '', 10);
$pdf->MultiCell(150, $spasi-1, '* This test is an English Proficiency Test (EPT) and administrated by Language Center Univerisity of Lampung.' , 0, 'J');
$pdf->MultiCell(150, $spasi-1, '* It is not endorsed by the Educational Testing Service.' , 0, 'J');
$pdf->MultiCell(150, $spasi-1, '* Certificate is Valid for one year after issued date.' , 0, 'J');
$pdf->MultiCell(150, $spasi-1, '* This Certificated is Valid for graduation requirements.' , 0, 'J');

$pdf->Ln(12);
$pdf->SetX(110);
$qrY = $pdf->GetY();
$pdf->SetFont('ComicSans', '', 11);
$pdf->Write($spasi, 'Bandar Lampung, ');
$pdf->SetFont('MonotypeCorsiva', '', 15);
$pdf->Write($spasi, date_format($date_ttd, "F j"));
$pdf->SubWrite($spasi,ordinal(date_format($date_ttd, "j")),'', 10, 4);
$pdf->Write($spasi, ' '.date_format($date_ttd, "Y"));

$pdf->Ln();
$pdf->SetX(110);
$pdf->SetFont('ComicSans', '', 11);
$pdf->Write($spasi, 'Head, ');

$pdf->Ln();
$pdf->Image('../images/ttd-pak-kirlan.png', 110, $pdf->GetY(), 50);


$pdf->Ln(13);
$pdf->SetX(110);
$pdf->Write($spasi, $nama_ka_upt);

$pdf->Ln();
$pdf->SetX(110);
$pdf->Write($spasi, 'NIP '.$nip_ka_upt);

$pdf->SetAlpha(0.75);
$pdf->Image('../images/cap-upt-bahasa.png', 90, $pdf->GetY()-32, 45);
$pdf->SetAlpha(1);



$pdf->Image('../images/qrcode/'.$ID.".png", 30, $qrY, 40);
$dt_ts2 = date_format($date_tes, "Y-m-d");
if($dt_ts2 < '2021-04-01') {
$pdf->Image('../images/paraf-kasubag.png', 162, $pdf->GetY(), 2.5);
}

$pdf->Output('I', 'eSertifikatTOEFL-'.$ID.".pdf");

?>