Current File : /home/inlingua/www/icentex/certificate_2_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');
$query="select a.*, s.studentName,s.ref_No from level_2 a left join ingl_student s on s.recNo=a.student_recNo where a.courseId='$_SESSION[courseId]'";
$result=mysql_query($query);
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Inlingua');
$pdf->SetTitle('Inlingua');
$pdf->SetSubject('Inlingua');
$pdf->SetKeywords('Inlingua Certificates');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins('30', '70', '30');
//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
while($num=mysql_fetch_array($result))
{
$queryCourse="select courseid,startdate,enddate,language,level from ingl_course where courseid='".$num[courseId]."'";
$resultCourse=mysql_query($queryCourse) or die("Error:There is some ploblem");
$numCourse=mysql_fetch_array($resultCourse);
$pdf->SetFont('times', '', 11);
$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="";
$content.='<table border="0" width="100%"><tr><td valign="center" align="center"><em><u>'.$numCourse[level].' General English Language Course</u></em></td></tr>';
/* <p align="center"><em><u>8<sup>th</sup> February – 22<sup>nd</sup> November 2010</u></em></p>*/
$content.='<tr><td align="center"><em><u> '.$fdate1.' – '.$tdate1.' </u></em></td></tr><tr><td> </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=mysql_query($queryg) or die("Error:There is some ploblem");
$g=mysql_fetch_array($resultg);
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 ".$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> </td></tr>";
$content.="<tr><td> </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> </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></table>';
//echo $content; exit;
// add a page
$pdf->AddPage();
// set some text to print
$html = <<<EOD
$content
EOD;
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
}
// print a block of text using Write()
//$pdf->Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_002.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
?>