tupali/mapero.php

370 lines
13 KiB
PHP
Raw Normal View History

2016-10-29 15:07:15 +00:00
<?php session_start();
2020-04-06 03:03:19 +00:00
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
2016-10-29 15:07:15 +00:00
require ('milfs/xajax/xajax.inc.php');
$xajax = new xajax();
//require ('json.lab.php');
require ('milfs/funciones/funciones.php');
require ("milfs/funciones/conex.php");
include ('milfs/librerias/parsedown/Parsedown.php');
2016-10-29 15:07:15 +00:00
//require_once ('includes/markdown.php');
//require ('funciones/convert.php');
2020-04-06 03:03:19 +00:00
$xajax->processRequests();
2016-10-29 15:07:15 +00:00
//if($_REQUEST[id2] =='') {$agregar= $_REQUEST[id];}else {$agregar = $_REQUEST[id2];}
2019-08-08 12:48:53 +00:00
if(isset($_REQUEST['categoria']) AND isset($_REQUEST['buscar'])) {
2017-10-15 23:41:18 +00:00
$cadena_busqueda = "$_REQUEST[buscar]";
2020-04-06 03:03:19 +00:00
$_REQUEST['buscar'] = "$_REQUEST[categoria]:$_REQUEST[buscar]";
2017-03-17 00:46:38 +00:00
}
2019-07-26 17:10:00 +00:00
$formulario_nombre = remplacetas('form_id','id',$_REQUEST[id],'nombre',"","") ;
$formulario_descripcion = remplacetas('form_id','id',$_REQUEST[id],'descripcion',"","") ;
2017-10-15 23:41:18 +00:00
$descripcion_meta = preg_replace("[\n|\r|\n\r|\t]",'', strip_tags($formulario_descripcion[0]));
2019-07-26 17:10:00 +00:00
$agregar_nombre = remplacetas('form_id','id',$agregar,'nombre',"","") ;
$id_empresa = remplacetas('form_id','id',$_REQUEST[id],'id_empresa',"","") ;
$twitter = remplacetas('empresa','id',"$id_empresa[0]",'twitter','',"","") ;
2017-10-15 23:41:18 +00:00
if($twitter[0] =="") {$twitter[0] ="@tupaleCo";}
2019-07-26 17:10:00 +00:00
$logo = remplacetas('empresa','id',"$id_empresa[0]",'imagen','',"","") ;
$razon_social = remplacetas('empresa','id',"$id_empresa[0]",'razon_social','',"","") ;
2017-03-17 00:46:38 +00:00
$campos_formulario = input_campos("$_REQUEST[id]","categoria");
2017-10-15 23:41:18 +00:00
$uri = "$_SERVER[SERVER_NAME]/$_SERVER[REQUEST_URI]";
2020-04-07 13:49:19 +00:00
$background_imagen = buscar_imagen("$_REQUEST[id]","","","$id_empresa[0]");
2016-10-29 15:07:15 +00:00
$plantilla ="mapa";
2019-08-08 12:48:53 +00:00
$categorias = lista_categorias($_REQUEST['id'],'','mapa') ;
2020-04-06 13:35:32 +00:00
$proveedor_mapa = remplacetas('form_parametrizacion','campo',$_REQUEST['id'],'descripcion'," tabla='form_id' and opcion = 'proveedor_mapa'") ;;
if($proveedor_mapa[0] !=""){
$proveedor ="'$proveedor_mapa[0]'";
}else{
$proveedor = "'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'";
2019-08-08 12:48:53 +00:00
2020-04-06 13:35:32 +00:00
}
2019-08-08 12:48:53 +00:00
$buscador ="
<form action='?id='$_REQUEST[id]' method='get'>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<input type='hidden' id='id' name='id' value='$_REQUEST[id]' >
$campos_formulario'
<div id='div_campos'></div>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<input type='text' id='buscar' name='buscar' class='form-control ' placeholder='Buscar' >
<br>
<input type='submit' class='btn btn-info btn-block ' value='Buscar'>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
</form>
<hr>
";
2016-10-29 15:07:15 +00:00
?>
2019-08-08 12:48:53 +00:00
2016-10-29 15:07:15 +00:00
<!DOCTYPE html>
<html lang="en">
<head >
2017-10-15 23:41:18 +00:00
<title><?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co</title>
2016-10-29 15:07:15 +00:00
<meta charset="utf-8">
2017-03-17 00:46:38 +00:00
<!-- <meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1"> -->
2016-10-29 15:07:15 +00:00
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2017-03-17 00:46:38 +00:00
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
2016-10-29 15:07:15 +00:00
<meta name="description" content="">
2017-10-15 23:41:18 +00:00
<meta NAME="Language" CONTENT="Spanish">
2020-04-07 12:02:02 +00:00
2017-10-15 23:41:18 +00:00
<meta NAME="Revisit" CONTENT="1 days">
<meta NAME="Distribution" CONTENT="Global">
<meta NAME="Robots" CONTENT="All">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="<?php echo $twitter[0]; ?>">
<meta name="twitter:creator" content="@qwerty_co">
<meta name="twitter:url" content="<?php echo $uri ; ?>">
<meta name="twitter:title" content="<?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co">
<meta name="twitter:description" content=" <?php echo $descripcion_meta; ?>">
<meta name="twitter:image" content="<?php echo "$_SESSION[url]images/secure/?file=full/$background_imagen"; ?>">
<meta property="og:type" content="article">
<meta property="og:title" content="<?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co" />
<meta property="og:type" content="website" />
<meta property="og:url" content="<?php echo "$uri"; ?>" />
<meta property="og:image" content="<?php echo "$_SESSION[url]images/secure/?file=full/$background_imagen"; ?>" />
<meta property="og:site_name" content="<?php echo $razon_social[0]; ?>" />
<meta property="og:description" content=" <?php echo $descripcion_meta; ?>" />
<link rel="shortcut icon" href="<?php echo "milfs/images/secure/?file=150/$logo[0]"; ?>">
2016-10-29 15:07:15 +00:00
<?php $xajax->printJavascript("milfs/xajax/"); ?>
<link rel="shortcut icon" href="favicon-152.png">
<link rel="apple-touch-icon-precomposed" href="favicon-152.png">
2017-05-02 19:35:01 +00:00
<link rel="stylesheet" href="librerias/leaflet/leaflet.css" />
2020-04-07 12:02:02 +00:00
<script src="milfs/js/scripts.js"></script>
2020-04-06 03:03:19 +00:00
<?php
2019-07-26 17:10:00 +00:00
$otro_json = remplacetas('form_parametrizacion','campo',$_REQUEST[id],'descripcion'," tabla='form_id' and opcion = 'json'","","") ;;
2017-06-24 22:04:40 +00:00
//$obj = file_get_contents('https://www.kleper.net/wiki/RutaPazTerritorial.geojson');
$ids = json_decode($otro_json[0]);
foreach ($ids as $clave => $valor) {
if($valor !=""){
2020-04-06 03:03:19 +00:00
2017-06-24 22:04:40 +00:00
$obj=file_get_contents("$valor[0]");
$li .="<script>var geojsonAuxiliar_$clave = $obj ;</script>";
$layer .= "
var geojsonAux_$clave = L.geoJson(geojsonAuxiliar_$clave, {
2017-03-17 00:46:38 +00:00
2017-06-24 22:04:40 +00:00
pointToLayer: function(feature, latlng) {
var smallIcon = new L.Icon({
2017-10-06 23:29:37 +00:00
iconSize: [100, 100],
2017-06-24 22:04:40 +00:00
iconAnchor: [13, 27],
popupAnchor: [1, -24],
2020-04-07 12:02:02 +00:00
className: 'mapIcon',
2017-06-24 22:04:40 +00:00
/*iconUrl: feature.properties.icon.iconUrl*/
iconUrl: 'https://tupale.co/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png'
});
return L.marker(latlng, {icon: smallIcon});
},
onEachFeature: function(feature, layer) {
var popupText = feature.properties.description
2020-04-06 03:03:19 +00:00
2017-06-24 22:04:40 +00:00
layer.bindPopup(popupText); }
});
2020-04-06 03:03:19 +00:00
2017-06-24 22:04:40 +00:00
";
$add_layer .= "markers.addLayer(geojsonAux_$clave);";
$capas_nombre .="geojsonAux_$clave,";
$capas .= "{
'$clave': geojsonAux_$clave
};";
2020-04-06 03:03:19 +00:00
$overlays ="
2017-06-24 22:04:40 +00:00
var overlays = $capas ";
}
}
2017-10-15 23:41:18 +00:00
2017-06-24 22:04:40 +00:00
echo $li;
2020-04-06 03:03:19 +00:00
2017-06-24 22:04:40 +00:00
?>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="librerias/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="librerias/leaflet/css/leaflet-sidebar.css" />
2019-08-30 16:56:24 +00:00
<link rel="stylesheet" href="librerias/bootstrap/css/bootstrap.min.css" />
2020-04-07 12:02:02 +00:00
<?php
$hoja_css = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='hoja_css' and opcion = 'hoja_css' and id_empresa = '$id_empresa[0]'") ;
if ($hoja_css[0] ==""){ $hoja_estilo ="<link href='./milfs/css/style.css' rel='stylesheet'>";}
else{ $hoja_estilo ="<link href='$hoja_css[0]' rel='stylesheet'>";}
print $hoja_estilo;
2020-04-07 13:49:19 +00:00
$css_adicional = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='css' and opcion = 'adicional' and id_empresa = '$id_empresa[0]'") ;
2020-04-07 12:02:02 +00:00
if($css_adicional[0] !="") {
2020-04-07 13:39:08 +00:00
$css_adicional ="<style>
2020-04-07 12:02:02 +00:00
$css_adicional[0]
2020-04-07 13:39:08 +00:00
2020-04-07 12:02:02 +00:00
</style>";
}
2016-10-29 15:07:15 +00:00
2020-04-07 13:49:19 +00:00
print $css_adicional;
2020-04-07 12:02:02 +00:00
?>
2019-08-08 12:48:53 +00:00
<style>
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
</style>
2020-04-06 03:03:19 +00:00
2016-10-29 15:07:15 +00:00
</head>
<body onload="">
2020-04-07 12:02:02 +00:00
<!-- modal -->
<div class='modal fade ' id='muestraInfo' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true' data-backdrop='static' data-keyboard='false'>
<div class='modal-dialog modal-MD' style='' >
<div class='modal-content'>
<div class='modal-header' >
<button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;</button>
<h4 class='modal-title' id='myModalLabel_info'><div id='titulo_modal'></div></h4>
</div>
<div class='modal-body'>
<div id='muestra_form'></div>
</div>
<div class='modal-footer' id='pie_modal'>
</div>
</div>
</div>
</div>
<!-- modal -->
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<!-- optionally define the sidebar content via HTML markup -->
<div id="sidebar" class="leaflet-sidebar collapsed">
<!-- nav tabs -->
2020-04-06 12:02:04 +00:00
<div class="leaflet-sidebar-tabs" >
2019-08-08 12:48:53 +00:00
<!-- top aligned tabs -->
<ul role="tablist">
<li><a href="#home" role="tab"><i class="fa fa-bars active"></i></a></li>
<li><a href="#search" role="tab"><i class="fa fa-search active"></i></a></li>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
</ul>
<!-- bottom aligned tabs -->
<ul role="tablist">
<li><a href="https://tupale.co"><img title='Powered by Tupale.co' alt='http://tupale.co' class='img img-responsive' src='https://tupale.co/images/icons/icon-152x152.png'></a></li>
</ul>
</div>
<!-- panel content -->
<div class="leaflet-sidebar-content">
<div class="leaflet-sidebar-pane" id="home">
<h1 class="leaflet-sidebar-header">
<span id='formulario_titulo_mapa'><?php echo $formulario_nombre[0] ?></span>
<span class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></span>
</h1>
<hr>
<label id='formulario_descripcion_mapa'><?php echo $formulario_descripcion[0] ?></label>
<center>
2020-04-07 12:02:02 +00:00
<span class="label label-warning">Click en el mapa para agregar datos.</span>
</center>
2019-08-08 12:48:53 +00:00
<hr>
2020-04-07 12:02:02 +00:00
<div id='div_categorias'>
2019-08-08 12:48:53 +00:00
<?php echo $categorias; ?>
2020-04-07 12:02:02 +00:00
</div>
2019-08-08 12:48:53 +00:00
</div>
<div class="leaflet-sidebar-pane" id="search">
<label>Buscar en el Mapa</label>
<?php echo $buscador; ?>
</div>
2017-03-17 00:46:38 +00:00
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
</div>
</div>
2017-03-17 00:46:38 +00:00
2020-04-07 12:02:02 +00:00
<div id="map" title='Click en el mapa para agregar datos.'></div>
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
<script src="librerias/leaflet/leaflet.js" crossorigin=""></script>
<script src="librerias/leaflet/leaflet-providers.js"></script>
<script src="librerias/leaflet/js/leaflet-sidebar.js"></script>
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.css" />
<link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.Default.css" />
<script src="librerias/leaflet/dist/leaflet.markercluster-src.js"></script>
2020-04-07 12:02:02 +00:00
<script src="https://code.jquery.com/jquery-3.3.1.js" ></script>
<script src="./librerias/bootstrap/js/bootstrap.min.js" ></script>
<!-- <script src="librerias/jquery/jquery-2.1.4.min.js"></script> -->
2020-04-06 11:20:30 +00:00
<?php $cadena_busqueda = $_REQUEST['buscar']; ?>
<script type="text/javascript" src="milfs/geojson.js.php?id=<?php echo $_REQUEST['id'] ?>&buscar=<?php echo $cadena_busqueda ?>&item=<?php echo $_REQUEST['item'] ?>"></script>
2019-08-30 16:56:24 +00:00
<script src="https://unpkg.com/leaflet-responsive-popup@0.6.4/leaflet.responsive.popup.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet-responsive-popup@0.6.4/leaflet.responsive.popup.css" />
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
<script>
2020-04-06 11:20:30 +00:00
// standard leaflet map setup ??
2019-08-08 12:48:53 +00:00
var map = L.map('map');
// map.setView([51.2, 7], 9);
2020-04-06 13:35:32 +00:00
// L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
//L.tileLayer.provider('Stamen.Watercolor').addTo(map);
L.tileLayer(<?php echo $proveedor; ?>, {
2019-08-08 12:48:53 +00:00
maxZoom: 19,
attribution: "Map data &copy; OpenStreetMap contributors <a href='https://tupale.co'>Powered by Tupale.co</a>"
}).addTo(map);
2020-04-06 03:03:19 +00:00
2017-03-17 00:46:38 +00:00
var geojson = L.geoJson(geojsonSample, {
pointToLayer: function(feature, latlng) {
2016-10-29 15:07:15 +00:00
var smallIcon = new L.Icon({
2020-04-07 12:02:02 +00:00
iconSize: [70, 70],
2016-10-29 15:07:15 +00:00
iconAnchor: [13, 27],
popupAnchor: [1, -24],
2019-08-08 12:48:53 +00:00
autoPanPadding: [30,30],
2020-04-07 12:02:02 +00:00
className: 'mapIcon',
2020-04-06 03:03:19 +00:00
2016-10-29 15:07:15 +00:00
iconUrl: feature.properties.icon.iconUrl
2020-04-06 03:03:19 +00:00
2016-10-29 15:07:15 +00:00
});
2019-08-08 12:48:53 +00:00
return L.marker(latlng, {icon: smallIcon });
2016-10-29 15:07:15 +00:00
},
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
onEachFeature: function(feature, layer) {
layer._leaflet_id = feature.properties.control;
2020-04-06 03:03:19 +00:00
2019-08-30 16:56:24 +00:00
var popupText = L.responsivePopup().setContent(feature.properties.description );
layer.bindPopup(popupText, {
maxWidth: 200
});
2020-04-06 03:03:19 +00:00
layer.bindTooltip(feature.properties.title).openTooltip();
2019-08-08 12:48:53 +00:00
}
});
2020-04-06 03:03:19 +00:00
2017-06-24 22:04:40 +00:00
<?php echo $layer; ?>
2019-08-08 12:48:53 +00:00
2017-06-24 22:04:40 +00:00
// markers.addLayer(geojsonAux);
2020-04-06 03:03:19 +00:00
2020-04-17 23:40:07 +00:00
var markers = L.markerClusterGroup({
spiderfyOnMaxZoom: true,
showCoverageOnHover: false,
zoomToBoundsOnClick: true,
maxClusterRadius: 25,
chunkedLoading: true
});
2020-04-06 03:03:19 +00:00
2020-04-17 23:40:07 +00:00
// var markers = L.markerClusterGroup();
2020-04-06 11:20:30 +00:00
// var markers = L.layerGroup();
2020-04-06 03:03:19 +00:00
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
markers.addLayer(geojson).addTo(map);
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
<?php echo $add_layer; ?>
map.fitBounds(geojson.getBounds().pad(Math.sqrt(2) /4));
2016-10-29 15:07:15 +00:00
2019-08-08 12:48:53 +00:00
// create the sidebar instance and add it to the map
var sidebar = L.control.sidebar({ container: 'sidebar', autopan: true })
.addTo(map)
.open('home');
2017-06-24 22:04:40 +00:00
2019-08-08 12:48:53 +00:00
function openMarkerPopup(e){
const markerID = e.id;
const marker = markers.getLayer(markerID);
marker.openPopup();
}
2016-10-29 15:07:15 +00:00
2020-04-07 12:02:02 +00:00
function onMapClick(e) {
var coordenadas =""+e.latlng.lat+"|"+e.latlng.lng;
setCookie('ubicacion',coordenadas, 1);
// alert("You clicked the map at " + e.latlng);
sidebar.close();
xajax_formulario_embebido_ajax("","<?php echo $_REQUEST[id]; ?>","","");
}
map.on('click', onMapClick);
2019-08-08 12:48:53 +00:00
// add panels dynamically to the sidebar
2016-10-29 15:07:15 +00:00
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
sidebar.on('content', function (ev) {
switch (ev.id) {
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
case 'autopan':
sidebar.options.autopan = true;
break;
default:sidebar.options.autopan = true;
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
}
});
2020-04-06 03:03:19 +00:00
2019-08-08 12:48:53 +00:00
</script>
2020-04-06 03:03:19 +00:00
<script language="JavaScript">
if (screen.width<1024)
//codigo resolución pequeña
sidebar.close();
2020-04-06 03:03:19 +00:00
else
sidebar.open();
</script>
2016-10-29 15:07:15 +00:00
</body>
2017-05-02 18:29:22 +00:00
</html>