1
0
forked from qwerty/milfs
milfskleper/json.php

69 lines
2.1 KiB
PHP
Raw Normal View History

2014-09-25 15:46:41 +00:00
<?php
//ini_set('display_errors', 'On');
require ('xajax/xajax.inc.php');
$xajax = new xajax();
require ('funciones/funciones.php');
require ('funciones/convert.php');
require ("includes/markdown.php");
require ("funciones/conex.php");
2014-09-25 15:46:41 +00:00
$fecha_inicio = mysql_seguridad($_REQUEST[inicio]);
$fin = mysql_seguridad($_REQUEST[fin]);
$perfil = mysql_seguridad($_REQUEST[id]);
2014-09-25 15:46:41 +00:00
$id = mysql_seguridad($_REQUEST[id]);
$busqueda = mysql_seguridad($_REQUEST[cadena]);
$campo = buscar_campo_tipo($id,"14");
$id_campo = $campo[0];
$link=Conectarse();
$consulta = "SELECT form_id as id, control, GROUP_CONCAT(contenido ORDER by timestamp desc ) as data
2014-10-07 11:28:54 +00:00
FROM `form_datos`
WHERE form_id = '$id'
AND id_campo ='$id_campo' $valor
group by control
ORDER BY orden desc";
2014-09-25 15:46:41 +00:00
mysqli_query("SET NAMES 'UTF8'");
2014-09-25 15:46:41 +00:00
$sql = mysqli_query($consulta,$link) or die("Error al ejecutar consulta en json.php");
2014-09-25 15:46:41 +00:00
if (mysql_num_rows($sql)!='0'){
$id = 1;
$features = array();
while( $row = mysql_fetch_array( $sql ) ) {
$marcador = array();
$propiedades = array();
$identificador = explode(',',$row[data]);
$identificador = $identificador[0];
$campos = explode(" ",$identificador);
2014-09-25 15:46:41 +00:00
$lat = $campos[0];
$lon = $campos[1];
$zoom = $campos[2];
$marcador["type"] = "Point";
$marcador["coordinates"] = array($lat,$lon);
2015-10-27 21:35:37 +00:00
$formulario = formulario_imprimir($perfil,$row[control],'');
2014-10-06 17:13:44 +00:00
$propiedades["name"] ="<div class='container-fluid' id='contenedor_datos' >$formulario</div>";
$geometria .= "{\"type\":\"Feature\",\"geometry\":".json_encode($marcador,JSON_NUMERIC_CHECK).",\"properties\":".json_encode($propiedades,JSON_NUMERIC_CHECK)."},";
2014-09-25 15:46:41 +00:00
$features[] = $marcador;
2014-09-25 15:46:41 +00:00
$id++;
}
}
header('Content-Type: application/json');
2014-09-25 15:46:41 +00:00
$resultado = " { \"type\": \"FeatureCollection\",
\"features\": ";
$resultado .= json_encode($features,JSON_NUMERIC_CHECK);
$resultado .= "}";
$geometria = substr("$geometria",0,-1);
$geometria = "{
\"type\": \"FeatureCollection\",
\"features\": [$geometria ]}";
echo $geometria;
?>