From 5c26be67183f40f46733b445312e94e6fcca97a9 Mon Sep 17 00:00:00 2001 From: humano Date: Sun, 27 Oct 2019 04:10:37 -0500 Subject: [PATCH] correcciones geojson --- funciones/funciones.php | 72 ++++++++++++++++++++++++----------------- geojson.js.php | 6 ++-- geojson.php | 10 ++++-- 3 files changed, 53 insertions(+), 35 deletions(-) diff --git a/funciones/funciones.php b/funciones/funciones.php index a81d9f4..0b5a4c1 100644 --- a/funciones/funciones.php +++ b/funciones/funciones.php @@ -2531,25 +2531,29 @@ return $resultado; function json_render($contenido,$tipo,$control){ //$contenido = stripcslashes($contenido); +$campo_nombre=array(); +$campo_nombre[0]=""; $campos = "$tipo,$contenido"; $linea=""; $datos = json_decode($contenido, true); -if ($tipo == "html"){ - foreach ($datos as $id_campo => $valor) { - // $linea .= "$id_campo $valor"; - $campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ; - $campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ; - foreach ($valor as $c => $v) { - if(is_array($v)){ $linea.="";}else{ - $linea .= "$v v"; - } - if(is_array($v)){ - foreach ($v as $c1 => $v1) { - $linea .= "$v1"; - }} - } - } +if ($tipo == "html"){ + if(is_array($datos)){ + foreach ($datos as $id_campo => $valor) { + // $linea .= "$id_campo $valor"; + $campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ; + $campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ; + foreach ($valor as $c => $v) { + if(is_array($v)){ $linea.="";}else{ + $linea .= "$v v"; + } + if(is_array($v)){ + foreach ($v as $c1 => $v1) { + $linea .= "$v1"; + }} + } + } + } $resultado=" @@ -2560,14 +2564,16 @@ $linea return $resultado; } elseif($tipo == "csv") { - foreach ($datos as $id_campo => $valor) { - $campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ; - $campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ; - foreach ($valor as $c => $v) { - foreach ($v as $c1 => $v1) { - $linea .= " $v1,"; - } + if(is_array($datos)){ + foreach ($datos as $id_campo => $valor) { + $campo_nombre = remplacetas('form_campos','id',"$id_campo",'campo_nombre',"") ; + $campo_descripcion = remplacetas('form_campos','id',"$id_campo",'campo_descripcion',"") ; + foreach ($valor as $c => $v) { + foreach ($v as $c1 => $v1) { + $linea .= " $v1,"; + } + } } } $resultado = trim($linea,",").""; @@ -12569,11 +12575,15 @@ function imprime_geojson($id,$id2,$plantilla,$busqueda,$item){ $campo2 = buscar_campo_tipo($id_form2,"14"); $id_campo = $campo[0]; $id_campo2 = $campo2[0]; - $busqueda = explode(':',$busqueda); - if($busqueda[1] !="") { - $busqueda[1] = htmlentities($busqueda[1]); - $consulta = "SELECT form_id as id, control, timestamp, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data FROM `form_datos` WHERE (form_id = '$id_form' $w_id2 AND id_campo ='$busqueda[0]' AND contenido COLLATE utf8_spanish2_ci like '%$busqueda[1]%' ) group by control ORDER BY orden desc"; + $or_2 =""; + $w_id2=""; + if($busqueda !="") { + $busqueda = explode(':',$busqueda); + if($busqueda[1] !="") { + $busqueda[1] = htmlentities($busqueda[1]); + $consulta = "SELECT form_id as id, control, timestamp, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data FROM `form_datos` WHERE (form_id = '$id_form' $w_id2 AND id_campo ='$busqueda[0]' AND contenido COLLATE utf8_spanish2_ci like '%$busqueda[1]%' ) group by control ORDER BY orden desc"; + } } elseif($item !=""){ @@ -12611,6 +12621,7 @@ $link=Conectarse(); while( $row = mysqli_fetch_array( $sql ) ) { $marcador = array(); $propiedades = array(); + $propiedades['icon']['iconUrl']=""; $identificador = explode(',',$row['data']); $localizacion = remplacetas('form_datos','control',$row['control'],'contenido',"id_campo = '$id_campo'") ; @@ -12628,7 +12639,7 @@ while( $row = mysqli_fetch_array( $sql ) ) { $propiedades = formulario_imprimir_linea($row['id'],$row['control'],"array");// //$propiedades[description] ="HOLA MUNDO"; //$propiedades[buscar] ="$consulta "; - $propiedades[localizacion] ="$localizacion[0] "; + $propiedades['localizacion'] ="$localizacion[0] "; if($cantidad < 300) { @@ -12659,7 +12670,7 @@ while( $row = mysqli_fetch_array( $sql ) ) { //$propiedades[sounds] =""; //$propiedades[url] =''; - $geometria .= "{\"type\":\"Feature\",\"geometry\":".json_encode($marcador,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT).",\"properties\":".json_encode($propiedades,JSON_NUMERIC_CHECK|JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT)."},"; + $geometria = "{\"type\":\"Feature\",\"geometry\":".json_encode($marcador,JSON_NUMERIC_CHECK|JSON_PRETTY_PRINT).",\"properties\":".json_encode($propiedades,JSON_NUMERIC_CHECK|JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT)."},"; $features[] = $marcador; $id++; @@ -14865,18 +14876,19 @@ if (mysqli_num_rows($sql)!='0'){ $icono = remplacetas('form_parametrizacion','campo',$id,'descripcion'," tabla='form_id' and opcion = 'categoria:icon:$md5_contenido'") ; //$icono[0] = $imagen_icon; if($icono[0] =='') { + $icon=""; //$icon = "https://raw.githubusercontent.com/humano/milfs/master/milfs/images/iconos/negro.png"; }else{ $icon = $icono[0]; } - $array[icon][iconUrl] = "$icon"; + $array['icon']['iconUrl'] = "$icon"; //$array[icon][iconSize] ="[50,50]"; //$array[icon][shadowSize] =[70,70]; //$array[icon][shadowUrl] = "http://$_SERVER[HTTP_HOST]/milfs/images/iconos/sha.png"; }else{} - $array[$row[id_campo]] = $contenido; + $array[$row['id_campo']] = $contenido; } else{ $limite = 100; diff --git a/geojson.js.php b/geojson.js.php index d26484a..6fd2887 100644 --- a/geojson.js.php +++ b/geojson.js.php @@ -8,9 +8,11 @@ include ('librerias/parsedown/Parsedown.php'); require ("funciones/conex.php"); - +if(isset($_REQUEST['buscar'])){$buscar=$_REQUEST['buscar'];}else{$buscar="";} +if(isset($_REQUEST['item'])){$item=$_REQUEST['item'];}else{$item="";} +if(isset($_REQUEST['id'])){$id=$_REQUEST['id'];}else{$id="";} -$geojson = imprime_geojson("$_REQUEST[id]","","mapa","$_REQUEST[buscar]","$_REQUEST[item]"); +$geojson = imprime_geojson("$id","","mapa","$buscar","$item",""); //header('Content-Type: application/json'); echo "let geojsonSample = ["; echo $geojson; diff --git a/geojson.php b/geojson.php index dc9af0f..50a4e89 100644 --- a/geojson.php +++ b/geojson.php @@ -4,18 +4,22 @@ require ('xajax/xajax.inc.php'); $xajax = new xajax(); require ('funciones/funciones.php'); require ('funciones/convert.php'); +include ('librerias/parsedown/Parsedown.php'); require ("funciones/conex.php"); +if(isset($_REQUEST['buscar'])){$buscar=$_REQUEST['buscar'];}else{$buscar="";} +if(isset($_REQUEST['item'])){$item=$_REQUEST['item'];}else{$item="";} +if(isset($_REQUEST['id'])){$id=$_REQUEST['id'];}else{$id="";} if(!isset($_REQUEST['plantilla'])) { -$geojson = imprime_geojson("$_REQUEST[id]","","mapa","$_REQUEST[buscar]"); +$geojson = imprime_geojson("$id","","mapa","$buscar","$item"); }else{ -$geojson = imprime_geojson("$_REQUEST[id]","","$_REQUEST[plantilla]","$_REQUEST[buscar]"); +$geojson = imprime_geojson("$id","","$_REQUEST[plantilla]","$buscar","$item"); } //header('Content-Type: application/json'); echo $geojson; -?> \ No newline at end of file +?>
$campo_nombre[0]