<?php
require("session_check.php");	
	require("../foundation/fpages_bar.php");

	//语言包引入
	$m_langpackage=new modulelp;
	$rf_langpackage=new recaffairlp;

	//数据表定义区
	$t_reqort=$tablePreStr."report";

	$dbo = new dbex;
	dbtarget('w',$dbServs);

	//当前页面参数
	$page_num=trim(get_argg('page'));

	//变量区
	$c_idtype=short_check(get_argg('idtype'));
	$c_orderby=short_check(get_argg('orderby'));
	$c_ordersc=short_check(get_argg('ordersc'));
	$c_perpage=get_argg('perpage')? intval(short_check(get_argg('perpage'))) : 20;

	$sql="select * from $t_reqort where 1=1 ";

	if(!empty($c_idtype)){
		$sql.=" and type = '$c_idtype' ";
	}
	if(!empty($c_orderby)){
		$sql.=" order by $c_orderby ";
	}

	$sql.=" $c_ordersc ";

	$dbo->setPages($c_perpage,$page_num);//设置分页
	$reqort_rs=$dbo->getRs($sql);
	$page_total=$dbo->totalPage;//分页总数

	//条件显示
	$l_gro='';$l_blg='';$l_pic='';$l_alb='';$l_poll='';$l_sub='';$l_sha='';$l_spc='';
	if(get_argg('idtype')=="1"){$l_gro="selected";}
	if(get_argg('idtype')=="0"){$l_blg="selected";}
	if(get_argg('idtype')=="3"){$l_pic="selected";}
	if(get_argg('idtype')=="2"){$l_alb="selected";}
	if(get_argg('idtype')=="4"){$l_poll="selected";}
	if(get_argg('idtype')=="9"){$l_sub="selected";}
	if(get_argg('idtype')=="8"){$l_sha="selected";}
	if(get_argg('idtype')=="10"){$l_spc="selected";}

	//按字段排序
	$o_def='';$o_add_time='';
	if(!get_argg('orderby')||get_argg('order_by')=="reportid"){$o_def="selected";}
	if(get_argg('orderby')=="add_time"){$o_add_time="selected";}

	//排列方式
	$sc_desc='';$sc_asc='';
	if(get_argg('ordersc')=="desc"){$sc_desc="selected";}
	if(get_argg('ordersc')=="asc"){$sc_asc="selected";}

	//分页显示条数
	$p_20='';$p_50='';$p_100='';
	if(!get_argg('perpage')||get_argg('perpage')=="20"){$p_20="selected";}
	if(get_argg('perpage')=="50"){$p_50="selected";}
	if(get_argg('perpage')=="100"){$p_100="selected";}

	//显示控制
	$isset_data="";
	$none_data="content_none";
	$isNull=0;
	if(empty($reqort_rs)){
		$isNull=1;
		$isset_data="content_none";
		$none_data="";
	}
?>
<!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 rel="stylesheet" type="text/css" href="css/right.css">
<link rel="stylesheet" type="text/css" href="css/iframe.css">
<title></title>
<script type='text/javascript'>
function create_xmlhttp()
{
	if(window.ActiveXObject){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		xmlhttp=new XMLHttpRequest();
	}
}

function act_report(report_id,type_id,redid,uedid)
{
	 create_xmlhttp();
	 var d = new Date();
	 var t = d.getTime();
	 xmlhttp.open("GET","report_del.action.php?rid="+report_id+"&type="+type_id+"&redid="+redid+"&uedid="+uedid+"&t="+t,true);
	 xmlhttp.onreadystatechange=function(){
	 	if(xmlhttp.readyState==4&&xmlhttp.status==200)
	 	{
		 	var return_str=xmlhttp.responseText;
			var	return_text=return_str.replace(/[\s\n\r]/g,"");
		 	window.document.getElementById("operate_"+report_id).innerHTML=return_text;
	 	}
	 }
	 xmlhttp.send(null);
}

function del_report(report_id){
	create_xmlhttp();
	 xmlhttp.open("GET","report_del.action.php?rid="+report_id,true);
	 xmlhttp.onreadystatechange=function(){
	 	if(xmlhttp.readyState==4&&xmlhttp.status==200)
	 	{
		 	var return_str=xmlhttp.responseText;
			var	return_text=return_str.replace(/[\s\n\r]/g,"");
		 	window.document.getElementById("operate_"+report_id).innerHTML=return_text;
	 	}
	 }
	 xmlhttp.send(null);
}
</script>
</head>
<body>
<div class="container">
	<div class="rs_head"><?php echo $m_langpackage->m_check_condition?></div>
</div>

