<?php
$conf_basedir	= "../../";	//相对主目录的位置
$conf_where		= "admin";	//选择调用相应模块
$directory		= basename(dirname(__FILE__));	//定义当前所在的目录，引入模块公用函数
include_once($conf_basedir."base.inc.php");
checkAuth('15');	//判断登录和权限

$title = "审核日志";
$js = "<script type='text/javascript' src='http://esfadmin.house365.com/script/js/showpic.js'></script>";

//顶部查询部分
$condarr = array(""=>"*请选择*");
$house['cond'] = $condarr + array("houseid"=>"房源编号","username"=>"经纪人帐号","agentname"=>"公司名称","master"=>"客户经理");
$house['sort'] = $condarr + array(0=>'户型图',1=>'外景图',2=>'室内图',10=>'房源描述');
$house['fitment'] = array(0=>"全部",1=>"精装",2=>"简装",3=>"毛坯");
$house['oper'] = $condarr + array(1=>'删除',2=>'冻结',3=>'恢复删除',4=>'恢复冻结');
$thismonth = date("n");
$prevmonth = $thismonth == 1 ? 12 : $thismonth - 1;
$house['month'] = array($prevmonth=>$prevmonth,$thismonth=>$thismonth);

$thisyear = date("Y");
if($thismonth == 1)
{
	$prevyear = $thisyear - 1;
	$house['year'] = array($prevyear=>$prevyear, $thisyear=>$thisyear);
}
else
{
	$house['year'] = array($thisyear=>$thisyear);
}

for($i=1;$i<=31;$i++)
{
	$house['day'][$i] = $i;
}

$cond_y1 = intval($cond_y1);
$cond_y2 = intval($cond_y2);
$cond_m1 = intval($cond_m1);
$cond_m2 = intval($cond_m2);
$cond_d1 = intval($cond_d1);
$cond_d2 = intval($cond_d2);
$cond_y1 = $cond_y1 >0 ? $cond_y1 : date("Y");
$cond_y2 = $cond_y2 >0 ? $cond_y2 : date("Y");
$cond_m1 = $cond_m1 >0 ? $cond_m1 : date("n");
$cond_m2 = $cond_m2 >0 ? $cond_m2 : date("n");
$cond_d1 = $cond_d1 >0 ? $cond_d1 : date("j");
$cond_d2 = $cond_d2 >0 ? $cond_d2 : date("j");

$cond_search	= tonyForm("select","cond",$house['cond'],$cond);
$cond_search_y1	= tonyForm("select","cond_y1",$house['year'],$cond_y1);
$cond_search_y2	= tonyForm("select","cond_y2",$house['year'],$cond_y2);
$cond_search_m1	= tonyForm("select","cond_m1",$house['month'],$cond_m1);
$cond_search_m2	= tonyForm("select","cond_m2",$house['month'],$cond_m2);
$cond_search_d1	= tonyForm("select","cond_d1",$house['day'],$cond_d1);
$cond_search_d2	= tonyForm("select","cond_d2",$house['day'],$cond_d2);

$cond_search_oper	= tonyForm("select","cond_oper",$house['oper'],$cond_oper);

$cond_search_sort	= tonyForm("select","cond_sort",$house['sort'],$cond_sort);
//顶部查询部分结束

//查询条件
$wherecond = "";
$time1 = strtotime($cond_y1.'-'.$cond_m1.'-'.$cond_d1.' 00:00:00');
$time2 = strtotime($cond_y2.'-'.$cond_m2.'-'.$cond_d2.' 23:59:59');
$wherecond = " (dateline >= $time1 and dateline <= $time2) ";

$keyword = trim($keyword);
if($cond != "")
{
	$wherecond .= " AND ".$cond." = '".$keyword."' ";
}

if($cond_oper == 1)
{
	$wherecond .= " AND oper = '1' ";
}
else if($cond_oper == 2)
{
	$wherecond .= " AND oper = '2' ";
}
else if($cond_oper == 3)
{
	$wherecond .= " AND oper = '3' ";
}
else if($cond_oper == 4)
{
	$wherecond .= " AND oper = '4' ";
}

if(isset($cond_sort) && $cond_sort != "")
{
	$cond_sort = intval($cond_sort);
	$wherecond .= " AND sort = '".$cond_sort."' ";
}

$ordercond = " id DESC";

//分页参数
$pagesize	= $display_rows ? intval($display_rows) : 10;
$page_now	= $page_now ? max(1, intval($page_now)) : 1 ; // 获取当前页数
$offset		= ( $page_now - 1 ) * $pagesize;

$data_info = array();

if($wherecond != "")
{
	//获得数据总条数
	$sql = " SELECT COUNT(*) FROM admin_house_check_log WHERE  ".$wherecond ;
	$numrows = $dbback->GetOne($sql);
	//获得数据当前页面数据
	$sql = " SELECT * FROM admin_house_check_log WHERE  ".$wherecond." ORDER BY ".$ordercond." LIMIT ".$offset.",".$pagesize." ";
	$data_info = $dbback->GetAll($sql);
}

$pagenum = count($data_info);//当前页面数量
$numrows = $numrows >0 ? $numrows : 0;
$time = time();
if( $numrows <= 0 || $pagenum <=0){
	$pages = 0 ;  //计算总页数
}else{
	$pages = ceil($numrows/$pagesize) ;  //计算总页数
	$new_pagenavi = new_pagenavi($page_now,$pages,$numrows);
}

//引用模版文件
include_once(Template("header"));
include_once(Template("broker_house/log_manage"));
include_once(Template("footer"));
?>