99 and $ktory_okres_csu<106 and $ktorydruh_nem==1 ) { $day = "90"; } else { $day = "260"; } //pro bratislavu max. stari jen 90 dni //if( intval($ktory_okres)!=0 ){ $okres_zoom = "map.setCenter( point, 11);"; } if ( intval($_GET['id_zadavatel']) != 0) { // vypis jen RK x>'10111222' && y>'45111222' $hled_co="x>'1' && y>'1' && placene='ano' && ".$hled_co; } else { $hled_co="x>'1' && y>'1' && datum_vlozeno>DATE_SUB(CURDATE(),INTERVAL ".$day." DAY) && ".$hled_co; } //schranka if( $_GET['user_hash']!="" ){ if(!(@$result = mysql_db_query($DB, "SELECT id_nemovitosti FROM schranka WHERE user_hash='".addslashes($_GET['user_hash'])."'"))) { chyba(4); exit(); } $result2=mysql_num_rows($result); if($result2>0){ for($p=0; $p< $result2; $p++) { if($p!=0){$q_s1 .="|| ";} $result3 = mysql_fetch_array($result); $q_s1 .="id='".$result3['id_nemovitosti']."'"; } $hled_co=$hled_co." && (".$q_s1.")"; $zobraz_co="ponuka v schránke"; } } //schranka end //echo "h:".$hled_co."
"; $sel_limit=150; if (!($count = mysql_fetch_array(mysql_db_query($DB, "SELECT COUNT(id) FROM nemovitosti WHERE ".$hled_co)))) { chyba(4);exit;} if ( $count[0] <= $sel_limit ) { $count_v=$count[0]." x "; $nem_limit = $sel_limit; } else { $nem_limit = 1; } if ( $count[0] < 5500 ) { $count_v=$count[0]." x "; } //$count_v=$count[0]." x "; OTbezna(''); echo "všetky reality"; echo (" \r\n"); echo (" ".$count_v.$zobraz_co."\r\n"); echo ""; echo ""; if ( $_GET['id_zadavatel']!=0 ) { echo " ponuky výpis »"; } elseif ( $mo_druh!="" and $mo_okres!="" ) { echo " ponuky výpis »"; } else { echo "reality výpis » "; } CloseTable(); //------------------------------------ // pole nemovitosti $sql = "SELECT id,datum_vlozeno,nem_typ,nem_druh,nem_sekce,obec,ulice,cena,nem_cena_jednotka,x,y,export,top_ponuka FROM nemovitosti WHERE ".$hled_co." ORDER BY id DESC LIMIT ".$nem_limit; $kempy = mysql_query($sql) or die (mysql_error()); $prum_x=""; $prum_y=""; $num_rows=mysql_num_rows($kempy); $data = "var data = new Array("; for ($i = 0; $i < $num_rows; $i++) { $vypp = mysql_fetch_array($kempy); //foto if (!(@$ph = mysql_query("SELECT foto,foto_67,id_nemcz,date,export FROM foto WHERE id_nemovitosti='".$vypp['id']."' ORDER BY titulni ASC,id ASC LIMIT 1"))) { echo"r1";exit; } $pho = mysql_fetch_array($ph); $src_foto=FOTO_url($pho,"67x50"); // foto URL if (mysql_num_rows($ph)!=0) { $foto=""; } else { $foto=""; } //existuje jiz stejná pozice? if (intval($bylox[$vypp['x']])!=0 and intval($byloy[$vypp['y']])!=0) { $x = $vypp['x']+($bylox[$vypp['x']]*880);} else {$x = $vypp['x'];} if ( $vypp['ulice']!="" ) { $ulice = ", ulica: ".$vypp['ulice']; } else { $ulice = ", ulica: ---"; } $typ = $pr_nem_typ[$vypp['nem_typ']]; $druh = $pr_nem_druh1[$vypp['nem_druh']]." > ".$pr_nem_sekce1[$vypp['nem_sekce']]; $cena = "".number_format ($vypp['cena'],0,chr(44),".")." ".$pr_nem_cena_jednotka[$vypp['nem_cena_jednotka']]."
".$vypp['cena_popis']; $url = "/".$vypp['id']."-ponuka.htm"; //je ve schrance.. $pom_schranka_stav=""; if(count($arrschrana)!=0){ if(array_search($vypp['id'], $arrschrana)!=0){ $pom_schranka_stav="V schránce"; } } if($pom_schranka_stav==""){ $pom_schranka_stav="Do schránky »"; } $text = "
"; $text .= "
".$vypp['obec']."".$ulice."
".$typ." > ".$druh."
"; $text .= "
".$foto."
".$cena."
"; $text .= "
Detail/Dotaz » | ".$pom_schranka_stav."
"; $text .= "
"; $title = $typ.">".$druh.">".$vypp['obec']; if ( $i!=0 ) { $carka = ", "; } else { $carka = ""; } if ( $vypp['top_ponuka']==1 ) { $top = "top"; $zi="1"; } //TOP ve vypisu elseif ($vypp['datum_vlozeno'] > date("Y-m-d H:i:s")) { $top = "top"; $zi="1"; } else { $top = ""; $zi="0"; } //TOP, primo zaplaceno, titulka $data .= $carka."new Array('".$vypp['nem_druh'].$top."', ".number_to_gps($vypp['y']).", ".number_to_gps($x).", '".$text."', '".$title."', '".$zi."')"; $bylox[$vypp['x']] = $bylox[$vypp['x']] + 1;//pocita stejne pozice $byloy[$vypp['y']] = $byloy[$vypp['y']] + 1;//pocita stejne pozice //prumer souradnice pro stred $prum_x[$i]=$vypp['x']; $prum_y[$i]=$vypp['y']; } $data .= ");"; // konec zapisu do pole //prumerna odchylka if ( $num_rows>0 ) { //jsou nekaje polozky? $prum_xx=round(array_sum($prum_x)/count($prum_x)); foreach ($prum_x as $key => $val) { $prum_odchylka[$key]=abs($prum_xx-$val); } $prum_odchylka1=round(array_sum($prum_odchylka)/count($prum_x)); $prum_odchylka=""; foreach ($prum_x as $key => $val) { //odfiltrujeme velke vzdalenosti if ( abs($prum_xx-$val)<($prum_odchylka1*2) ) { $prum_odchylka3[$key]=abs($prum_xx-$val); $prum_xx1[$key]=$val; } //echo $prum_odchylka[$key]."
"; } } if ( count($prum_xx1)>1 ) { $prum_odchylka2=round(array_sum($prum_odchylka3)/count($prum_xx1)); if ( $prum_odchylka2>800330 ) { $zoom=7; } elseif ( $prum_odchylka2>420330 ) { $zoom=8; } elseif ( $prum_odchylka2>120330 ) { $zoom=9; } elseif ( $prum_odchylka2>50330 ) { $zoom=10; } else { $zoom=11; } $prum_xx=round(array_sum($prum_xx1)/count($prum_xx1)); $prum_yy=round(array_sum($prum_y)/$num_rows); } else { //kvuli jen jedne polozce $prum_xx=$prum_x[0]; $prum_yy=$prum_y[0]; $zoom=8; } //prumerna odchylka end $center="new google.maps.LatLng(48.6, 19.6)";//stred SR if ( $prum_yy>40111222 and $prum_xx>10111222) { $center="new google.maps.LatLng(".number_to_gps($prum_yy).", ".number_to_gps($prum_xx).")"; } ?>