<?php 
	require_once('_approot.php');
	
	$ls=$_GET['ls'];
	$id=$_GET['id'];
	$modiid=$_POST['modiid'];
	$userName=trim($_POST['userName']);
	$userRealName=$_POST['userRealName'];
	$usercompany=$_POST['usercompany'];
	$userPwd=$_POST['userPwd'];
	$userEmail=strtolower(trim($_POST['userEmail']));
	$userWeb=strtolower(trim($_POST['userWeb']));
	$userMemo=$_POST['userMemo'];	
	$userTime=$_POST['userTime'];
	$userNum=$_POST['userNum'];

	$lsc=$_GET['lsc'];
	$lsctype=$_GET['lsctype'];
	$searchproductName=trim($_POST['searchproductName']);
	if($searchproductName==''){$searchproductName=$_GET['searchproductName'];}// 分页传过来的变量

	
	$nowusernum=$_GET['userNum'];

	$ls_msg="产品反馈";
	
	
	
	
	switch ($ls)
	{
		case "del":
		
			$del_sql="delete from ls_pro_feedback where id=".$id." ";
			//echo $del_sql;
			$del_query=$opendb->query($del_sql);
			$ls_msg="删除操作成功！";
			
			break;
	}
	

switch ($lsc)
	{
		case "all":			
			$addsearchstr=" where cateNameID = 0 " ;
			$ls_msg="全部";
		 	break;
		case "type":			
			$addsearchstr=" where continent='".$lsctype."' and cateNameID = 0 " ;
			$ls_msg="筛选条件： ".$lsctype." 的记录";
		 	break;


}

?>
<!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>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link href="css/admin.css" rel="stylesheet" type="text/css">
         <link rel="stylesheet" href="css/style2.css" />
		<script language="JavaScript" src="js/ls.js"></script>
		<title>无标题文档</title>
         <style>
 button {
    padding:5px 15px;
    cursor: pointer;
    background-color: #00c0ef;
    border-color: #00acd6;
    border-radius: 5px;
    border: 1px;
    color: #fff;
}
 </style>
