Current File : /home/inlingua/public_html/faridabad/icentex/admin_fd/pre-certificates-single.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");
require_once('../tcpdf/config/lang/eng.php');
require_once('../tcpdf/tcpdf.php');
$c_level=$_REQUEST['c_level'];
$courseId=$_REQUEST['courseId'];
$student_recNo=$_REQUEST['student_recNo'];
$query="select a.*, s.studentName,s.ref_No,s.course_type from $c_level a left join ingl_student s on s.recNo=a.student_recNo where a.courseId='$courseId' and a.student_recNo='$student_recNo'";
$result=mysqli_query($conn,$query);
$num=mysqli_fetch_array($result);
$queryins="select signature,name from timesheet_user where recNo='".$num['createdBy']."' ";
$resinss=mysqli_query($conn,$queryins);
$instructor=mysqli_fetch_array($resinss);
$sign=$instructor['signature'];
// 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);
}
}
$certificate='Certificate Of: '.$num['level'].' '.$num['studentName'];
$string=$num['student_recNo'].'-'.$num['courseId'].'-'.$num['level'].'-'.$num['studentName'];
// 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($certificate);
$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, '115', 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,mid_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);
if($num['course_type']=='part1'){
$toDate=$numCourse['mid_enddate'];
$fromDate=$numCourse['startdate'];
}
else if($num['course_type']=='part2'){
$fromDate=$numCourse['mid_enddate'];
$toDate=$numCourse['enddate'];
}
else {
$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]));
$newlevel=explode('-',$numCourse['level']);
if($newlevel[1]=='Basic Proficiency'){
$Basic = array('part1' => 'English 1 Step 1', 'part2' => 'English 1 Step 2', 'complete' => 'Basic Proficiency');
$coursetitle=$Basic[$num['course_type']];
}
if($newlevel[1]=='Pre Intermediate Proficiency'){
$PreIntermediate = array('part1' => 'English 1 Step 2', 'part2' => 'English 2 Step 1', 'complete' => 'Pre-Intermediate Proficiency');
$coursetitle=$PreIntermediate[$num['course_type']];
}
if($newlevel[1]=='Pre-Intermediate Proficiency'){
$PreIntermediate = array('part1' => 'English 1 Step 2', 'part2' => 'English 2 Step 1', 'complete' => 'Pre-Intermediate Proficiency');
$coursetitle=$PreIntermediate[$num['course_type']];
}
if($newlevel[1]=='Intermediate Proficiency'){
$IntermediateProficiency = array('part1' => 'English 2 Step 1', 'part2' => 'English 2 Step 2', 'complete' => 'Intermediate Proficiency');
$coursetitle=$IntermediateProficiency[$num['course_type']];
}
if($newlevel[1]=='Pre-Advanced Proficiency'){
$PreAdvanced = array('part1' => 'English 2 Step 2', 'part2' => 'English 3 Step 1', 'complete' => 'Pre-Advanced Proficiency');
$coursetitle=$PreAdvanced[$num['course_type']];
}
if($newlevel[1]=='Advanced proficiency'){
$Advancedproficiency = array('part1' => 'English 3 Step 1', 'part2' => 'English 3 Step 1', 'complete' => 'Advanced proficiency');
$coursetitle=$Advancedproficiency[$num['course_type']];
}
$content="";
$content.='<div style="padding-bottom:10px;">';
$content.='<table border="0" width="100%">';
$content.='<tr><td valign="center" align="center"><em><u>'.$coursetitle.' General English Language Course</u></em></td></tr>';
$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 ".$coursetitle." course on the above dates and can communicate effectively in ".$numCourse['language']." at this level.";
$status='';
$content.='<tr><td align="center" width="100%" style="text-align:center;font-size:20;">'.$cer_comment.'</td></tr>';
}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.";
$cer_comment="Attended the ".$coursetitle." course on the above dates.<br>";
$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>';
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
$content.="<tr><td> </td></tr>";
if($num['eligibility']=='Yes')
{}else {
//$content.="<tr><td> </td></tr>";
}
$content.='</table>';
$url='../signature/'.$sign;
if(file_exists($url) && $sign !='') {
$image='../signature/'.$sign;
$img='<img src="'.$image.'">';
}else {
$img='';
}
$content.='</div>';
$content.='<div>
<table width="100%">
<tr ><td align="center" ></td><td align="center" style="margin-top:30px;">
'.$img.'</td>
<td style="font-weight:bold;margin:20px;text-align:right;"><br/><br/>'.$tdate1.'</td></tr>';
$content.='</table></div>';
//echo $content; exit;
// add a page
// add a page
$pdf->AddPage();
// Print a text
$html = $content;
//echo $html; exit;
$pdf->writeHTML($html, true, false, true, false, '');
$nstring = str_replace("-", " ", $string).'.pdf';
// add a page
//$pdf->AddPage();
// Print a text
//$html = '<span style="background-color:yellow;color:blue;"> PAGE 2 </span>';
//$pdf->writeHTML($html, true, false, true, false, '');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output($nstring, 'I');
//============================================================+
// END OF FILE
//============================================================+
?>