<?php
(!isset($int_pagesize))? $int_pagesize=10:$int_pagesize=intval($int_pagesize);
(!isset($get_page))? $get_page=0:$get_page=intval($get_page);



$this_company_id=$obj_ctl_user->get_company_id();
//·ÖÒ³
$str_where=" where site_source_id='".$this_company_id."'";
if($get_act=="set" && isset($get_site_id) && is_numeric($get_site_id) ){
	$get_site_id=intval($get_site_id);
	$obj_db->query("update ".DB_PRE."temp_site set site_issel=0 ".$str_where);
	$obj_db->query("update ".DB_PRE."temp_site set site_issel=1 where site_id=".$get_site_id);
}

if($get_act=="cancel" && isset($get_site_id) && is_numeric($get_site_id) ){
	$get_site_id=intval($get_site_id);
	$obj_db->query("update ".DB_PRE."temp_site set site_issel=0 where site_id=".$get_site_id);
}

$arr_site=array();
$arr_temp_id=array();
$arr_user_id=array();
$arr_temp=array();
$arr_company=array();
$obj_rs   = $obj_db->get_one("SELECT count(*) as num FROM ".DB_PRE."temp_site".$str_where);
$int_total=$obj_rs["num"];
$int_pages= ceil($int_total/$int_pagesize);
$get_page = min($int_pages, $get_page);
$get_page = max($get_page, 1);
$page_split_page=get_pages_html($int_total, $get_page, $int_pagesize,format_url_query(array('page'=>'')));
$int_offset = $int_pagesize*($get_page-1);
$str_limit = " limit ".$int_offset.",".$int_pagesize;
$obj_result = $obj_db->query("SELECT site_id,site_temp_id,site_issel,site_user_id,site_endtime FROM ".DB_PRE."temp_site".$str_where.$str_limit);
while($obj_rs = $obj_db->fetch_array($obj_result))
{
	$obj_rs["site_endtime"]=date("Y-m-d",$obj_rs["site_endtime"]);
	$arr_temp_id[]=$obj_rs["site_temp_id"];
	$arr_user_id[]=$obj_rs["site_user_id"];
	$arr_site["id_".$obj_rs["site_temp_id"]] = $obj_rs;
}

if(count($arr_temp_id)>0){
	$str_ids=implode(",",$arr_temp_id);
	$obj_result = $obj_db->query("SELECT temp_pic,temp_id,temp_title,temp_path FROM ".DB_PRE."temp where temp_id in(".$str_ids.")");
	while($obj_rs = $obj_db->fetch_array($obj_result))
	{
		$obj_rs["pic"]=get_html_url($obj_rs["temp_pic"]);
		if(isset($arr_site["id_".$obj_rs["temp_id"]])){
			$arr_x=array_merge($arr_site["id_".$obj_rs["temp_id"]],$obj_rs);
			$arr_site["id_".$obj_rs["temp_id"]]=$arr_x;
		}
	}
}
?>