Current File : /home/inlingua/public_html/dwarka/icentex/admin_fd/certificate_4.php
<?php
session_start();
if(in_array("fd",$_SESSION['allowed_modules']))
{
$allow="Yes";
}
else
{
$allow="No";
}

if($_SESSION['id']=="" || $allow!="Yes")
{
header("Location: ../index.php");
}
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');
if($_REQUEST[student])
{
 //$query="select * from level_2 where student_recNo='$_REQUEST[student]'";
 $query="select a.*, s.studentName from level_4 a left join ingl_student s on  s.recNo=a.student_recNo where a.student_recNo='$_REQUEST[student]'";
}
else
{
//$query="select * from level_2 where courseId='$_REQUEST[courseId]'";
$query="select a.*, s.studentName from level_4 a left join ingl_student s on  s.recNo=a.student_recNo where a.courseId='$_REQUEST[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('25', '70', '25');

//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);

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






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];

//$fromDate="2009-03-10";
//$toDate="2009-03-10";

$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>';
	
  
   
   $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;">'.$cer_comment.'<br></td></tr></table></td></tr>';
   
   $content.='<tr><td align="center" width="100%">
     <table align="left" border="1" cellspacing="0" cellpadding="0"><tr><td height="60"><table cellspacing="0" cellpadding="0"><tr><td  bgcolor="#FFFF66" width="30%" border="1">&nbsp;<b>Use of Structures</b></td><td></td></tr></table> <table  cellpadding="4" style="text-align:justify"><tr><td>'.nl2br (stripslashes ($num[useStructures])).'  </td></tr></table> </td></tr>
   
  <tr><td height="60"><table><tr><td  bgcolor="#FFFF66" width="30%" border="1">&nbsp;<b>Pronunciation and Fluency</b></td><td></td></tr></table> <table  cellpadding="4" style="text-align:justify"><tr><td>'.nl2br (stripslashes ($num[pronFluency])).' </td></tr></table></td></tr>
  <tr><td height="60"><table><tr><td  bgcolor="#FFFF66" width="30%" border="1">&nbsp;<b>Listening Skills</b></td><td></td></tr></table><table  cellpadding="4" style="text-align:justify"><tr><td>'.nl2br (stripslashes ($num[listening_skill])).' </td></tr></table></td></tr>
  <tr><td height="60"><table><tr><td  bgcolor="#FFFF66" width="30%" border="1">&nbsp;<b>Lexical Skills</b></td><td></td></tr></table><table  cellpadding="4" style="text-align:justify"><tr><td>'.nl2br (stripslashes ($num[lexical_skill])).' </td></tr></table></td></tr>
  <tr><td height="60"><table><tr><td  bgcolor="#FFFF66" width="30%" border="1">&nbsp;<b>Comments</b></td><td></td></tr></table><table  cellpadding="4" style="text-align:justify"><tr><td>'.nl2br (stripslashes ($num[general_comment])).' </td></tr></table></td></tr>
   
   </table>
   
   </td></tr>
   ';
   if($num[eligibility]=='Other')
				{
				$num[eligibility]=$num[othereligibility];
				}
			
			
			$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>';
			
   
   $content.="</table>";

/*$content1.='    
    <p align="center"><em><u>GPP'.$num[level].' General English Language Course</u></em></p> ';
	
   /* <p align="center"><em><u>8<sup>th</sup> February &ndash; 22<sup>nd</sup> November 2010</u></em></p>
   
   $content1.='<p align="center"><em><u> '.$fdate1.' &ndash; '.$tdate1.' </u></em></p>';
   
   
	
	$content1.='<table align="center" width="400" border="0"><tr><td width="15%"><img src="images/blank.png" height="92"></td><td valign="top">  
    <p>'.nl2br ($num[cerification_comment]).'</p></td><td width="15%"></td></tr></table> <br>';
	 
	 
$pdf->setXY(0,30);
$pdf->WriteHTML($content1);

$pdf->SetFillColor(255,255,102);	 
    $content.='<table border="0" width="100%"> 
         
        <tr> <td width="15%"><img src="images/blank.png" height="93"></td>
            <td border="1" valign="top" >.'.$pdf->setXY(44.1,84.0).''.$pdf->MultiCell(50,5,'Use of Structures',1,'C',true).'<br><b><i>'.nl2br ($num[useStructures]).'</i></b></td><td width="15%"></td> </tr> 
			
			<tr> <td width="15%"><img src="images/blank.png" height="92"></td>
            <td border="1" valign="top" >.'.$pdf->setXY(44.1,111.6).''.$pdf->MultiCell(50,5,'Pronunciation and Fluency',1,'C',true).'<br><b><i>'.nl2br ($num[pronFluency]).'</i></b></td><td width="15%"></td> </tr>
			
			<tr> <td width="15%"><img src="images/blank.png" height="93"></td>
            <td border="1" valign="top" >'.$pdf->setXY(44.1,139.0).'
 '.$pdf->MultiCell(50,5,'Listening Skills',1,'C',true).'.<br><b><i>'.nl2br ($num[listening_skill]).'</i></b></td><td width="15%"></td> </tr>
			
			<tr> <td width="15%"><img src="images/blank.png" height="92"></td>
            <td border="1" valign="top" > 
 '.$pdf->setXY(44.1,166.6).'
 '.$pdf->MultiCell(50,5,'Lexical Skills',1,'C',true).'.<br><b><i>'.nl2br ($num[lexical_skill]).'</i></b></td><td width="15%"></td> </tr>
			
			<tr> <td width="15%"><img src="images/blank.png" height="100"></td>
            <td border="1" valign="top" >'.$pdf->setXY(44.1,193.8).'
 '.$pdf->MultiCell(50,5,'Comments',1,'C',true).'.<br><b><i>'.nl2br ($num[general_comment]).'</i></b></td><td width="15%"></td> </tr>
         </table> '; 
				
				if($num[eligibility]=='Other')
				{
				$num[eligibility]=$num[othereligibility];
				}
				
				$content.="<table ><tr><td width='30%'></td><td width='15%' border='1' bgcolor='#FFFF66' align='center'>Overall Grade</td><td width='10%'></td><td width='15%' border='1' bgcolor='#FFFF66' align='center'><b>".nl2br ($num[overall_grade])."</b></td></tr></table><br>";
				
				$content.="<table border='0' ><tr><td width='15%'></td><td>Eligibility for the next level:</td><td width='33%'>".$num[eligibility]."</td><td>Course ID:</td><td>".$num[courseId]."</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);

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