Exemplo n.º 1
0
function view($s) {	
	$id = intval($_REQUEST['id']);
	$house = new House();		
	if (isset($_SESSION['last_house_id']) && $_SESSION['last_house_id']>0  
		&& $_SESSION['last_house_id']!=$id && !isset($_SESSION['admin'])) {
		$house->getFull($id,"(h.status=".REALTY_STATUS_SALE." 
		OR h.status=".REALTY_STATUS_RENT." 
		OR h.status=".REALTY_STATUS_NEW."
		OR h.status=".REALTY_STATUS_RENT_NEW.")");
	}
	else {
		$house->getFull($id);		
	}
	if (!$house->id) {
		echo "Not $house->id";
		//header("Location: /index.html");
		exit();
	}
	
	$block_html = Html::pageHouseView($house);
	$s->assign("block_html",$block_html);	
	$_SESSION['last_house_id'] = (isset($_SESSION['last_house_id'])) ? $_SESSION['last_house_id'] : -1;
	$s->assign("id",$house->id);
	$s->assign("city_id",$house->city_id);

	if (!isset($_SESSION['admin']) || (isset($_SESSION['user_id']) && $house->user_id!=$_SESSION['user_id'])) {
		$house->incVisitorCount();
	}
	
	$s->assign("YANDEX_KEY",YANDEX_KEY);
	if ($house->status==REALTY_STATUS_SALE) {
		$act = 'продается в';
	}
	elseif ($house->status==REALTY_STATUS_RENT) {
		$act = 'сдается в';
	}
	else {
		$act = '';
	}
	$address = $house->city;
	if ($house->street!='') $address .= ', '.$house->street;
	$s->assign("title","Дом $act $address - Недвижимость Йошкар-Олы");
	$s->display("house_view.tpl");	
}