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

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

//顶部查询部分
$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 = $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_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);


//顶部查询部分结束

//查询条件
$wherecond = "valid_flag = 2";

$arr[kind] = array('p_2' => '身份认证', 'p_3' => '名片认证', 'p_4_1' => $conf_cityname.'房产经纪人证书', 'p_4_2' => '全国房产经纪人证书', 'p_2_2' => '一寸工作照', 'p_2_3' => "身份证照片");

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


if(isset($keyword) && !empty($keyword))
{
	$wherecond .= " and agentcode like '%".$keyword."%' ";
}

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

//获得数据总条数
$sql = "SELECT COUNT(*) FROM admin_broker_check_log WHERE ".$wherecond;

$numrows = $dbback->GetOne($sql);

//获得数据当前页面数据
$sql = "SELECT * FROM admin_broker_check_log WHERE $wherecond ORDER BY id DESC 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/log_manage"));
include_once(Template("footer"));
?>