<script language="javascript" type="text/javascript">
function turnit(ss,ii){
 //循环判断，ss为总列表数,ii为当前列
 for (i=1;i<=ss;i++){
   //错误过滤，当i=1至ss中有一项以上出错，自动过滤
  try{
   //当i=ii时展开目录数，否则关闭
   if (i==ii){
    //判断i列的目录数是否展开，没有就展开，否则关闭
    if (document.getElementById("content"+i).style.display=="none"){
     document.getElementById("content"+i).style.display="";
        document.getElementById("img"+i).src="images/up.gif";
    }else{
     document.getElementById("content"+i).style.display="none"; 
        document.getElementById("img"+i).src="images/down.gif";
    }
   }else{
    document.getElementById("content"+i).style.display="none"; 
       document.getElementById("img"+i).src="images/down.gif";
   }
  }catch(e){}
 }
}
</script>
	</head>
	<body>
		<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
			<tr>
				<td height="18" style="border-bottom:2px solid #00c0ef; padding-bottom:5px;"><div align="center"><font color="#3c8dbc" style="font-size:16px;">产品反馈</font></div>
				</td>
			</tr>
			<tr>
			  <td height="213" valign="top"><br>
                  <?php 
	if( isset($_GET['page']) )
	{$page = intval( $_GET['page'] );	}
	else
	{$page = 1;	}
	
	if($_POST['gopage']!="")
	{$page =$_POST['gopage']; 
	}

	// 每页数量
	if($usersNum!=0)
	{	$PageSize = $usersNum;}
	else
	{	$PageSize = 20;}
	
	// 获取总数据量
	/********************************************************************************/
	
	$sql="select * from ls_pro_feedback  where cateNameID = 0 ";
	if($searchproductName!="")
	{
		$sql.="and requirement like '%".$searchproductName."%' or name like '%".$searchproductName."%' or tel like '%".$searchproductName."%' or company like '%".$searchproductName."%' or email like '%".$searchproductName."%' ".$wherestr1;
		$ls_msg="包含".$searchproductName."的信息";
	}
	else
	{
		if( $lsc=="type" )
		{
			$sql.=$addsearchstr.$wherestr1;
		}
		else
		{
			$sql.=$wherestr2 ;
		}
	}
	//echo $sql;
	$result=$opendb->query($sql);
	
	/********************************************************************************/
	// 获取总数据量
	
	$row = mysqli_num_rows($result);
	$amount = $row;
	
	// 记算总共有多少页
	if( $amount ){
	   if( $amount < $PageSize ){ $page_count = 1; }			   //如果总数据量小于$PageSize，那么只有一页
	   if( $amount % $PageSize ){								  //取总数据量除以每页数的余数
		   $page_count = (int)($amount / $PageSize) + 1;		   //如果有余数，则页数等于总数据量除以每页数的结果取整再加一
	   }else{
		   $page_count = $amount / $PageSize;					  //如果没有余数，则页数等于总数据量除以每页数的结果
	   }
	}
	else{
	   $page_count = 0;
	}
	
	// 翻页链接
	$page_string = '';
	$pagecatestr="";
	if( $page == 1 ){
	   $page_string .= '首页 | 上一页 |';
	}
	else{
	   $page_string .= '<a href=?&page=1&'.$pagecatestr.'><u><font color=\"#0000FF\">首页</font></u></a> | <a href=?&page='.($page-1)."&".$pagecatestr.'><u><font color=\"#0000FF\">上一页</font></u></a> | ';
	}
	if( ($page == $page_count) || ($page_count == 0) ){
	   $page_string .= ' 下一页 | 尾页';
	}
	else{
	   $page_string .= ' <a href=?&page='.($page+1).'&'.$pagecatestr.'><u><font color=\"#0000FF\">下一页</font></u></a> | <a href=?&page='.$page_count.'&'.$pagecatestr.'><u><font color=\"#0000FF\">尾页</font></u></a>';
	}
		 $page_string .= " &nbsp;&nbsp;页次：<font color='#FF0000'><b>".$page."</b></font>/<b>".$page_count."</b>页";
		 $page_string .= " &nbsp;&nbsp;<b>".$PageSize."</b>个客户每页";
	
	
 
?>
	         <form action="<?php echo "?&lsc=".$lsc."&lsctype=".$lsctype."&searchproductName=".$searchproductName; ?>" method="post" name="searchfm" id="searchfm">
				<table border="0" width="98%" align="center">
						<tr>
							<td width="20%">提示：<font color="#FF0000"><?php echo $ls_msg; ?></font></td>
                            <td width="22%" align="right"><span style="padding-left:6px;"><strong>查找：</strong>
                              <input type="text" name="searchproductName" size="12" maxlength="50" />
                              <button type="submit"  value="查询" />查询</button>
                            </span></td>
                            <td width="13%" align="right"><div align="right">到
                              <input name="gopage" type="text" size="3" />
                              页
                              <button type="submit" name="Submit" value="GO" />GO</button>
                            </div></td>
                            <td width="7%" align="right"><span style="padding-left:6px;"><a href="?lsc=all">全部</a></span></td>
                            <td width="16%" align="right">共 <b>
                              <?=$row?>
                            </b> 条信息</td>
                        </tr>
			   </table>
	    </form>	
					<table width="98%" border="0" align="center" cellpadding="1" cellspacing="1" style="background-color: #f0f0ee;">
					 
