<?php session_start();  //Developed by ITechScripts?>
<style type="text/css">
<!--
.style1 {
	color: #666666;
	font-weight: bold;
}
.style3 {color: #666666; font-size: 11px; font-family:Arial, Helvetica, sans-serif}
-->
</style>
><?php
require 'include/configurations.php'; // ITECHBIDS Configuration File
require 'include/header.php';
$currec=$_GET['currec']; 
$mode=$_GET[mode];
$shop_id=$_GET[shop_id];
if($mode)
{
 $up_sql="update shopfronts set status='$mode'  where  id='$shop_id'";
$res=mysql_query($up_sql);
}
if($mode=="delete")
{
 $del_sql="delete from shopfronts where id='$shop_id'";
$res=mysql_query($del_sql);
}

 $shop_sql="select * from shopfronts "; 
 $shop_res=mysql_query($shop_sql);
 $shop_row=mysql_query($shop_res);
?>
<table width="70%" border="0" cellpadding="0" cellspacing="0" align="center" height=40>
<tr class="ft" heught=25">
    <td width="10%" align="center" ><a href="plan.php" id="link3">Shops Fees</a></td>
    <td width="13%" align="center"><a href="shop_manager.php" id="link3"> View Shops </a></td>
  </tr>
</table>
<br />
<br />

<table width="70%" border="0" cellpadding="0" cellspacing="0" align="center" class="ft">
  
  

  <tr height=30><td class="ft" heught=25" align="left">
  <font size=2><b>&nbsp;
  View Shops 
  </b></font></td><tr> 
 <tr>
 <td class="table_border">
 <table cellpadding="5" cellspacing="2" width=100% border="0" >
 <?
  $recordset=mysql_query($shop_sql);
  $total_records=mysql_num_rows($recordset);
  $limitsize=2;
 if($total_records>0)
{ 
//get the total records
if(strlen($currec)==0) //check firstpage 
$currec = 1;  
$start = ($currec - 1) * $limitsize;
$end = $limitsize;
$shop_sql .=" limit $start,$end";
}
if($total_records==0)
{
?>
 <tr><td align="center" class="warning_color" colspan="5">
<br>
<br>
<br>
<font size="2" color="red"><b>Sorry! No Shops Found.</b></font>
<br>
<br>
<br></td></tr></table>

</table>
<? require 'include/footer.php'?>
</body></html>
<? 
exit();
} 
?>
<form name=frm1 action="shop_manager.php" method="GET">
<tr bgcolor="#DDDDDD">
<td><font size=1 ><b>Shop Logo</b></font></td>
<td><font size=1 ><b>Shop Name</b></font></td>
<td><font size=1 ><b>Owner</b></font></td>
<td><font size=1 ><b>Shop Description</b></font></td>
<td><font size=1 ><b># Items Listed</b></font></td>
<td><font size=1 ><b>Staus</b></font></td>
<td><font size=1 ><b>Delete</b></font></td>
</tr>
<?
//if($view=="list")
//{
if($total_records > 0)
{
?>
<tr align="left">
<? 
$net=($currec-1*$limitsize+$end)-$total_records;
$dis=$limitsize+$start;
if($net <= 0) $net=$end;
if($dis<=$total_records)
{
?>
<td colspan=6 align="right">
<font size="2">Showing  <? echo $start+1; ?>
 <? echo " - ". $dis; ?> of <? echo $total_records; ?> Items </font></td>
<? 
}
 else 
{
?>
<td colspan=6 align="right">
<font size="2">Showing  <? echo $start+1;?>  of <? echo $total_records; ?> Item </font></td>
<?
}
if($currec!=1)
{
?>
<td>
<a href="shop_manager.php?currec=<?=($currec - 1);?>&view=<?=$view;?>&cate_id=<?=$cate_id;?>" >
 <font size="2" color="red" face="Arial, Helvetica, sans-serif">Previous </font></a></td>
<?
} 
$net=$total_records-($currec*$limitsize+$end) + $end;
if($net >$limitsize) $net=$limitsize;
if($net <= 0) $net=$end;
if($total_records > ($start + $end)) 
{
?>  
<td><a href="shop_manager.php?currec=<?=($currec + 1);?>&view=<?=$view;?>&cate_id=<?=$cate_id;?>" >
<font size=2 color="red" face="Arial, Helvetica, sans-serif"> Next </font> </a></td>
<?
 }
 ?>
 </tr>
 <?
} 
//} //if($view=="list");
?>
<?
 $c=1;
 $recordset=mysql_query($shop_sql);
 while($record=mysql_fetch_array($recordset))
 {
$auction_sql="select * from auction_details where user_id=$record[user_id] and status='active'";
$auction_res=mysql_query($auction_sql);
$auction_row=mysql_fetch_array($auction_res);
$tot_auction=mysql_num_rows($auction_res);
  
  if($c==1)
  {
  $c=0;
  ?>
<tr class="tr_color_1" height="75">  
  <?
  }
  else
  {
  ?>
  <tr class="tr_color_2" height="75">
  <? 
  $c=1;
  }
  //} ?>
  <td  align=center>
  <? 
  if($record[logo])
  {
  ?>
  <a href="#"  onClick="window.open('shop.php?id=<?= $record[user_id];?>&i=1','pop_up','toolbar=no, top=0,location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=650, height=700')">
  <img src="..\shopimages/<?= $record[logo] ?>" border="0" alt= "Click here to View Shops Details"></a>
  <?
  }
  else 
  {
  ?>
  <a href="#"  onClick="window.open('shop.php?id=<?= $record[user_id];?>&i=1','pop_up','toolbar=no, top=0,location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=650, height=700')">
  <img src="../images/no_image.gif" border="0" alt= "Click here to View Shops Details"></a>
<? 
}
?>
 </td>
  <td align="center">
 <?
  echo "$record[shop_name]";
 ?>		 
  </td>
  <td>
  <?
 $member_acc="select * from member_details where user_id=$record[user_id]";
 $memebr_rec=mysql_query($member_acc);
 $member_res=mysql_fetch_array($memebr_rec);
 ?>
   <a href="#"  onClick="window.open('shop.php?id=<?= $record[user_id];?>&i=1','pop_up','toolbar=no, top=0,location=no,    directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=650, height=700')"><?  echo $member_res['user_name']; ?> </a>
 </td>
 <td width=50%><?= $record[description]; ?></td>
<td><?= $tot_auction; ?></td>
<?
if($record[status]=="enable")
{
$status="Disable";
$mode="suspend";
}
if($record[status]=="suspend" or $record[status]=="disable")
{
$status="Enable";
$mode="enable";
}
?>
<td><a href="shop_manager.php?mode=<?= $mode ?>&shop_id=<?= $record[id] ?>" id=link><?= $status ?></a></td>
<td><div align="center" class="style3"><a href="shop_manager.php?shop_id=<?=$record['id']; ?>&mode=delete"  id="link" style="text-decoration:none" onClick="javascript:return condelete();">Delete</a></div></td>
 <input type="hidden" name="canDel" value="0">
</tr>
<?
} //while($record=mysql_fetch_array($recordset))
//}
//if($view=="list")
//}
?>
</td></tr>
</table>
</form><tr>
<!-- <form name="form2" action="shops.php">
<tr><td><input type="submit" class="button"   value="Add Shop" /></td></tr>
</form> -->
</table>
<br>
<? require 'include/footer.php'?>
</body>
</html>
<script language="javascript">
function condelete()
{
var confrm;
confrm=window.confirm("Are You sure you want to delete this Shop");
document.frm1.canDel.value=1;
return confrm;
}
</script>