<?php
include_once("module/company/includes/links_class.php");
$links=new links();
//==================================================
if($_POST['chkall']=='审核选中'&&!empty($_POST['chk']))//选中审核
{
	foreach($_POST['chk'] as $val)
	{
	   $links->set_link($val);
	}
}
if($_POST['chkall']=='删除选中'&&!empty($_POST['chk']))//选中删除
{
	foreach($_POST['chk'] as $v)
	{
	   $links->del_link($v);
	}
}
if(isset($_GET['deid']))
	$links->del_link($_GET['deid']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE><?php echo lang_show('admin_system');?></TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="main.js"></script>
<script language="javascript">
function do_select()
{
	 var box_l = document.getElementsByName("chk[]").length;
	 for(var j = 0 ; j < box_l ; j++)
	 {
	  	if(document.getElementsByName("chk[]")[j].checked==true)
	  	{
			document.getElementsByName("chk[]")[j].checked = false;		
		}
		else
		{
			document.getElementsByName("chk[]")[j].checked = true;
		}
	 }
}
</script>
</HEAD>
<body>
<div class="bigbox">
  <div class="bigboxhead tb"> <?php echo lang_show('link_man');?> </div>
  <div class="bigboxbody">
    <form method="post" name="form1" action="">
      <table width="100%" border="0" cellpadding="2" cellspacing="0" >
        <tr class="theader">
          <td width="20%">
		  <input type="checkbox" class="checkbox" onClick="do_select()" name="chkall" id="chkall" ><?php echo lang_show('user');?>ID</td>
          <td width="20%"><?php echo lang_show('fri_link');?></td>
          <td width="20%"> <?php echo lang_show('title');?></td>
          <td width="20%"><?php echo lang_show('desc');?></td>
          <td width="20%" align="center"><?php echo lang_show('manager');?></td>
        </tr>
        <?php	
	$re=$links->link_all_list();
	//=============================	
	foreach($re as $key=>$v)
	{ 
	?>
        <tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this,'odd')">
          <td><input type="checkbox" class="checkbox" name="chk[]" value="<?php echo $v['link_id']?>" />
            [<?php echo empty($v['statu'])?'未审核':'已审核'; ?>] <a href="<?php echo $config['weburl']; ?>/shop.php?uid=<?php echo $v["userid"]; ?>"><?php echo $v["user"]; ?></a></td>
          <td><?php echo $v["link_url"]; ?></td>
          <td align="left"><?php echo $v["link_name"]; ?></td>
          <td align="left"><?php echo $v["link_con"]; ?></td>
          <td align="center"><a href="module.php?m=company&s=linklist.php&deid=<?php echo $v["link_id"]; ?>" onClick="return confirm('<?php echo lang_show('are_you_sure');?>')"><?php echo $delimg;?></a> </td>
        </tr>
        <?php 
    	}
		?>
        <tr>
          <td colspan="2" align="left">
            <input class="btn" type="submit" name="chkall"  value="<?php echo lang_show('audit_selec');?>" >
            <input class="btn" type="submit" name="chkall"  value="<?php echo lang_show('delete_selec');?>" >
          </td>
          <td colspan="4" align="right"><div class="page"><?php echo $pages?></div></td>
        </tr>
      </table>
    </form>
  </div>
</div>
</body>
</html>