correcciones geojson

This commit is contained in:
humano 2019-10-27 04:10:37 -05:00
parent 7015b4c2d2
commit 5c26be6718
3 changed files with 53 additions and 35 deletions

View File

@ -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 .= "<tr><td>$id_campo $valor</td></tr>";
$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 .= "<tr class='tr_json_render'><td class='td_json_render'>$v v</td></tr>";
}
if(is_array($v)){
foreach ($v as $c1 => $v1) {
$linea .= "<tr class='tr_json_render'><td class='td_array_json_render'>$v1</td></tr>";
}}
}
}
if ($tipo == "html"){
if(is_array($datos)){
foreach ($datos as $id_campo => $valor) {
// $linea .= "<tr><td>$id_campo $valor</td></tr>";
$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 .= "<tr class='tr_json_render'><td class='td_json_render'>$v v</td></tr>";
}
if(is_array($v)){
foreach ($v as $c1 => $v1) {
$linea .= "<tr class='tr_json_render'><td class='td_array_json_render'>$v1</td></tr>";
}}
}
}
}
$resultado="
<table class='table table-striped table_json_render table-bordered' id='tabla_$control' >
<tr class='tr_json_render_titulos'><th>$campo_nombre[0]</th></tr>
@ -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;

View File

@ -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;

View File

@ -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;
?>
?>