<?php
require_once("./includes/initialize.php");
global $database;
// require_once("./includes/pdf_mc_table.php");
// include('pdf_mc_table.php');


date_default_timezone_set('Africa/Lagos');


$list_type = $_SESSION['pending'];
if (isset($list_type) && ($list_type=='certificate_pending')){
    
 $details= ONLINEPAY::find_other_certificate_details_pending();
 
 //print_r($details);  
}
 

 

class coursePDF extends PDF_MC_TABLE
{
     public $details;

	function Head()
	{
	   
		$this->Image('images/icon.png',10,15);
		$this->SetFont('Arial','B',14);
		$this->Cell(320,5,'OSUN STATE COLLEGE OF TECHNOLOGY, ESA-OKE.',0,1,'C');
		$this->Ln(8);
		$this->SetFont('Arial','B',12);
		$this->Cell(320,5,'P.M.B 1011, ESA-OKE, OSUN STATE.',0,1,'C');
		$this->Ln(8);
		$this->SetTextColor(255,0,0);
		$this->Cell(320,5,'Certificate Request: Pending List.',0,1,'C');
		$this->Ln(8);
		$this->SetTextColor(0,0,0);
	}
	function Background(){
          $this->Image('images/img2.png',0,0,210,300);
  }

	function footer()
	{
		$this->SetY(-20);
		$this->SetFont('Times','',10);
		$this->Cell(320,2,'Directorate of ICLSTS, Esa-Oke Copyright © 2018. All Rights Reserved.',0,0,'C');
		$this->Ln();
		$this->SetFont('Arial','',8);
		$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
	}
}


$pdf = new coursePDF('L','mm','A4');

$pdf->AliasNbPages();
$pdf->AddPage();//AddPage([string orientation [, mixed size [, int rotation]]])
$pdf->Head();
// $pdf->Background();
// $pdf->headerTable($depta, $level, $session,$fac, $table);
//$pdf->SetFont('Times','BU',14);

$pdf->Cell(270,10,'Printed Date: '.date('d/m/Y h:i a'),0,1,'R');
$pdf->SetFont('Arial','B',11);
//$pdf->Ln(20);
$pdf->SetFillColor(255,0,0);
$pdf->SetTextColor(255,255,255);
$pdf->SetWidths(Array(10,75,40,40,30,40,40));//width for each column
$pdf->SetAligns(Array('L','L','L','L','L','L','L'));
$pdf->SetLineHeight(5);//Height of text lines

$pdf->Cell(10,10,"S/N",1,0,'L',true);
$pdf->Cell(75,10,"FULL NAME",1,0,"L",true);
$pdf->Cell(40,10,"DEPARTMENT",1,0,"L",true);
$pdf->Cell(40,10,"PROGRAMME",1,0,"L",true);
$pdf->Cell(30,10,"CERTIFICATE",1,0,"L",true);
$pdf->Cell(40,10,"SESSION",1,0,"L",true);
$pdf->Cell(40,10,"APPLICATION DATE",1,1,"L",true);


$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',12);


foreach($details as $student)
{
    if ($student->level=='both'){
        $student->level='ND and HND';
    }else if($student->level=='nd'){
      $student->level='ND';
    }
    else if($student->level=='hnd'){
     $student->level='HND';
    }
    
    
    if ($student->ptype=='FT'){
        $student->ptype='Full Time';
    }
    else if ($student->ptype=='DP'){
         $student->ptype='Daily Part Time';
    }
    
    else if ($student->ptype=='PT'){
         $student->ptype='Part Time';
                   
    }
    else if ($student->ptype=='CAP'){
         $student->ptype='Continuous Academic Program';
         
    }
    else if ($student->ptype=='EAP'){
         $student->ptype='Evening Academic Program';
         
    }
    else if ($student->ptype=='certificate'){
         $student->ptype='Certificate';
         
    }
    
    if (isset($student->session)){
       $student->session= substr($student->session, -4);
    }
    
$pdf->Row(Array(
        ++$count,
        trim(ucwords(strtolower($student->fullname))),
        trim(ucwords($student->department)),
        trim($student->ptype),
         trim($student->level),
        trim($student->session),
        trim($student->datetime),
    ));
   
}

$pdf->Output();
?>