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

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

$act = 'cert';
//查询条件
$wherecond = " type = 'p_4_1'";
$type = "经纪人证书图";
 
//前台查询参数
$search_arr = array('1'=>1,'2'=>2,'3'=>3,'4'=>4,'5'=>5,'6'=>6,'7'=>7);
$search_display = getSelect($search_arr,'search_day',$search_day);
//查询时间设置
$search_day = $search_day ? $search_day : 1;
$search_time = strtotime('-'.$search_day.' day');
$wherecond = $wherecond.' and dateline >='.$search_time ;

//分页参数
$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_qa  WHERE ".$wherecond;
$numrows = $dbback->GetOne($sql);
 
//获得数据当前页面数据
$sql = "SELECT * FROM admin_broker_qa WHERE $wherecond ORDER BY id DESC LIMIT ".$offset.",".$pagesize." ";;

$data_info = $dbback->GetAll($sql);

//获得详细信息
if($data_info)
{
	$brokerarr = array();
	foreach($data_info as $key=>$data)
	{
		$uid = intval($data['uid']);

		$memkey = $conf_cityflag."_brokerinfo_uid_".$uid;
		$memsec = 3600;
		$brokerinfo = $dao->getRow("broker", " uid = '".$uid."' ", " username,truename,idno,telno,agentcode ", $memkey, $memsec);
		$brokerarr[$uid] = $brokerinfo;
	}
}

$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("qa/cert_manage"));
include_once(Template("footer"));
?>