Repositorio para la herramienta Tupale completo https://tupale.co
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
11KB

  1. <?php session_start();
  2. if(isset($_REQUEST['debug'])) {ini_set('display_errors', 'On');}
  3. require ('milfs/xajax/xajax.inc.php');
  4. $xajax = new xajax();
  5. //require ('json.lab.php');
  6. require ('milfs/funciones/funciones.php');
  7. require ("milfs/funciones/conex.php");
  8. include ('milfs/librerias/parsedown/Parsedown.php');
  9. //require_once ('includes/markdown.php');
  10. //require ('funciones/convert.php');
  11. $xajax->processRequests();
  12. //if($_REQUEST[id2] =='') {$agregar= $_REQUEST[id];}else {$agregar = $_REQUEST[id2];}
  13. if(isset($_REQUEST['categoria']) AND isset($_REQUEST['buscar'])) {
  14. $cadena_busqueda = "$_REQUEST[buscar]";
  15. $_REQUEST['buscar'] = "$_REQUEST[categoria]:$_REQUEST[buscar]";
  16. }
  17. $formulario_nombre = remplacetas('form_id','id',$_REQUEST[id],'nombre',"","") ;
  18. $formulario_descripcion = remplacetas('form_id','id',$_REQUEST[id],'descripcion',"","") ;
  19. $descripcion_meta = preg_replace("[\n|\r|\n\r|\t]",'', strip_tags($formulario_descripcion[0]));
  20. $agregar_nombre = remplacetas('form_id','id',$agregar,'nombre',"","") ;
  21. $id_empresa = remplacetas('form_id','id',$_REQUEST[id],'id_empresa',"","") ;
  22. $twitter = remplacetas('empresa','id',"$id_empresa[0]",'twitter','',"","") ;
  23. if($twitter[0] =="") {$twitter[0] ="@tupaleCo";}
  24. $logo = remplacetas('empresa','id',"$id_empresa[0]",'imagen','',"","") ;
  25. $razon_social = remplacetas('empresa','id',"$id_empresa[0]",'razon_social','',"","") ;
  26. $campos_formulario = input_campos("$_REQUEST[id]","categoria");
  27. $uri = "$_SERVER[SERVER_NAME]/$_SERVER[REQUEST_URI]";
  28. $background_imagen = buscar_imagen("$_REQUEST[id]","","","$id_empresa");
  29. $plantilla ="mapa";
  30. $categorias = lista_categorias($_REQUEST['id'],'','mapa') ;
  31. $buscador ="
  32. <form action='?id='$_REQUEST[id]' method='get'>
  33. <input type='hidden' id='id' name='id' value='$_REQUEST[id]' >
  34. $campos_formulario'
  35. <div id='div_campos'></div>
  36. <input type='text' id='buscar' name='buscar' class='form-control ' placeholder='Buscar' >
  37. <br>
  38. <input type='submit' class='btn btn-info btn-block ' value='Buscar'>
  39. </form>
  40. <hr>
  41. ";
  42. ?>
  43. <!DOCTYPE html>
  44. <html lang="en">
  45. <head >
  46. <title><?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co</title>
  47. <meta charset="utf-8">
  48. <!-- <meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1"> -->
  49. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  50. <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
  51. <meta name="description" content="">
  52. <meta NAME="Language" CONTENT="Spanish">
  53. <meta NAME="Revisit" CONTENT="1 days">
  54. <meta NAME="Distribution" CONTENT="Global">
  55. <meta NAME="Robots" CONTENT="All">
  56. <meta name="twitter:card" content="summary">
  57. <meta name="twitter:site" content="<?php echo $twitter[0]; ?>">
  58. <meta name="twitter:creator" content="@qwerty_co">
  59. <meta name="twitter:url" content="<?php echo $uri ; ?>">
  60. <meta name="twitter:title" content="<?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co">
  61. <meta name="twitter:description" content=" <?php echo $descripcion_meta; ?>">
  62. <meta name="twitter:image" content="<?php echo "$_SESSION[url]images/secure/?file=full/$background_imagen"; ?>">
  63. <meta property="og:type" content="article">
  64. <meta property="og:title" content="<?php echo "$formulario_nombre[0] / $cadena_busqueda" ?> tupale.co" />
  65. <meta property="og:type" content="website" />
  66. <meta property="og:url" content="<?php echo "$uri"; ?>" />
  67. <meta property="og:image" content="<?php echo "$_SESSION[url]images/secure/?file=full/$background_imagen"; ?>" />
  68. <meta property="og:site_name" content="<?php echo $razon_social[0]; ?>" />
  69. <meta property="og:description" content=" <?php echo $descripcion_meta; ?>" />
  70. <link rel="shortcut icon" href="<?php echo "milfs/images/secure/?file=150/$logo[0]"; ?>">
  71. <?php $xajax->printJavascript("milfs/xajax/"); ?>
  72. <link rel="shortcut icon" href="favicon-152.png">
  73. <link rel="apple-touch-icon-precomposed" href="favicon-152.png">
  74. <link rel="stylesheet" href="librerias/leaflet/leaflet.css" />
  75. <?php
  76. $otro_json = remplacetas('form_parametrizacion','campo',$_REQUEST[id],'descripcion'," tabla='form_id' and opcion = 'json'","","") ;;
  77. //$obj = file_get_contents('https://www.kleper.net/wiki/RutaPazTerritorial.geojson');
  78. $ids = json_decode($otro_json[0]);
  79. foreach ($ids as $clave => $valor) {
  80. if($valor !=""){
  81. $obj=file_get_contents("$valor[0]");
  82. $li .="<script>var geojsonAuxiliar_$clave = $obj ;</script>";
  83. $layer .= "
  84. var geojsonAux_$clave = L.geoJson(geojsonAuxiliar_$clave, {
  85. pointToLayer: function(feature, latlng) {
  86. var smallIcon = new L.Icon({
  87. iconSize: [100, 100],
  88. iconAnchor: [13, 27],
  89. popupAnchor: [1, -24],
  90. /*iconUrl: feature.properties.icon.iconUrl*/
  91. iconUrl: 'https://tupale.co/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png'
  92. });
  93. return L.marker(latlng, {icon: smallIcon});
  94. },
  95. onEachFeature: function(feature, layer) {
  96. var popupText = feature.properties.description
  97. layer.bindPopup(popupText); }
  98. });
  99. ";
  100. $add_layer .= "markers.addLayer(geojsonAux_$clave);";
  101. $capas_nombre .="geojsonAux_$clave,";
  102. $capas .= "{
  103. '$clave': geojsonAux_$clave
  104. };";
  105. $overlays ="
  106. var overlays = $capas ";
  107. }
  108. }
  109. echo $li;
  110. ?>
  111. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  112. <link href="librerias/font-awesome/css/font-awesome.min.css" rel="stylesheet">
  113. <link rel="stylesheet" href="librerias/leaflet/css/leaflet-sidebar.css" />
  114. <link rel="stylesheet" href="librerias/bootstrap/css/bootstrap.min.css" />
  115. <style>
  116. body {
  117. padding: 0;
  118. margin: 0;
  119. }
  120. html, body, #map {
  121. height: 100%;
  122. }
  123. </style>
  124. </head>
  125. <body onload="">
  126. <!-- optionally define the sidebar content via HTML markup -->
  127. <div id="sidebar" class="leaflet-sidebar collapsed">
  128. <!-- nav tabs -->
  129. <div class="leaflet-sidebar-tabs" onmouseover="sidebar.open('home')";>
  130. <!-- top aligned tabs -->
  131. <ul role="tablist">
  132. <li><a href="#home" role="tab"><i class="fa fa-bars active"></i></a></li>
  133. <li><a href="#search" role="tab"><i class="fa fa-search active"></i></a></li>
  134. </ul>
  135. <!-- bottom aligned tabs -->
  136. <ul role="tablist">
  137. <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>
  138. </ul>
  139. </div>
  140. <!-- panel content -->
  141. <div class="leaflet-sidebar-content">
  142. <div class="leaflet-sidebar-pane" id="home">
  143. <h1 class="leaflet-sidebar-header">
  144. <span id='formulario_titulo_mapa'><?php echo $formulario_nombre[0] ?></span>
  145. <span class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></span>
  146. </h1>
  147. <hr>
  148. <label id='formulario_descripcion_mapa'><?php echo $formulario_descripcion[0] ?></label>
  149. <hr>
  150. <?php echo $categorias; ?>
  151. </div>
  152. <div class="leaflet-sidebar-pane" id="search">
  153. <label>Buscar en el Mapa</label>
  154. <?php echo $buscador; ?>
  155. </div>
  156. </div>
  157. </div>
  158. <div id="map"></div>
  159. <script src="librerias/leaflet/leaflet.js" crossorigin=""></script>
  160. <script src="librerias/leaflet/leaflet-providers.js"></script>
  161. <script src="librerias/leaflet/js/leaflet-sidebar.js"></script>
  162. <link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.css" />
  163. <link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.Default.css" />
  164. <script src="librerias/leaflet/dist/leaflet.markercluster-src.js"></script>
  165. <script src="librerias/jquery/jquery-2.1.4.min.js"></script>
  166. <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>
  167. <script src="https://unpkg.com/leaflet-responsive-popup@0.6.4/leaflet.responsive.popup.js"></script>
  168. <link rel="stylesheet" href="https://unpkg.com/leaflet-responsive-popup@0.6.4/leaflet.responsive.popup.css" />
  169. <script>
  170. // standard leaflet map setup
  171. var map = L.map('map');
  172. // map.setView([51.2, 7], 9);
  173. L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  174. maxZoom: 19,
  175. attribution: "Map data &copy; OpenStreetMap contributors <a href='https://tupale.co'>Powered by Tupale.co</a>"
  176. }).addTo(map);
  177. var geojson = L.geoJson(geojsonSample, {
  178. pointToLayer: function(feature, latlng) {
  179. var smallIcon = new L.Icon({
  180. iconSize: [50, 50],
  181. iconAnchor: [13, 27],
  182. popupAnchor: [1, -24],
  183. autoPanPadding: [30,30],
  184. iconUrl: feature.properties.icon.iconUrl
  185. });
  186. return L.marker(latlng, {icon: smallIcon });
  187. },
  188. onEachFeature: function(feature, layer) {
  189. layer._leaflet_id = feature.properties.control;
  190. var popupText = L.responsivePopup().setContent(feature.properties.description );
  191. layer.bindPopup(popupText, {
  192. maxWidth: 200
  193. });
  194. layer.bindTooltip(feature.properties.title).openTooltip();
  195. }
  196. });
  197. <?php echo $layer; ?>
  198. // markers.addLayer(geojsonAux);
  199. //var markers = L.markerClusterGroup();
  200. var markers = L.layerGroup();
  201. markers.addLayer(geojson).addTo(map);
  202. <?php echo $add_layer; ?>
  203. map.fitBounds(geojson.getBounds().pad(Math.sqrt(2) /4));
  204. // create the sidebar instance and add it to the map
  205. var sidebar = L.control.sidebar({ container: 'sidebar', autopan: true })
  206. .addTo(map)
  207. .open('home');
  208. function openMarkerPopup(e){
  209. const markerID = e.id;
  210. const marker = markers.getLayer(markerID);
  211. marker.openPopup();
  212. }
  213. // add panels dynamically to the sidebar
  214. sidebar.on('content', function (ev) {
  215. switch (ev.id) {
  216. case 'autopan':
  217. sidebar.options.autopan = true;
  218. break;
  219. default:sidebar.options.autopan = true;
  220. }
  221. });
  222. </script>
  223. <script language="JavaScript">
  224. if (screen.width<1024)
  225. //codigo resolución pequeña
  226. sidebar.close();
  227. else
  228. sidebar.open();
  229. </script>
  230. </body>
  231. </html>