<tr>
  <td width="3%" align="center" height="37">序号</td> 
						<td width="23%" align="center">反馈信息</td>
                       <td width="7%" align="center">姓名</td>
                       <td width="16%" align="center">公司</td>
                       <td width="10%" align="center">E-mail</td>
					   <td width="10%" align="center">网址</td>
					   <td width="15%" align="center">对应产品</td>
					   <td width="10%" align="center">时间</td>
                       <td width="3%" align="center" >收展</td>
                       <td width="3%" align="center" >删除</td>
					  </tr>
					 <?php 
					 		//查询数据
					$user_sql=$sql." order by date desc  limit ". ($page-1)*$PageSize .",".$PageSize." ";	

					$user_query=$opendb->query($user_sql);
			
					 $i=1;
					  while ($user_rows=mysqli_fetch_assoc($user_query))
					  {
					  ?>
    <tbody id='ZH_<?=$user_rows['ID']?>' >
    <tr bgcolor='#f4f4f4' onMouseOver="this.style.backgroundColor='#e5e5e5'"
    onMouseOut="this.style.backgroundColor='#f4f4f4' " >
  <td align='left' style='padding-left:10px;' height='25' onclick="turnit(<?=$row?>,<?=$i?>);" title='单击展开'><?=$i?></td>
  <td align='left' style='padding-left:10px;' height='25' onclick="turnit(<?=$row?>,<?=$i?>);" title='单击展开'><div style="width:460px; height:56px; overflow:hidden; white-space:warp; text-overflow:ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; ">  <?=mb_substr($user_rows['requirement'], 0, 160, 'utf-8') ?></div></td>
  <td align='left' style='padding-left:10px;' height='25' onclick="turnit(<?=$row?>,<?=$i?>);" title='单击展开'><?=$user_rows['name'] ?></td>
  <td align='left' style='padding-left:5px;' height='25' onclick="turnit(<?=$row?>,<?=$i?>);" title='单击展开'><?=trim($user_rows['company'])?></td>
  <td align='left' style='padding-left:10px;' height='25'><a href="mailto:<?=$user_rows['email']?>" target="_blank">
    <?=$user_rows['email']?>
    </a></td>
  <td align='left' style='padding-left:10px;'><a href="<?=$user_rows['http']?>" target="_blank"><?=str_replace("www.","",str_replace("https://","",str_replace("http://","",$user_rows['http'])) )?></a></td>
  <td align='left' style='padding-left:10px;' height='25'><a href="<?=$user_rows['path']?>" target="_blank"><?=str_replace("www.","",str_replace("https://","",str_replace("http://","",$user_rows['path'])) )?></a></td>
  <td align='left' style='padding-left:10px;' height='25'><?=str_replace(substr($user_rows['date'],-3),"",$user_rows['date'])?></td>
  <td align='center'><a href="javascript:void(0);" onclick="turnit(<?=$row?>,<?=$i?>);"><img src="images/down.gif" id="img<?=$i?>" /></a></td>
  <td align='center'><?php 						if($user_rows['userAdmin']==1)
						{
							echo "	<img src='images/b_undrop.png' border='0'>";
						}
						if($user_rows['userAdmin']==0)
						{
							echo "<a href='?page=$page&id=".$user_rows['ID']."&ls=del' onclick='return ConfirmDel();' title='删除'><img src='images/b_drop.png' border='0'></a>";
						 }?></td>
						</tr>
                        <tr style="display:none;" id="content<?=$i?>" onclick="javascript:secBoard2(<?=$user_rows['ID']?>)"  title='单击收起'>
                            <td>&nbsp;</td>
                            <td colspan="9">
                            	<table width="100%" >
                                    <tr>
                                        <td  onclick="turnit(<?=$row?>,<?=$i?>);"><p style="padding:0px; margin:0px;"><?=$user_rows['requirement']?></p></td>
                                    </tr>
                                    <tr>
                                        <td ><p style="color:#999; font-style:italic; padding:0px; margin:0px;">IP: <?=$user_rows['ip'] ?>， &nbsp;&nbsp; 国家区域：<?=trim($user_rows['home'])?>， &nbsp;&nbsp; 浏览器信息：<?=trim($user_rows['explorer'])?>， &nbsp;&nbsp; 操作系统：<?=trim($user_rows['system'])?>， &nbsp;&nbsp; 发表时间：<?=$user_rows['date']?></p></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
						</tbody>
					   <?php 						$i++;
					  }
					 ?> 
                     

							<tr>
							<td align="center" colspan="13" height="37"><?php echo( $amount>$PageSize?$page_string:""); ?> </td>
					  </tr>
				</table>
				</td>
			</tr>
		</table>
	</body>
</html>