Current File : /home/inlingua/public_html/faridabad/icentex/admin_fd/result.php
<?php
//  Created on: 16-02-2013
session_start();
/*
$loggedUserNo = $_SESSION['loggedUserNo'];
if ($loggedUserNo == "")
{	echo "Please <a href='index.php'>login</a> first.";
	exit(0);
}
*/

// Include header
include "header_fd.php";
?>
<?php
// 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');

// 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);
//print_r($ansarray);


//print_r($ansarray);
?>
<h3>Result of <?php echo $objectData['firstName'] ?> <?php echo $objectData['lastName'] ?> (<?php echo $objectData['ref_No'] ?>) (<a href='print_result.php?sid=<?php echo $_REQUEST['sid'] ?>' target="_blank">Print</a>)</h3>

Test : <?php echo $objectData['category'] ?>
<table width="100%" border="1" cellspacing='0' cellpadding='0'>
    <tr><td colspan="8" width="93%">Answers</td><td width="7%">Total</td></tr>
<?php
$answers_array=array();
for($i=1;$i<=96;$i=$i+8)
{
    echo"<tr>";
    $c=0;
for($j=1;$j<=8;$j++)
{
    $k=$i+$j-2;
    $ans=$ansarray[$k];
    $an=explode("-",$ans);
    $color="#E6738E";
    $sign="&#10006;";
    if($an[3]=="R")
    {
        $color="#C7DEA0";
        $c++;
	$sign="&#10004;";
    }
    
    $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";
    }
    
    
    
    
    echo"<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>";
    
}
    echo"<td>".$c."</td>";
    echo"</tr>";
    $answers_array[]=$c;
}

?>
</table>

<?php
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;

//print_r($array_level[$final]);

?>
<br>
<table cellspacing='0' cellpadding='1' width="100%">
<?php
echo"<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'];
    
    
    
 echo"<tr>";
 
 echo"<td align='center'>";
 
 if($final==$k)
 {
    echo"<img src='images/arrow.png' style='height:15px;width:90px;'>";
 }
 echo"</td>";
 
 echo"<td  align='center'>".$lvl."</td><td>";

 echo"<table cellspacing='0' cellpadding='0' width='100%'>";
 
 echo"<tr>";
 for($i=1;$i<=8;$i++)
 {
    $k1=8-$val;
    $color="";
    if($i>$k1)
    {
	$color="blue";
    }
    echo"<td style='background-color:".$color.";border:1px solid #cccccc;'>&nbsp;</td>";
 }
 
 
 
 
 echo"</tr>";
 echo"</table>";
 echo"</td>";
 $k2=$k+1;
 echo"<td  align='center'>Line ".$k2."</td>";
 
 
 echo"</tr>";   
    
   $k--;  
}
?>
</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>
<?php
$queryOral="select * from ingl_test_oral where student_id='".$_REQUEST['sid']."'";
$resultOral=mysqli_query($conn,$queryOral);
$countOral=mysqli_num_rows($resultOral);
$numOral=mysqli_fetch_array($resultOral);


$queryA="select * from ingl_admission where recNo='".$_REQUEST['sid']."'";
$resultA=mysqli_query($conn,$queryA);
$countA=mysqli_num_rows($resultA);
$numA=mysqli_fetch_array($resultA);



$queryAnalysis="select * from ingl_admission_analysis where ingl_student='".$_REQUEST['sid']."'";
$resultAnalysis=mysqli_query($conn,$queryAnalysis);
$countAnalysis=mysqli_num_rows($resultAnalysis);
$numAnalysis=mysqli_fetch_array($resultAnalysis);

?>
<?php
if($countOral>0)
{
?>
<a href="ingl_test_oral.main.php?aC=sV&kV=<?php echo $numOral['recNo'] ?>">Oral Test</a>
<?php
}
else{
    ?>
    <a href="ingl_test_oral.main.php?sid=<?php echo $_REQUEST['sid']; ?>">Oral Test</a>
    <?php
}
?>

<?php
if($countAnalysis>0)
{
echo'<br><a href="ingl_admission_analysis.main.php?aC=sV&kV='.$numAnalysis['recNo'].'" style="color:green;">Need Analysis</a>';	
}
else{
echo'<br><a href="ingl_admission_analysis.main.php?sid='.$objectData['recNo'].'" style="color:red;">Need Analysis</a>';	
}
?>


