<?php
include("../session.php");
include("../connect.php");

$user=$_GET["user"];
//echo "admin success!!!";
				
?>
<html>
<head>
<link href="header.css" rel="stylesheet" type="text/css"/>
<link type="text/css" rel="stylesheet" href="overflow.css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript"> 
$(document).ready(function(){
$(".flip").click(function(){
    $(".panel").slideToggle("slow");
  });
/*$(".flip2").click(function(){
    $(".panel2").slideToggle("slow");
  });
$(".flip3").click(function(){
    $(".panel3").slideToggle("slow");
  });*/
});
</script>
</head>
<body onload="updateClock(); setInterval('updateClock()', 1000 )">
<!-----------------Outer table--------------->
<table align=left width=1200 border=0 cellspacing=10 cellpadding=3 class=outer >
<tr>
	<td colspan=2><h2>Easy Shop</h2></td>
	</tr>
<tr>
	<td colspan=2>
	<div class=main>&nbsp;&nbsp;>>
			<a href="<?php echo"admin.php?user=$user";?>">&nbsp;Home&nbsp;</a>>>
			<a href="<?php echo"editHistory.php?user=$user";?>">&nbsp;Edit reports&nbsp;</a>
			</div></td>
	</tr>
<tr>
	<td valign=top colspan=2>
	<!--------------------Inner table 2----------------------->
	<table class=corners cellspacing=1 cellpadding=10 width=98% align=right>
	<tr>
		<td>
		
	<?php
	//set pages per items
	$per_page = 10;
	
	$query1=mysql_query("SELECT * from editreport");

	$total=ceil(mysql_num_rows($query1)/$per_page);

	$page =(isset($_GET['page'])) ? (int) $_GET['page'] :1;
	$start=($page-1)*$per_page;
	

	//display pages
	echo "<table align=center width='80%'>";
	echo "<tr class=page><td width='10%'>Pages >></td><td>";
	//while loop page
	while($i<=$total){
		echo "<a href='editHistory.php?page=$i&user=$user' align=center>$i</a>&nbsp ";
		$i++;
	}
	echo "</td></tr>";
	echo "</table>";
	echo "<br/>";
?>	
	<table align=center width=100% cellspacing=3 cellpadding=8>
		<tr class=menu>
			<th>Record ID</th>
			<th width="200">Time</th>
			<th>Record</th>
			</tr>
<?php
	//load company info	
	$query=mysql_query("select * from editreport order by recordID asc limit $start,$per_page");
	while($display=mysql_fetch_array($query)){
		
	$idid=$display['recordID'];
	$cc=$display['companyID'];
	$field=$display['editField'];
	$old=$display['old'];
	$new=$display['new'];
	$date=$display['date'];
	$time=$display['time'];
	
	date_default_timezone_set ("Singapore"); 
	$ldate=date("d/m/Y", time());
	
	echo "<tr class=menu2>";
	echo "<td align=center>".$idid."</td>";
	echo "<td align=center>".$date."&nbsp;&nbsp;&nbsp;".$time."</td>";
	echo "<td align=left>Company <b>".$cc."</b> 
		field of <b>".$field."</b> has been edited from <b>".$old."</b> to <b>".$new."</b>.</td>";
	echo "</tr>";
	}
	
	?>	
	</table>
			
		</td>
		</tr>
	</table>
	<!----------------------End inner table 2-------------------->
	
	</td>
	</tr>
</table>
<!-----------------------End outer table-------------------------->




</body>
</html>