Browse Source

updated the map

master
n0m1s 10 years ago
parent
commit
f55a9af934
2 changed files with 14 additions and 12 deletions
  1. +4
    -1
      event.css
  2. +10
    -11
      event.php

+ 4
- 1
event.css View File

@ -37,7 +37,10 @@ h1 img
margin-bottom:-100px; margin-bottom:-100px;
} }
iframe {
#map {
width: 100%;
height: 500px;
margin-bottom: -30px;
background-image: url("images/OSM.svg"); background-image: url("images/OSM.svg");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;


+ 10
- 11
event.php View File

@ -22,6 +22,9 @@ $dtend = strtotime($event['event_dtend']);
<link rel="stylesheet" href="./event.css" /> <link rel="stylesheet" href="./event.css" />
<link rel="icon" type="image/png" href="favicon.png" /> <link rel="icon" type="image/png" href="favicon.png" />
<!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]--> <!--[if IE]><link rel="shortcut icon" type="image/x-icon" href="favicon.ico" /><![endif]-->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
</head> </head>
<body> <body>
<?php include('header.php'); ?> <?php include('header.php'); ?>
@ -34,17 +37,16 @@ $dtend = strtotime($event['event_dtend']);
<div id="dateheure"> <div id="dateheure">
<?php echo htmlentities(printableDateTime($dtstart, $dtend)); ?> <?php echo htmlentities(printableDateTime($dtstart, $dtend)); ?>
</div> </div>
<?php
echo '<div id="lieu">'.$event["event_localisation"].'</div>';
<div id="lieu"><?php echo $event['event_localisation']; ?></div>
<?php
$url = 'https://nominatim.openstreetmap.org/search?format=json&q='.urlencode($event["event_localisation"]); $url = 'https://nominatim.openstreetmap.org/search?format=json&q='.urlencode($event["event_localisation"]);
$obj = json_decode(file_get_contents($url), true); $obj = json_decode(file_get_contents($url), true);
$lat = $obj[0]["lat"]; $lat = $obj[0]["lat"];
$lng = $obj[0]["lon"]; $lng = $obj[0]["lon"];
$urlFrame = 'https://www.openstreetmap.org/export/embed.html?bbox='.$lng.','.$lat.','.$lng.','.$lat.'&layer=mapnik&floor';
echo '<iframe frameborder="0" scrolling="no"
marginheight="0" marginwidth="0"
src="'.$urlFrame.'" style="width:100%;height:500px;margin-bottom:-30px;"></iframe>';
$urlFrame = 'https://www.openstreetmap.org/export/embed.html?bbox='.$lng.','.$lat.','.$lng.','.$lat.'&layer=mapnik&floor&marker='.$lat.','.$lng;
?>
<iframe id="map" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<?php echo $urlFrame; ?>"></iframe>;
<?php
if(isset($event["event_urlImage"]) || isset($event["event_description"])) if(isset($event["event_urlImage"]) || isset($event["event_description"]))
echo '<div id="descDiv" style="margin-top:30px;"><h2>Description</h2></div>'; echo '<div id="descDiv" style="margin-top:30px;"><h2>Description</h2></div>';
if(isset($event["event_urlImage"])) if(isset($event["event_urlImage"]))
@ -58,11 +60,8 @@ $dtend = strtotime($event['event_dtend']);
echo '<div id="URL">URL : <a href="'.$event["event_site"].'">'.$event["event_site"].'</a></div>'; echo '<div id="URL">URL : <a href="'.$event["event_site"].'">'.$event["event_site"].'</a></div>';
if(isset($event["event_contact"])) if(isset($event["event_contact"]))
echo '<div id="Contact">Contact : <a href="mailto:'.$event["event_contact"].'">'.$event["event_contact"].'</a></div>'; echo '<div id="Contact">Contact : <a href="mailto:'.$event["event_contact"].'">'.$event["event_contact"].'</a></div>';
?>
?>
</div> </div>
<!-- bring in the google maps library -->
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
</body> </body>
</html> </html>

Loading…
Cancel
Save