function getServiciosDirecXRadio($servicios, $limite, $lat, $lon, $radio)
{
    $dbPg = pgSql_db();
    $query_arr = explode(" ", $servicios);
    $sql2 = "";
    foreach ($query_arr as $i => $query) {
        if (trim($query) != "") {
            if ($sql2 == "") {
                $sql2 = "query_completa ilike ('%" . $query . "%')";
            } else {
                $sql2 .= "and query_completa ilike ('%" . $query . "%')";
            }
        }
    }
    $sql = "select id_servicio,nombre_servicio,categoria,latitud,longitud,calle,numero_municipal,comuna,ST_Distance(\n  ST_GeographyFromText('POINT(" . $lon . " " . $lat . ")'), \n  ST_GeographyFromText(st_AsText(geom))\n  )/1000 as radio,id_categoria from gis_servicios where (" . $sql2 . ") and ST_Distance(\n  ST_GeographyFromText('POINT(" . $lon . " " . $lat . ")'), \n  ST_GeographyFromText(st_AsText(geom))\n  )/1000 < " . $radio . "";
    $sql .= " order by radio";
    if ($limite > 0) {
        $sql .= " limit " . $limite . "";
    }
    $rsCalle = pg_query($dbPg, $sql);
    //echo $sql;
    while ($rowCalle = pg_fetch_row($rsCalle)) {
        //$arr_callesComuna[$rowCalle[0]] = $rowCalle[1];
        $data_categoria = getServicioCategoria($rowCalle[9]);
        if (count($data_categoria) > 0) {
            $direc = array();
            $direc[] = $rowCalle[0];
            $direc[] = trim($rowCalle[1]);
            $direc[] = $rowCalle[2];
            $direc[] = $rowCalle[3];
            $direc[] = $rowCalle[4];
            $direc[] = toponimos($rowCalle[5]);
            $direc[] = $rowCalle[6];
            $direc[] = toponimos($rowCalle[7]);
            $direc[] = $rowCalle[8];
            //radio
            $direc[] = $rowCalle[9];
            //id_categoria
            $direcciones[] = $direc;
        }
    }
    pg_close($dbPg);
    return $direcciones;
}
Example #2
0
                $icono = $CM_ICONO_DIR;
                $titulo = ucwords(utf8_encode(toponimos(strtolower($dat_pto[5])))) . " #" . $dat_pto[6];
            } elseif ($dat[2] == 2) {
                $dat_pto = getServicioXId($dat[3]);
                $titulo = ucwords(utf8_encode($dat[4]));
                $titulo2 = ucwords(utf8_encode($dat[4]));
                $icono = $CM_ICONO_SERV;
            } elseif ($dat[2] == 3) {
                $dat_pto = getServicioPagoXId($dat[3]);
                $titulo = ucwords(utf8_encode($dat_pto[1]));
                $titulo2 = ucwords(utf8_encode($dat_pto[1]));
                $icono = $CM_ICONO_SERV;
            }
            $texto = "<div id=cont_pop><div class=titulo>" . $titulo2 . "</div>";
            $texto .= "<div class=titulo_pop>" . ucwords(utf8_encode(toponimos(strtolower($dat_pto[5])))) . " #" . $dat_pto[6] . "</div>";
            $texto .= "<div class=titulo_pop>" . ucwords(utf8_encode(toponimos(strtolower($dat_pto[7])))) . "</div>";
            $texto = ucwords(utf8_encode($texto)) . "</div>";
            ?>
																<li onclick="$('#mypanel').panel('close');"> 
																<img class="ui-li-icon ui-corner-none" src="img/basura.png" onclick="javascript:deleteFavoritos(<?php 
            echo $dat[0];
            ?>
);"><div onclick='javascript:addMarcadores("<?php 
            echo $dat[6];
            ?>
","<?php 
            echo $dat[5];
            ?>
","<?php 
            echo $texto;
            ?>
Example #3
0
					<?php 
                    if (trim($serv[5]) != "" or trim($serv[6]) != "") {
                        ?>
					<span class="span_dir"><?php 
                        echo ucwords(utf8_encode(toponimos(strtolower($serv[5]))));
                        ?>
 #<?php 
                        echo $serv[6];
                        ?>
</span> 
					<br>
					<?php 
                    }
                    ?>
					<span class="span_comuna"><?php 
                    echo ucwords(utf8_encode(toponimos(strtolower($serv[7]))));
                    ?>
</span>
					</br>
					
					<span class="span_distancia">Distancia:<?php 
                    echo round($serv[8], 2);
                    ?>
Km</span>
					</div>
					<div id=botonera>
						<img class=img_boton src=images/favorito.png title=Agregar a favoritos onclick=javascript:addFavorito(<?php 
                    echo $estado_ses;
                    ?>
,<?php 
                    echo $serv[0];