<?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>
<link rel="stylesheet" type="text/css" href="facebox/facebox.css" />
<script language="javascript" src="facebox/facebox.js"></script>
<script language="javascript">
$(document).ready(function() {
    $('a[rel*=facebox]').facebox();
})
</script>
</head>
<body>
<!-----------------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"removeNotice.php?user=$user";?>">&nbsp;Removed Product&nbsp;</a>
			</div></td>
	</tr>
<tr>
	<td valign=top>
	<!--------------------Inner table 2----------------------->
	<table class=corners cellspacing=1 cellpadding=10 width=98% align=left border=0>
	<tr>
		<td>
<?php
//set pages per items
	$per_page = 10;
	
	$query1=mysql_query("SELECT * from product where status = 'removed'");

	$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($i<=$total){
		echo "<a href='removeNotice.php?page=$i&user=$user' align=center>$i</a>&nbsp ";
		$i++;
	}
echo "</td></tr>";
echo "</table>";
echo "<br/>";
?>	
<table align=center width=90% cellspacing=5 cellpadding=8>
	<tr class=menu>
		<th>Product Pic</th>
		<th>Product ID</th>
		<th>Product Name</th>
		<th>Company ID</th>
		<th>Price</th>
		<th>Detail</th>
		<th>Date Insert</th>
		</tr>
<?php
//load company info	
$query=mysql_query("select * from product where status = 'removed' order by id asc limit $start,$per_page");
	if(mysql_num_rows($query)<1){
		echo "<tr><td colspan=8 align=center>No data</td></tr>";
	}
	while($display=mysql_fetch_array($query)){
		
	$id=$display['id'];
	$pName=$display['pName'];
	$type=$display['type'];
	$companyID=$display['companyID'];
	$price=$display['price'];
	$productPic=$display['productPic'];
	$detail=$display['detail'];
	$dateInsert=$display['dateInsert'];
	$dateRemove=$display['dateRemove'];
	
	date_default_timezone_set ("Singapore"); 
	$ldate=date("d/m/Y", time());
	
	echo "<tr class=menu2>";
	echo "<td align=center><img src=../../company/album/$productPic width=50 height=50 /></td>";
	echo "<td align=center>".$id."</td>";
	echo "<td align=center>".$pName."</td>";
	echo "<td align=center><a href='../cDetail.php?id=$companyID&user=$user' rel='facebox'>".$companyID."</a></td>";
	echo "<td align=center>".$price."</td>";
	echo "<td align=center>".$detail."</td>";
	echo "<td align=center>".$dateInsert."</td>";
	echo "</tr>";
	}
	
?>	
	<tr>
		<td colspan=8 align=center>
		<form action="<?php echo"removing.php?user=$user";?>" method="POST" onSubmit="return finalCheck();">
		<?php 
		if(mysql_num_rows($query)>0){
			echo"<input type='submit' value='Clear All Data' />";
		}
		?>
		</form>
		</td>
		</tr>
	</table>
		
		</td>
		</tr>
	</table>
	<!-------------->
	</td>
	</tr>
</table>
<!------------>

<script type="text/javascript">
function finalCheck(){
	var where_to= confirm("Do you really want clear all data of removed product");
	if (where_to==false){
		return false;
	}else{
		return true;
	}
}
</script>

</body>
</html>