Current File : /home/inlingua/public_html/noida/icentex_noida/indeed-test/ingl_test.select.php
<?php
//  Created on: 05-03-2013
ini_set('session.gc_maxlifetime',3*60*60);
session_start();
/*
$loggedUserNo = $_SESSION['loggedUserNo'];
if ($loggedUserNo == "")
{	echo "Please <a href='index.php'>login</a> first.";
	exit(0);
}
*/
include("check.php");
// Include header
include "header.php";
?>
<script>
javascript:window.history.forward(1);
</script>
<?php
$_REQUEST['sec']=2400;
if($_REQUEST['sec'])
	{
?>
<link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css"/>
<link href="css/main.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script> 
<script type="text/javascript" src="js/script.js"></script>

<script type="text/javascript">
//alert(<?php echo $_REQUEST['sec']; ?>*1000);
window.onload=function(){ 
    window.setTimeout(function() { document.getElementById("refSec").submit() }, <?php echo $_REQUEST['sec']; ?>*1000);
};
setprogress(<?php echo $_REQUEST['sec']; ?>);
</script>

	<?php 
	
	}

?>
<?php
echo"<center>";

if($_REQUEST['sec'])
	{
?>
 <div class="example" style="z-index:100;position:fixed;left:800px;right:50px;background-color:yellow;padding: 7px;font-weight:bold;">
<div id="progress3" >
<!--            <div class="percent"></div>
-->            <!--<div class="pbar"></div>-->
            <div class="elapsed"></div>
            <!--<div class="percent"></div>-->
        </div>
        </div><br><br>
 <?php
	}

echo"</center>";
?>
<br>
<div id="contentnew">

<?php if ($_SESSION['dispMesg'][1] != "" && (date("U") - $_SESSION['dispMesg'][0] < 7)) 
{ 	?>
	<span id='mesgSpan'><font color='#da0000'><?php echo $_SESSION['dispMesg'][1];?></font></span>
	<script>
	setTimeout(function() {   $('#mesgSpan').fadeOut('slow'); }, 4000); // <-- time in milliseconds 
	</script>
	<br>
	<?php
}
unset($_SESSION['dispMesg']);
?>



<?php
//print_r($_SESSION);
// 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();

// Records selection sql
$sqlQuery = "SELECT * FROM ingl_test where staus='Yes' && category_id='".$_SESSION['test']."'";

// Prepare page navigation
$resultsPerPage = 100; // number of rows to return per page
$offset=$_REQUEST['offset'];
// Prepare add on URL
$addOnUrl = "";
//$offset=$_REQUEST['offset'];
if ($resultsPerPage > 0)
{	$prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
	$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}


// Print navigation bar
function printArray($element) { echo "$element"; }

if ($resultsPerPage > 0 && $prev_next_links && count($prev_next_links) > 1)
{	//echo "Page: ";
	//array_walk($prev_next_links, 'printArray'); 
}

// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
?>
<form id="refSec" action="ingl_test_submit.php" method="post">
<table border='0' width="100%" style="font-size: 13px;">

<?php
// If no records selected, print message
if (!$selectedRecords)
{	?>
	<tr><td colspan='5'>There are no entries</td></tr> 
	<?php
}
$i=1;

$queryW="select * from ingl_test_answer where student_id='".$_SESSION['sid']."'";
$resultW=mysql_query($queryW);
$countW=mysql_num_rows($resultW);
$numW=mysql_fetch_array($resultW);

if($countW>0)
{
$_SESSION['wrongpass']="Already Attempted Test";
header("Location: index.php");
}


while($objectData=$dbObject->SelectNext())
{	?>
	<tr valign='top' onmouseover="this.className='pa-row-highlight'" onmouseout="this.className='pa-nor'">
	<td width="5%"><b><?php echo $i;?></b></td>
	<td><b><?php echo $objectData['question'];?></b></td>
	

	
	</tr>
	<tr>
		<td></td>
		<td>
		<table width="100%">
		<tr>
		<td width="25%"><!--A--><input type="radio" name="answer_<?php echo $objectData['recNo'];?>" value="1"> <?php echo $objectData['answer1'];?></td>
		<td  width="25%"><!--B --><input type="radio" name="answer_<?php echo $objectData['recNo'];?>"  value="2"> <?php echo $objectData['answer2'];?></td>
		<td  width="25%"><!--C --><input type="radio" name="answer_<?php echo $objectData['recNo'];?>" value="3"> <?php echo $objectData['answer3'];?></td>
		<td  width="25%"><!--D --><input type="radio" name="answer_<?php echo $objectData['recNo'];?>"  value="4"> <?php echo $objectData['answer4'];?></td>
		</tr>
		</td></table>
	</tr>
	<tr><td colspan="2">&nbsp;</td></tr>
	<?php
	$i++;
}
?>
<tr><td colspan="2"><input type="submit" value="Submit" ></td></tr>
</table>
</form>
<?php
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links  && count($prev_next_links) > 1)
{	//echo "Page: ";
	//array_walk($prev_next_links, 'printArray'); 
	//echo "<br>";
}
?>


<script type="text/javascript">
function confDel()
{	var agree = confirm("Click OK to delete permanently or cancel");
	if (agree)
		return true;
	else
		return false;
}
</script>
</div>

<center>



<?php 
$dbObject->CloseConnection();

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