<form method="get" action=""  onsubmit="return check_form()">
<TABLE class="main main_left">
<tr>
<th width="120px"><?php echo $m_langpackage->m_report_type?></th>
<td>
<SELECT name=idtype>
<OPTION value=""><?php echo $m_langpackage->m_astrict_no?></OPTION>
<option value="0" <?php echo $l_blg;?>><?php echo $m_langpackage->m_blog?></option>
<option value="9" <?php echo $l_sub;?>><?php echo $m_langpackage->m_subject?></option>
<option value="2" <?php echo $l_alb;?>><?php echo $m_langpackage->m_album?></option>
<option value="3" <?php echo $l_pic;?>><?php echo $m_langpackage->m_photo?></option>
<OPTION value="1" <?php echo $l_gro;?>><?php echo $m_langpackage->m_group?></OPTION>
<option value="4" <?php echo $l_poll;?>><?php echo $m_langpackage->m_poll?></option>
<option value="8" <?php echo $l_sha;?>><?php echo $m_langpackage->m_share?></option>
<OPTION value="10" <?php echo $l_spc;?>><?php echo $m_langpackage->m_space?></OPTION>
</SELECT>
</td>
</tr>

<tr>
  <th><?php echo $m_langpackage->m_result_order?></th>
  <td colspan="3">
  <select name="orderby">
    <OPTION value="report_id" <?php echo $o_def;?>><?php echo $m_langpackage->m_def_order?></OPTION>
    <OPTION value='add_time' <?php echo $o_add_time;?>><?php echo $m_langpackage->m_creat_time?></OPTION>
  </select>
  <select name="ordersc">
    <OPTION value='asc' <?php echo $sc_asc;?>><?php echo $m_langpackage->m_asc?></OPTION>
    <OPTION value='desc' <?php echo $sc_desc;?>><?php echo $m_langpackage->m_desc?></OPTION>
  </select>
  <select name='perpage'>
    <option value='20' <?php echo $p_20;?>><?php echo $m_langpackage->m_page_20?></option>
    <option value='50' <?php echo $p_50;?>><?php echo $m_langpackage->m_page_50?></option>
    <option value='100' <?php echo $p_100;?>><?php echo $m_langpackage->m_page_100?></option>
  </select>
  <input type="submit" name="searchsubmit" value="<?php echo $m_langpackage->m_search?>">
  </td>
</tr>
<tr><td colspan=2><?php echo $m_langpackage->m_red?></td></tr>
</table>
</form>

<div class="container">
	<div class="rs_head"><?php echo $m_langpackage->m_report_list?></div>
</div>

<form method="post" action="">
<table border="0" class='main <?php echo $isset_data;?>'>

    <tr>
      <td width="25%"><?php echo $m_langpackage->m_content?></td>
      <td width="25%"><?php echo $m_langpackage->m_report_reason?></td>
      <td><?php echo $m_langpackage->m_rep_num?></td>
      <td><?php echo $m_langpackage->m_informer?></td>
      <td><?php echo $m_langpackage->m_time?></td>
      <td><?php echo $m_langpackage->m_type?></td>
      <td><?php echo $m_langpackage->m_handle?></td>
    </tr>
    <?php foreach($reqort_rs as $val){?>
    <tr>
      <td style='text-align:left;'><?php echo $val['content']?></td>
      <td><?php echo $val['reason']?></td>
      <td><?php echo $val['rep_num']?></td>
      <td><a href="../home.php?h=<?php echo $val['user_id'];?>" target="_blank"><?php echo $val['user_name']?></a></td>
      <td><?php echo $val['add_time']?></td>
      <td><?php echo $rf_langpackage->{'rf_s_type_'.$val['type']}?></td>
      <td>
      <div id="operate_<?php echo $val['report_id'];?>">
	      <a onclick="return confirm('<?php echo $m_langpackage->m_handle_con?>');" href="javascript:del_report(<?php echo $val['report_id']?>);"><?php echo $m_langpackage->m_del_report?></a><br />
	      <a onclick="return confirm('<?php echo $m_langpackage->m_handle_con?>');" href="javascript:act_report(<?php echo $val['report_id']?>,<?php echo $val['type']?>,<?php echo $val['reported_id']?>,<?php echo $val['ued_id']?>);"><?php $lock=""; if($val['type']=='10' or $val['type']=='1'){$lock=$m_langpackage->m_lock;}?> <?php echo str_replace('{type}',$lock.$rf_langpackage->{'rf_s_type_'.$val['type']},$m_langpackage->m_lock_type)?></a></td>
    	</div>
    </tr>
    <tr><td class="dotted_line" colspan="10" style="line-height:100%;">&nbsp</td></tr>
    <?php }?>
    <tr>
	<td colspan=5 style="text-align:'right'">
	<?php
		page_show($isNull,$page_num,$page_total);
	?>
	</td>
	</tr>
  </table>
</form>
<div class='guide_info <?php echo $none_data;?>'><?php echo $m_langpackage->m_none_data?></div>
</body>
</html>
