Current File : /home/inlingua/www/dwarka/icentex/certificates-new.php
<?php
session_start();
//print_r($_SESSION);
require('dbConnection.php');

// Include common functions
require('commonFunc.php');

// Include common functions
require('globalVars.php');
require('dbHandler.class.php');
$dbObject = new dbHandler();
$dbObject->connect();
//ob_start();
//include("header.php");
?>
<?php
require_once('tcpdf/config/lang/eng.php');
require_once('tcpdf/tcpdf.php');

   echo $query="select a.*, s.studentName,s.ref_No from $_SESSION[c_level] a left join ingl_student s on  s.recNo=a.student_recNo where a.courseId='$_SESSION[courseId]' limit 0,1";

$result=mysqli_query($conn,$query);

// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
	//Page header
	public function Header() {
	$img_file = 'http://www.inlinguanewdelhi.in/icentex/certificate-with-signature.jpg';	
		// full background image
		// store current auto-page-break status
		$bMargin = $this->getBreakMargin();
		$auto_page_break = $this->AutoPageBreak;
		$this->SetAutoPageBreak(false, 0);
		//$img_file = K_PATH_IMAGES.'image_demo.jpg';
		$this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
		// restore auto-page-break status
		//$this->SetAutoPageBreak($auto_page_break, $bMargin);
	}
}

// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 051');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');

// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, '90', PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);

// remove default footer
$pdf->setPrintFooter(false);

//set auto page breaks
//$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

// set font
$pdf->SetFont('times', '', 12);
// ---------------------------------------------------------

//while($num=mysqli_fetch_array($result))


$queryCourse="select courseid,startdate,enddate,language,level from ingl_course where courseid='".$num[courseId]."'";
$resultCourse=mysqli_query($conn,$queryCourse) or die("Error:There is some ploblem");
$numCourse=mysqli_fetch_array($resultCourse);



$fromDate=$numCourse[startdate];
$toDate=$numCourse[enddate];
$fromdate1=explode("-",$fromDate);
$todate1=explode("-",$toDate);
$fdate1= date("d F Y", mktime(0, 0, 0, $fromdate1[1], $fromdate1[2], $fromdate1[0]));
$tdate1= date("d F Y", mktime(0, 0, 0, $todate1[1], $todate1[2], $todate1[0]));

$content="";
$numCourse['level']='E3S1';

$content.='<div>';
$content.='<table border="0" width="100%">';


$content.='<tr><td valign="center" align="center"><em><u>'.$numCourse['level'].' General English Language Course</u></em></td></tr>';
	
 
   $fdate1='26 Dec. 2015'; 
   $tdate1='29 jan 2016';
   $num['studentName']='Abdullah Ansari';
   $num['eligibility']='Yes';
   $numCourse['level']='E3S1';
   $numCourse['language']='English';
   $num['overall_grade']='Good';
   $num['eligibility']='Yes';

   $content.='<tr><td align="center"><em><u> '.$fdate1.' &ndash; '.$tdate1.' </u></em></td></tr><tr><td>&nbsp;</td></tr>';
	
	$content.='<tr><td align="center" width="100%" style="text-align:center;font-size:20;">This is to certify that </td></tr>';
	$content.='<tr><td align="center" width="100%" style="text-align:center;font-size:24;font-family: Monotype Corsiva;"><strong>'.ucfirst($num['studentName']).'</strong></td></tr>';
	
	if($num['eligibility']=='Yes')
{
$cer_comment="successfully completed the ".$numCourse['level']." course on the above dates and can communicate effectively in ".$numCourse['language']." at this level.";	
$status='';	
}else {
$queryg="select gender from ingl_admission where ref_No='".$num[ref_No]."'";
$resultg=mysqli_query($conn,$queryg) or die("Error:There is some ploblem");
$g=mysqli_fetch_array($resultg);
$g['gender']=='Male';
if($g['gender']=='Male')
{
$gender='he';	
}	
if($g['gender']=='Female')
{
$gender='she';	
}	
$cer_comment="attended the ".$numCourse['level']." course on the above dates. However, ". $gender." is unable to communicate effectively in ".$numCourse['language']." at this level.";	
}
$content.='<tr><td align="center" width="100%" style="text-align:center;font-size:20;">'.$cer_comment.'</td></tr>';
	 
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.='<tr><td style="padding:5px;"><table border="0"><tr><td width="25%" ></td><td width="24%" border="2" bgcolor="#FFFF66" align="center" style="height:50px; "><div style=" padding:30px;"><br><b>Overall Grade</b></div ></td><td width="20%"></td><td width="15%" border="2" bgcolor="#FFFF66" align="center" ><div style=" padding:30px;"><br><b >'.nl2br ($num['overall_grade']).'</b></div></td></tr></table></td></tr>';
$content.="<tr><td>&nbsp;</td></tr>";
$content.='<tr><td width="100%" style="text-align:center;font-size:14;"><b>Eligibility for the next level:</b> '.$num['eligibility'].'</td>'.'</tr>';
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";

$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";
$content.="<tr><td>&nbsp;</td></tr>";

$content.='</table>';
$content.='</div>';
$content.='<div>
<br/><br/>
<table width="100%">
<tr><td  align="center" ><br/><br/><br/><br/></td><td align="center"><br/><br/><img src="pyiyuhs-gupta.png" style="width:120px;height:60px;padding:20px;"></td>
<td style="font-weight:bold;margin:20px;text-align:right;"><br/><br/><br/><br/>28 March 2020</td></tr>';

$content.='</table></div>';

//echo $content; exit;
// add a page


// add a page
$pdf->AddPage();

// Print a text
echo $html = $content; exit;

$pdf->writeHTML($html, true, false, true, false, '');


// add a page
//$pdf->AddPage();

// Print a text
//$html = '<span style="background-color:yellow;color:blue;">&nbsp;PAGE 2&nbsp;</span>';
//$pdf->writeHTML($html, true, false, true, false, '');

// ---------------------------------------------------------

//Close and output PDF document
$pdf->Output('example_051.pdf', 'I');

//============================================================+
// END OF FILE                                                
//============================================================+

?>