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

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

$allow_act = array("surface", "sort0", "sort1", "sort2");

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

$act = in_array($act, $allow_act) ? $act : "surface";

switch($act)
{
	case "surface":		$wherecond = " surface = 1 ";
						$type = "封面图";
						break;
	case "sort0":		$wherecond = " sort = 0 ";
						$type = "户型图";
						break;
	case "sort1":		$wherecond = " sort = 1 ";
						$type = "外景图";
						break;
	case "sort2":		$wherecond = " sort = 2 ";
						$type = "室内图";
						break;
}

//过滤正在审核的
$idarr = getCheckRowidByType("pic_qa_".$act);
if(is_array($idarr) && !empty($idarr))
{
	$notidsql = "";
	foreach($idarr as $val)
	{
		$id = intval($val);
		$notidsql .= $notidsql != "" ? " AND id != ".$id." " : " id != ".$id." ";
	}

	$wherecond .= " AND (".$notidsql.") ";
}

$title = "经纪人房源".$type."质检";

$fitmentarr = array(0=>"全部",1=>"精装",2=>"简装",3=>"毛坯");

//分页参数
$pagesize = 10;

//获得数据总条数
$sql = "SELECT COUNT(*) FROM admin_pic_qa WHERE ".$wherecond;
$numrows = $dbback->GetOne($sql);

//获得数据当前页面数据
$sql = "SELECT * FROM admin_pic_qa WHERE ".$wherecond." ORDER BY id ASC LIMIT ".$pagesize." ";
$data_info = $dbback->GetAll($sql);

//设置正在审核记录
if($data_info)
{
	$idarr = array();
	foreach($data_info as $data)
	{
		$idarr[] = $data['id'];
	}
	resetCheckLog("pic_qa_".$act, $idarr);
}

//获取房源信息
if($data_info)
{
	foreach($data_info as $data)
	{
		$houseinfo[$data['houseid']] = getHouseInfoByTblId($data['housetbl'], $data['houseid']);
	}
}

$housearr = array();
if($act == "sort2")
{
	if($data_info)
	{
		foreach($data_info as $data)
		{
			$arr = array();
			$arr['infotype'] = $infotypearr[$data['infotype']];
			$housearr[$data['id']]['infotype'] = "&nbsp;&nbsp;".$arr['infotype'];
		}
	}
}
else if($act == "sort1")
{
	if($data_info)
	{
		foreach($data_info as $data)
		{
			$arr = array();
			$arr['blockname'] = $dbback->GetOne("SELECT blockshowname FROM ".$data['housetbl']." WHERE id = '".$data['houseid']."' ");
			$housearr[$data['id']]['blockname'] = $arr['blockname'];

			$arr['infotype'] = $infotypearr[$data['infotype']];
			$housearr[$data['id']]['infotype'] = "&nbsp;&nbsp;".$arr['infotype'];
		}
	}
}
else if($act == "sort0")
{
	if($data_info)
	{
		foreach($data_info as $data)
		{
			$housearr[$data['id']]['partment'] = $houseinfo[$data['houseid']]['room']."室".$houseinfo[$data['houseid']]['hall']."厅".$houseinfo[$data['houseid']]['toilet']."卫";
		}
	}
}


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