Current File : /home/inlingua/public_html/noida/icentex/certificate_1.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 from level_1 a left join ingl_student s on  s.recNo=a.student_recNo where a.courseId='$_SESSION[courseId]'";
 
$result=mysqli_query($conn,$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=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);


$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>GPP'.$numCourse[level].' General English Language Course</u></em></td></tr>';
	
   /* <p align="center"><em><u>8<sup>th</sup> February &ndash; 22<sup>nd</sup> November 2010</u></em></p>*/
   
   $content.='<tr><td align="center"><em><u> '.$fdate1.' &ndash; '.$tdate1.' </u></em></td></tr><tr><td>&nbsp;</td></tr>';
	
	$cer_comment="This is to certify that <strong>".ucfirst($num[studentName])."</strong> completed the GPP".$numCourse[level]." course on the above dates and can communicate effectively in ".$numCourse[language]." at this level. General comments are shown below.";
	
	$content.='<tr><td align="center" width="100%"><table border="0"><tr><td style="text-align:justify;font-size:11;">'.nl2br ($cer_comment).'<br></td></tr></table></td></tr>
	 
    <tr><td align="center"><table border="0" width="100%"><tr><td width="10%"></td><td width="80%"><table border="1"  align="center" cellpadding="3"> 
        <tr >
            <td  align="center" bgcolor="#FFFF66"> 
                <b>Listening and Speaking Skills</b></td></tr> 
        <tr> 
            <td valign="center" height="150" style="text-align:justify;font-size:13;">'.nl2br (stripslashes ($num[listening_skill])).'</td> </tr> 
        <tr> 
            <td bgcolor="#FFFF66" border="1" align="center"> 
                <b>General Comment and Advice for Future Study</b></td> </tr> 
        <tr> 
            <td border="1" valign="top" height="150"  style="text-align:justify;font-size:13;">'.nl2br (stripslashes ($num[general_comment])).'<br></td></tr> </table></td><td width="10%"></td></tr></table></td></tr> '; 
			
			$content.="<tr><td>&nbsp;</td></tr>";
				
				if($num[eligibility]=='Other')
				{
				$num[eligibility]=$num[othereligibility];
				}
				
				$content.='<tr><td><table border="0"><tr><td width="25%"></td><td width="18%" border="2" bgcolor="#FFFF66" align="center">Overall Grade</td><td width="20%"></td><td width="15%" border="2" bgcolor="#FFFF66" align="center"><b>'.nl2br ($num[overall_grade]).'</b></td></tr></table></td></tr>';

$content.="<tr><td>&nbsp;</td></tr>";
				
				$content.='<tr><td><table border="0" ><tr><td width="32%"><b>Eligibility for the next level:</b></td><td width="35%">'.$num[eligibility].'</td><td width="13%"><b>Course ID:</b></td><td>'.$numCourse[courseid].'</td></tr></table></td></tr></table>';


// 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                                                
//============================================================+

?>