Repositorio para la herramienta Tupale completo
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.

417 lines
12KB

  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. //require_once ('includes/markdown.php');
  9. //require ('funciones/convert.php');
  10. $xajax->processRequests();
  11. //if($_REQUEST[id2] =='') {$agregar= $_REQUEST[id];}else {$agregar = $_REQUEST[id2];}
  12. if(isset($_REQUEST[categoria]) AND isset($_REQUEST[buscar])) {
  13. $_REQUEST[buscar] = "$_REQUEST[categoria]:$_REQUEST[buscar]";
  14. }
  15. $formulario_nombre = remplacetas('form_id','id',$_REQUEST[id],'nombre') ;
  16. $formulario_descripcion = remplacetas('form_id','id',$_REQUEST[id],'descripcion') ;
  17. $agregar_nombre = remplacetas('form_id','id',$agregar,'nombre') ;
  18. $id_empresa = remplacetas('form_id','id',$_REQUEST[id],'id_empresa') ;
  19. $logo = remplacetas('empresa','id',"$id_empresa[0]",'imagen','') ;
  20. $razon_social = remplacetas('empresa','id',"$id_empresa[0]",'razon_social','') ;
  21. $campos_formulario = input_campos("$_REQUEST[id]","categoria");
  22. $plantilla ="mapa";
  23. ?>
  24. <!DOCTYPE html>
  25. <html lang="en">
  26. <head >
  27. <title><?php echo $formulario_nombre[0] ?> MILFS</title>
  28. <meta charset="utf-8">
  29. <!-- <meta name="viewport" content="user-scalable=no, width=device-width, maximum-scale=1, initial-scale=1"> -->
  30. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  31. <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
  32. <meta name="description" content="">
  33. <?php $xajax->printJavascript("milfs/xajax/"); ?>
  34. <link rel="shortcut icon" href="favicon-152.png">
  35. <link rel="apple-touch-icon-precomposed" href="favicon-152.png">
  36. <link rel="stylesheet" href="librerias/leaflet/leaflet-search.css"/>
  37. <script src="librerias/leaflet/leaflet.js"></script>
  38. <script src="librerias/jquery/jquery-2.1.4.min.js"></script>
  39. <script src="librerias/leaflet/leaflet-providers.js"></script>
  40. <script src="librerias/leaflet/leaflet-search.js"></script>
  41. <link rel="stylesheet" type="text/css" media="screen" href="milfs/css/bootstrap.css">
  42. <link rel="stylesheet" href="librerias/leaflet/leaflet.css" />
  43. <script src="librerias/leaflet/leaflet.js"></script>
  44. <link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.css" />
  45. <link rel="stylesheet" href="librerias/leaflet/dist/MarkerCluster.Default.css" />
  46. <script src="librerias/leaflet/dist/leaflet.markercluster-src.js"></script>
  47. <script type="text/javascript" src="milfs/geojson.js.php?id=<?php echo $_REQUEST['id'] ?>&buscar=<?php echo $_REQUEST['buscar'] ?>"></script>
  48. <!-- <script type="text/javascript" src="http://localhost/default/tupali/milfs/geojson.js.php?id=358"></script> -->
  49. <!-- <script type="text/javascript" src="tmp/ruta_paz_territorial.geojson"></script> -->
  50. <?php
  51. $otro_json = remplacetas('form_parametrizacion','campo',$_REQUEST[id],'descripcion'," tabla='form_id' and opcion = 'json'") ;;
  52. //$obj = file_get_contents('https://www.kleper.net/wiki/RutaPazTerritorial.geojson');
  53. $ids = json_decode($otro_json[0]);
  54. foreach ($ids as $clave => $valor) {
  55. if($valor !=""){
  56. $obj=file_get_contents("$valor[0]");
  57. $li .="<script>var geojsonAuxiliar_$clave = $obj ;</script>";
  58. $layer .= "
  59. var geojsonAux_$clave = L.geoJson(geojsonAuxiliar_$clave, {
  60. pointToLayer: function(feature, latlng) {
  61. var smallIcon = new L.Icon({
  62. iconSize: [60, 60],
  63. iconAnchor: [13, 27],
  64. popupAnchor: [1, -24],
  65. iconUrl: feature.properties.icon.iconUrl
  66. /*iconUrl: 'https://tupale.co/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png'*/
  67. });
  68. return L.marker(latlng, {icon: smallIcon});
  69. },
  70. onEachFeature: function(feature, layer) {
  71. var popupText = feature.properties.description
  72. layer.bindPopup(popupText); }
  73. });
  74. ";
  75. $add_layer .= "markers.addLayer(geojsonAux_$clave);";
  76. $capas_nombre .="geojsonAux_$clave,";
  77. $capas .= "{
  78. '$clave': geojsonAux_$clave
  79. };";
  80. $overlays ="
  81. var overlays = $capas ";
  82. }
  83. }
  84. //$obj=file_get_contents("$otro_json[0]");
  85. //echo "<script>var geojsonAuxiliar = $obj ;</script>";
  86. echo $li;
  87. ?>
  88. <style type="text/css">
  89. @media (max-width: 800px) {
  90. .panel-map{
  91. max-width: 970px;
  92. }
  93. }
  94. @media (min-width: 800px) {
  95. .panel-map{
  96. max-width: 200px;
  97. }
  98. }
  99. .leaflet-popup-content { word-wrap: break-word !important; /*width:600px !important; */ }
  100. #map { position:absolute; top:0; bottom:0; width:100%; }
  101. /* Sticky footer styles
  102. -------------------------------------------------- */
  103. .footer {
  104. position: absolute;
  105. bottom: 3px;
  106. width: 95%;
  107. margin: 0 auto;
  108. height: 120px;
  109. /* Set the fixed height of the footer here */
  110. z-index: 999999;
  111. }
  112. #div_leyenda {
  113. padding: 2px;
  114. background-color: white;
  115. border-radius: 3px;
  116. width: 90%;
  117. overflow-x: scroll;
  118. }
  119. .modal-dialog {
  120. width: 70%;
  121. height: 50%;
  122. padding: 0;
  123. }
  124. .modal-content {
  125. height: 50%;
  126. }
  127. ::-webkit-scrollbar {
  128. width: 12px;
  129. }
  130. ::-webkit-scrollbar-track {
  131. -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
  132. border-radius: 10px;
  133. }
  134. ::-webkit-scrollbar-thumb {
  135. border-radius: 10px;
  136. -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5);
  137. }
  138. </style>
  139. <?php
  140. $categorias = lista_categorias($_REQUEST['id'],'','') ;
  141. $css_adicional = remplacetas('form_parametrizacion','campo',"index",'descripcion'," tabla='css' and opcion = 'adicional' and id_empresa = '$id_empresa[0]'") ;
  142. if($css_adicional[0] !="") {
  143. $css_adicional ="<style >
  144. $css_adicional[0]
  145. <!-- adicional -->
  146. </style>";
  147. }
  148. else {
  149. $css_adicional ="<style ><!-- nada --></style>";
  150. }
  151. echo $css_adicional; ?>
  152. </head>
  153. <body>
  154. <!--nav sidebar -->
  155. <aside>
  156. <nav class="navbar navbar-inverse sidebar navbar-fixed-top" role="navigation">
  157. <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
  158. <link href="librerias/leaflet/css/sidebar.css" rel="stylesheet">
  159. <div class="nav-side-menu">
  160. <div class="brand"><a href="./"><img style='width: 100%;' src='images/banner.png' class='image-responsive'></a><br> <i class="fa fa-info-circle fa-lg pull-right" style="margin-top: 10px; margin-right: 5px;"></i></div>
  161. <i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
  162. <br>
  163. <form action="?id=<?php echo $_REQUEST[id]; ?>" method="get">
  164. <div class='input-group '>
  165. <input type='hidden' id='id' name='id' value="<?php echo $_REQUEST[id]; ?>" >
  166. <?php echo $campos_formulario; ?><div id='div_campos'></div>
  167. <input type='text' id='buscar' name='buscar' class='form-control' placeholder='Buscar' >
  168. <input type="submit" class="btn btn-info " value="Buscar">
  169. </div>
  170. </form>
  171. <hr>
  172. <div class="menu-list">
  173. <div style='width: calc(90% - 40px);;' class="container-fluid">
  174. <h1><?php echo $formulario_nombre[0]; ?></h1>
  175. <h2><?php echo $formulario_descripcion[0]; ?></h2>
  176. <hr>
  177. <h3>Categorías</h3>
  178. <div style="height: 300px; overflow: auto;" >
  179. <?php echo $categorias; ?>
  180. </div>
  181. <div class="sidebar-logo">
  182. <a href="e<?php echo $id_empresa[0]; ?>" >
  183. <img style='margin: 0px auto;' class='img img-responsive block-center' src="milfs/images/secure/?file=150/<?php echo $logo[0]; ?>" alt="<?php echo $razon_social[0]; ?>">
  184. <h4><?php echo $razon_social[0]; ?></h4>
  185. </a>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </nav>
  191. </aside>
  192. <div id="map"></div>
  193. <?php
  194. if($categorias !="") {
  195. $pie="
  196. <div style='' class='' id='contenedor_pie' >
  197. <div style='' class='container' >
  198. <a href='#' onclick=\"xajax_limpia_div('contenedor_pie'); \"><span class='pull-right'><i class='fa fa-times'></i></span></a>
  199. $categorias
  200. </div></div>
  201. </div>";
  202. $leyenda ="<div id='div_leyenda'><a class='btn btn-default btn-xs' onclick=xajax_contenido_ocultar('div_leyenda');>Cerrar</a> $categorias </div> ";
  203. }else{
  204. }
  205. //echo $pie;
  206. ?>
  207. <script type="text/javascript">
  208. function htmlbodyHeightUpdate(){
  209. var height3 = $( window ).height()
  210. var height1 = $('.nav').height()+50
  211. height2 = $('.main').height()
  212. if(height2 > height3){
  213. $('html').height(Math.max(height1,height3,height2)+10);
  214. $('body').height(Math.max(height1,height3,height2)+10);
  215. }
  216. else
  217. {
  218. $('html').height(Math.max(height1,height3,height2));
  219. $('body').height(Math.max(height1,height3,height2));
  220. }
  221. }
  222. $(document).ready(function () {
  223. htmlbodyHeightUpdate()
  224. $( window ).resize(function() {
  225. htmlbodyHeightUpdate()
  226. });
  227. $( window ).scroll(function() {
  228. height2 = $('.main').height()
  229. htmlbodyHeightUpdate()
  230. });
  231. });
  232. function htmlbodyHeightUpdate(){
  233. var height3 = $( window ).height()
  234. var height1 = $('.nav').height()+50
  235. height2 = $('.main').height()
  236. if(height2 > height3){
  237. $('html').height(Math.max(height1,height3,height2)+10);
  238. $('body').height(Math.max(height1,height3,height2)+10);
  239. }
  240. else
  241. {
  242. $('html').height(Math.max(height1,height3,height2));
  243. $('body').height(Math.max(height1,height3,height2));
  244. }
  245. }
  246. $(document).ready(function () {
  247. htmlbodyHeightUpdate()
  248. $( window ).resize(function() {
  249. htmlbodyHeightUpdate()
  250. });
  251. $( window ).scroll(function() {
  252. height2 = $('.main').height()
  253. htmlbodyHeightUpdate()
  254. });
  255. });
  256. var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  257. maxZoom: 18,
  258. attribution: '&copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
  259. }),
  260. latlng = L.latLng(4, -74.9005222);
  261. var map = L.map('map', {center: latlng, zoom: 5, layers: [tiles],zoomControl: false});
  262. var geojson = L.geoJson(geojsonSample, {
  263. pointToLayer: function(feature, latlng) {
  264. var smallIcon = new L.Icon({
  265. iconSize: [60, 60],
  266. iconAnchor: [13, 27],
  267. popupAnchor: [1, -24],
  268. iconUrl: feature.properties.icon.iconUrl
  269. /* iconUrl: "http://localhost/default/tupali/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png"*/
  270. });
  271. return L.marker(latlng, {icon: smallIcon});
  272. },
  273. onEachFeature: function(feature, layer) {
  274. var popupText = feature.properties.description
  275. layer.bindPopup(popupText); }
  276. });
  277. /*
  278. var geojsonAux = L.geoJson(geojsonAuxiliar, {
  279. pointToLayer: function(feature, latlng) {
  280. var smallIcon = new L.Icon({
  281. iconSize: [60, 60],
  282. iconAnchor: [13, 27],
  283. popupAnchor: [1, -24],
  284. iconUrl: "http://localhost/default/tupali/milfs/images/secure/?file=150/da6d16547658ebc06c5378b30d1ee4bf.png"
  285. });
  286. return L.marker(latlng, {icon: smallIcon});
  287. },
  288. onEachFeature: function(feature, layer) {
  289. var popupText = feature.properties.description
  290. layer.bindPopup(popupText); }
  291. });
  292. */
  293. <?php echo $layer; ?>
  294. var markers = L.markerClusterGroup();
  295. markers.addLayer(geojson);
  296. // markers.addLayer(geojsonAux);
  297. <?php echo $add_layer; ?>
  298. map.fitBounds(geojson.getBounds());
  299. var legend = L.control({position: 'bottomright'});
  300. //disable zoomControl when initializing map (which is topleft by default)
  301. ///L.control.layers(<?php echo $capas_nombre; ?>).addTo(map);
  302. /* //add zoom control with your options
  303. L.control.zoom({
  304. position:'topright'
  305. }).addTo(map);
  306. */
  307. legend.onAdd = function (map) {
  308. var div = L.DomUtil.create('div', 'info legend');
  309. div.innerHTML = "";
  310. div.id = "info legend"
  311. return div;
  312. };
  313. legend.addTo(map);
  314. map.addLayer(markers);
  315. </script>
  316. </body>
  317. </html>