<br>
    <h4>Final Results:</h4>
    <form method="post" action="result_update.php">
    <input type='hidden' name='recNo' value="<?php echo $_REQUEST['sid'] ?>">

<table cellpadding="10">
    <tr><td>Written Test Level</td><td>
	<select  name="written_test_level">
<option <?php if($numA['written_test_level']=='') echo"selected"; ?>  value="">Choose Level</option>
<option <?php if($numA['written_test_level']=='1A') echo"selected"; ?>  value="1A">1A</option>
<option <?php if($numA['written_test_level']=='1B') echo"selected"; ?> value="1B">1B</option>
<option <?php if($numA['written_test_level']=='1B+') echo"selected"; ?> value="1B+">1B+</option>
<option <?php if($numA['written_test_level']=='2A') echo"selected"; ?> value="2A">2A</option>
<option <?php if($numA['written_test_level']=='2A+') echo"selected"; ?> value="2A+">2A+</option>
<option <?php if($numA['written_test_level']=='2B') echo"selected"; ?> value="2B">2B</option>
<option <?php if($numA['written_test_level']=='3A') echo"selected"; ?> value="3A">3A</option>
<option <?php if($numA['written_test_level']=='3B') echo"selected"; ?> value="3B">3B</option>
<option <?php if($numA['written_test_level']=='4') echo"selected"; ?> value="4">4</option>
<option <?php if($numA['written_test_level']=='5') echo"selected"; ?> value="5">5</option>
<option <?php if($numA['written_test_level']=='Private') echo"selected"; ?> value="Private">Private</option>

</select>
	
    </td>
    <td rowspan="3" valign="bottom"><input type="submit"  value="Save>>"></td>
    </tr>
    <tr><td>Oral Test Level</td><td>
	
	<select  name="oral_test_level">
<option <?php if($numA['oral_test_level']=='') echo"selected"; ?>  value="">Choose Level</option>
<option <?php if($numA['oral_test_level']=='1A') echo"selected"; ?>  value="1A">1A</option>
<option <?php if($numA['oral_test_level']=='1B') echo"selected"; ?> value="1B">1B</option>
<option <?php if($numA['oral_test_level']=='1B+') echo"selected"; ?> value="1B+">1B+</option>
<option <?php if($numA['oral_test_level']=='2A') echo"selected"; ?> value="2A">2A</option>
<option <?php if($numA['oral_test_level']=='2A+') echo"selected"; ?> value="2A+">2A+</option>
<option <?php if($numA['oral_test_level']=='2B') echo"selected"; ?> value="2B">2B</option>
<option <?php if($numA['oral_test_level']=='3A') echo"selected"; ?> value="3A">3A</option>
<option <?php if($numA['oral_test_level']=='3B') echo"selected"; ?> value="3B">3B</option>
<option <?php if($numA['oral_test_level']=='4') echo"selected"; ?> value="4">4</option>
<option <?php if($numA['oral_test_level']=='5') echo"selected"; ?> value="5">5</option>
<option <?php if($numA['oral_test_level']=='Private') echo"selected"; ?> value="Private">Private</option>

</select>
    </td></tr>
    <tr><td>Final Level</td><td><select  name="final_level">
<option <?php if($numA['final_level']=='') echo"selected"; ?>  value="">Choose Level</option>
<option <?php if($numA['final_level']=='1A') echo"selected"; ?>  value="1A">1A</option>
<option <?php if($numA['final_level']=='1B') echo"selected"; ?> value="1B">1B</option>
<option <?php if($numA['final_level']=='1B+') echo"selected"; ?> value="1B+">1B+</option>
<option <?php if($numA['final_level']=='2A') echo"selected"; ?> value="2A">2A</option>
<option <?php if($numA['final_level']=='2A+') echo"selected"; ?> value="2A+">2A+</option>
<option <?php if($numA['final_level']=='2B') echo"selected"; ?> value="2B">2B</option>
<option <?php if($numA['final_level']=='3A') echo"selected"; ?> value="3A">3A</option>
<option <?php if($numA['final_level']=='3B') echo"selected"; ?> value="3B">3B</option>
<option <?php if($numA['final_level']=='4') echo"selected"; ?> value="4">4</option>
<option <?php if($numA['final_level']=='5') echo"selected"; ?> value="5">5</option>
<option <?php if($numA['final_level']=='Private') echo"selected"; ?> value="Private">Private</option>

</select></td></tr>
</table>
    </form>
<?php 
$dbObject->CloseConnection();

// Include footer
include "footer_fd.php";
?>