tupali/mapero.php

307 lines
11 KiB
PHP
Raw Normal View History

2016-10-29 15:07:15 +00:00
<?php session_start();
if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
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');
$xajax->processRequests();
//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]";
$_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]";
$background_imagen = buscar_imagen("$_REQUEST[id]","","","$id_empresa");
2016-10-29 15:07:15 +00:00
$plantilla ="mapa";
2019-08-08 12:48:53 +00:00
$categorias = lista_categorias($_REQUEST['id'],'','mapa') ;
$buscador ="
<form action='?id='$_REQUEST[id]' method='get'>
<input type='hidden' id='id' name='id' value='$_REQUEST[id]' >
$campos_formulario'
<div id='div_campos'></div>
<input type='text' id='buscar' name='buscar' class='form-control ' placeholder='Buscar' >
<br>
<input type='submit' class='btn btn-info btn-block ' value='Buscar'>
</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">
<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" />
2019-08-08 12:48:53 +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 !=""){
$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],
/*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
layer.bindPopup(popupText); }
});
";
$add_layer .= "markers.addLayer(geojsonAux_$clave);";
$capas_nombre .="geojsonAux_$clave,";
$capas .= "{
'$clave': geojsonAux_$clave
};";
$overlays ="
var overlays = $capas ";
}
}
2017-10-15 23:41:18 +00:00
2017-06-24 22:04:40 +00:00
echo $li;
?>
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" />
2016-10-29 15:07:15 +00:00
2019-08-08 12:48:53 +00:00
<style>
body {
padding: 0;
margin: 0;
}
2017-10-06 16:09:19 +00:00
2019-08-08 12:48:53 +00:00
html, body, #map {
height: 100%;
2016-10-29 15:07:15 +00:00
2019-08-08 12:48:53 +00:00
}
2017-03-17 00:46:38 +00:00
2019-08-30 16:56:24 +00:00
2019-08-08 12:48:53 +00:00
</style>
2016-10-29 15:07:15 +00:00
</head>
<body onload="">
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 -->
2019-08-30 16:56:24 +00:00
<div class="leaflet-sidebar-tabs" onmouseover="sidebar.open('home')";>
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>
</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>
<a href='/g<?php echo $_REQUEST[id]; ?>' target='_blank' class="btn btn-default btn-xs"><i class="fa fa-plus-circle" aria-hidden="true"></i> Agregar</a> <br>
<span class="label label-warning">Despues de agregar, recarga el mapa</span>
</center>
2019-08-08 12:48:53 +00:00
<hr>
<?php echo $categorias; ?>
</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
2019-08-08 12:48:53 +00:00
</div>
</div>
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
<div id="map"></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>
<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>
<script src="librerias/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="milfs/geojson.js.php?id=<?php echo $_REQUEST['id'] ?>&buscar=<?php echo $_REQUEST['buscar'] ?>&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>
// standard leaflet map setup
var map = L.map('map');
// map.setView([51.2, 7], 9);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: "Map data &copy; OpenStreetMap contributors <a href='https://tupale.co'>Powered by Tupale.co</a>"
}).addTo(map);
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({
2019-08-08 12:48:53 +00:00
iconSize: [50, 50],
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],
2016-10-29 15:07:15 +00:00
iconUrl: feature.properties.icon.iconUrl
2017-10-15 23:41:18 +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;
2019-08-30 16:56:24 +00:00
var popupText = L.responsivePopup().setContent(feature.properties.description );
layer.bindPopup(popupText, {
maxWidth: 200
});
2019-08-08 12:48:53 +00:00
layer.bindTooltip(feature.properties.title).openTooltip();
}
});
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);
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
//var markers = L.markerClusterGroup();
var markers = L.layerGroup();
2017-03-17 00:46:38 +00:00
2019-08-08 12:48:53 +00:00
markers.addLayer(geojson).addTo(map);
<?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
2019-08-08 12:48:53 +00:00
// add panels dynamically to the sidebar
2016-10-29 15:07:15 +00:00
2019-08-08 12:48:53 +00:00
sidebar.on('content', function (ev) {
switch (ev.id) {
2019-08-08 12:48:53 +00:00
case 'autopan':
sidebar.options.autopan = true;
break;
default:sidebar.options.autopan = true;
2019-08-08 12:48:53 +00:00
}
});
</script>
<script language="JavaScript">
if (screen.width<1024)
//codigo resolución pequeña
sidebar.close();
else
sidebar.open();
</script>
2016-10-29 15:07:15 +00:00
</body>
2017-05-02 18:29:22 +00:00
</html>