Current File : /home/inlingua/public_html/noida/icentex/pg/print_result.php |
<?php
error_reporting(0);
session_start();
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
//require_once('amount.php');
include_once("wordsClass.php");
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
?>
<?php
require_once('../../tcpdf/config/lang/eng.php');
require_once('../../tcpdf/tcpdf.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$sqlQuery = "SELECT a.*,b.firstName,b.lastName,b.ref_No,c.category FROM ingl_test_answer a left join ingl_admission b on a.student_id=b.recNo left join ingl_test_category c on b.test_category=c.recNo where a.student_id='".$_REQUEST['sid']."'";
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
$objectData=$dbObject->SelectNext();
$answers=$objectData["answers"];
$ansarray=explode("~#",$answers);
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
/* public function Header() {
// Logo
$image_file = K_PATH_IMAGES.'logo_example.jpg';
$this->Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
$this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M');
}
*/
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-10);
// Set font
$this->SetFont('helvetica', 'I', 10);
// Page number
//$this->Line(0,12,80,12);
$this->Cell(0, 10, 'Regd Office :A- 95, Sector - 65, Noida - 201305 (U.P.)', 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
// 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('pispltd');
$pdf->SetTitle('pispltd');
$pdf->SetSubject('pispltd');
$pdf->SetKeywords('pispltd soft');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(true);
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins('10', '10', '10');
//set auto page breaks
//$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->SetAutoPageBreak(TRUE, -5);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$email=", ".$numA['email']."";
$pdf->SetFont('Helvetica', '', 10);
$content="";
$content.='
<table border="0" width="100%">
<tr><td width="100%" align="center" style="font-size:60px;"><u><b>Result Of '.$objectData['firstName'].' '.$objectData['lastName'].' ('.$objectData['ref_No'].')</b></u></td></tr>
</table>';
$content.='<table></tr><td><b>Test : '.$objectData['category'].'</b></td></tr></table>';
$content.='<table width="100%" border="1" style="padding:2px;">
<tr><td colspan="8" width="93%">Answers</td><td width="7%">Total</td></tr>';
$answers_array=array();
for($i=1;$i<=96;$i=$i+8)
{
$content.='<tr>';
$c=0;
for($j=1;$j<=8;$j++)
{
$k=$i+$j-2;
$ans=$ansarray[$k];
$an=explode("-",$ans);
$color="#E6738E";
$sign=wrongmark();
if($an[3]=="R")
{
$color="#C7DEA0";
$c++;
$sign=tickmark();
}
$ansA="";
$ansB="";
$ansC="";
$ansD="";
if($an[2]=="1")
{
$ansA="#C7DEA0";
}
if($an[2]=="2")
{
$ansB="#C7DEA0";
}
if($an[2]=="3")
{
$ansC="#C7DEA0";
}
if($an[2]=="4")
{
$ansD="#C7DEA0";
}
if($an[1]=="1")
{
$ansA="blue";
}
if($an[1]=="2")
{
$ansB="blue";
}
if($an[1]=="3")
{
$ansC="blue";
}
if($an[1]=="4")
{
$ansD="blue";
}
$content.='<td><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td style="color:'.$ansA.'">A</td>
<td style="color:'.$ansB.'" >B</td>
<td style="color:'.$ansC.'">C</td>
<td style="color:'.$ansD.'">D</td>
<td style="background-color:'.$color.'" align="center">'.$sign.'</td></tr></table></td>';
}
$content.='<td>'.$c.'</td>';
$content.='</tr>';
$answers_array[]=$c;
}
$content.='</table>';
foreach($answers_array as $key=>$val)
{
if($val>4)
{
$final=$key;
}
if($val==4)
{
$final=$key;
break;
}
if($val<4)
{
$final=$key-1;
break;
}
}
$array_level=array(
"0"=>array("CEF Levels"=>"",
"inlingua Levels"=>"1",
"Units"=>"01-10",
"Questions"=>"1-8"
),
"1"=>array("CEF Levels"=>"A1",
"inlingua Levels"=>"1",
"Units"=>"11-20",
"Questions"=>"9-16"
),
"2"=>array("CEF Levels"=>"A2",
"inlingua Levels"=>"1",
"Units"=>"21-30",
"Questions"=>"17-24"
),
"3"=>array("CEF Levels"=>"",
"inlingua Levels"=>"2",
"Units"=>"01-10",
"Questions"=>"25-32"
),
"4"=>array("CEF Levels"=>"",
"inlingua Levels"=>"2",
"Units"=>"11-20",
"Questions"=>"33-40"
),
"5"=>array("CEF Levels"=>"B1",
"inlingua Levels"=>"2",
"Units"=>"11-20",
"Questions"=>"33-40"
),
"6"=>array("CEF Levels"=>"",
"inlingua Levels"=>"3",
"Units"=>"01-10",
"Questions"=>"49-56"
),
"7"=>array("CEF Levels"=>"",
"inlingua Levels"=>"3",
"Units"=>"11-20",
"Questions"=>"57-64"
),
"8"=>array("CEF Levels"=>"B2",
"inlingua Levels"=>"3",
"Units"=>"21-30",
"Questions"=>"65-72"
),
"9"=>array("CEF Levels"=>"",
"inlingua Levels"=>"4",
"Units"=>"01-10",
"Questions"=>"73-80"
),
"10"=>array("CEF Levels"=>"",
"inlingua Levels"=>"4",
"Units"=>"11-20",
"Questions"=>"81-88"
),
"11"=>array("CEF Levels"=>"C1",
"inlingua Levels"=>"4",
"Units"=>"21-30",
"Questions"=>"89-96"
),
);
if($final<0)
{
$final=0;
}
$final;
$content.='<br>
<table width="100%" style="padding:2px;">
';
$content.='<tr style="font-weight:bold;background-color:#cccccc;"> <td>Current Level</td>
<td align="center">CEF Level</td>
<td align="center">Placement Test Evaluation</td>
<td align="center">Line</td>
</tr>';
$k=11;
foreach(array_reverse($answers_array) as $key=>$val)
{
$lvl=$array_level[$k]['CEF Levels'];
$content.='<tr>';
$content.='<td align="center">';
if($final==$k)
{
$content.='<img src="images/arrow.png" style="height:15px;width:90px;">';
}
$content.='</td>';
$content.='<td align="center">'.$lvl.'</td><td>';
$content.='<table cellspacing="0" cellpadding="0" width="100%">';
$content.='<tr>';
for($i=1;$i<=8;$i++)
{
$k1=8-$val;
$color="";
if($i>$k1)
{
$color="blue";
}
$content.='<td style="background-color:'.$color.';border:1px solid #cccccc;"> </td>';
}
$content.='</tr>';
$content.='</table>';
$content.='</td>';
$k2=$k+1;
$content.='<td align="center">Line '.$k2.'</td>';
$content.='</tr>';
$k--;
}
$content.='</table>
<br>
<h5>Placement Rules:</h5>
<ul>
<li><b>The learner is placed when, for the first time, he/she answers only 4 questions correctly out of a
series of 8 questions.</b></li>
<li><b>Exception: if in the following series of 8 questions the learner answers more than 4 correctly, he/
she is placed the second time he/she answers only 4 correctly.</b></li>
</ul>
<br>
';
/*
$content.='<table><tr><td height="20"></td></tr></table>
<table border="0" width="100%">
<tr><td width="100%" align="center" style="font-size:30px;"><u><b>Regd Office :</b>A- 95, Sector - 65, Noida - 201305 (U.P.)</u></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);
/*$pdf->AddPage();
$content1="";
$content1.="<table width='100%'><tr><td width='100%' align='center'>Details Of Rolls</td></tr></table>";
$content1.="<table width='100%'>";
$content1.="<tr><td>Roll Id</td><td>Product</td><td>Quantity</td></tr>";
foreach($sub_roll as $key=>$val)
{
$queryRollDetails="select * from jumbo_roll_sub where recNo='".$val."'";
$resultRollDetails=mysqli_query($conn,$queryRollDetails);
$numRollDetails=mysqli_fetch_array($resultRollDetails);
$content1.="<tr><td>".$numRollDetails['jrNo']."</td><td> </td><td>".$numRollDetails['quantity']."</td></tr>";
}
$content1.="</table>";
//$pdf->SetMargins('10', '10', '10');
// set some text to print
$html = <<<EOD
$content1
EOD;
$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true);
*/
$pdf->Output('pispltd_'.$num['po_id'].'.pdf', 'I');
function tickmark()
{
$pdf1=new TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,true,'UTF-8',false);
$chr =$pdf1->unichr(52);
return '<span style="font-family:zapfdingbats;">'.$chr.'</span>';
}
function wrongmark()
{
$pdf1=new TCPDF(PDF_PAGE_ORIENTATION,PDF_UNIT,PDF_PAGE_FORMAT,true,'UTF-8',false);
$chr =$pdf1->unichr(53);
return '<span style="font-family:zapfdingbats;">'.$chr.'</span>';
}
?>