status=='OK') // { $search_lat = $get_remote['results'][0]['geometry']['location']['lat']; $search_lng = $get_remote['results'][0]['geometry']['location']['lng']; // } // busquem les geologuies que hi ha aprop if(isset($search_lat)) { $ar_geo_result = array(); // busquem geologuies que estiguin publicades. $args = array( "post_type"=>'geo', 'meta_key'=>'genEstat', 'meta_value'=>'2', 'numberposts'=>-1 ); $resultGeo = get_posts($args); foreach ($resultGeo as $aGeo) { $includeYES = true; if($_POST['interes']!=-1) { $ac_interes_terms = get_post_meta($aGeo->ID,'genInteres',true); if(!in_array($_POST["interes"],$ac_interes_terms)) $includeYES=false; } // Filtres if($_POST['filtre']!=-1) { $valorFiltre = $_POST['filtre']; if($valorFiltre!="tots") { if(array_key_exists($valorFiltre,$arIdiomes)) { // filtre per idioma $genIdioma = get_post_meta($aGeo->ID,"genIdioma",true); if($genIdioma!=$valorFiltre) $includeYES=false; } switch($valorFiltre) { case "recents": $gmt_timestamp = get_post_time('U', true,$aGeo->ID); $ara = time(); if($gmt_timestamp<($ara-(60*60*24*40))) $includeYES=false; break; case "valorades": global $wpdb; $valorIncVot = 0; $countVot = 0; $resultVots = $wpdb->get_results("SELECT * FROm gc_vots WHERE idpost='".$aGeo->ID."'"); foreach ($resultVots as $aVot) { $valorIncVot += $aVot; $countVot++; } $finalVotValue = $valorIncVot/$countVot; break; case "vistes": if(get_post_meta($aGeo->ID,"post_views_count",true)<20) $includeYES = false; break; } } } if($includeYES) { $mypoints = $wpdb->get_results("SELECT * FROM gc_parades WHERE idpost='$aGeo->ID'"); $isOk = false; foreach ($mypoints as $aPoint) { $mpoint = explode(",",$aPoint->posgoogle); $distancePoint = distance2points($mpoint[0],$search_lat,$mpoint[1],$search_lng); if($distancePoint<1000000) { array_push($ar_geo_result,$aGeo); $isOk=true; break; } } } $ar_marques = array(); if($isOk) // geologuia en el rank d'acció { // busquem marques foreach ($ar_geo_result as $arGeo) { $resultPunts = $wpdb->get_results("SELECT * FROM gc_parades WHERE idpost='$arGeo->ID' ORDER BY ordre"); $ipoint = 1; foreach ($resultPunts as $aPunt) { $pointContent = '

' . trim($arGeo->post_title) . '

' . trim($aPunt->titol) . '

'; $pointContent .= '

'.__('Parada: ').''; $pointContent .= '' . trim($aPunt->id_icon) . '

'; $pointContent .= '
' . __("Veure") . ''; $ar_punt = array('punt'=>$aPunt->posgoogle, 'icon' => get_bloginfo('template_url')."/img/micon/number_".$ipoint.".png", 'idstop' => $aPunt->id, 'content' => $pointContent, ); array_push($ar_marques,$ar_punt); $ipoint++; } } } } } } ?>

Geologuies');?>