2023-07-11 18:03:40 +02:00
|
|
|
<?php include("core.php"); ?>
|
2023-07-13 18:31:31 +02:00
|
|
|
|
2023-07-10 19:36:11 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
2023-07-11 18:03:40 +02:00
|
|
|
|
2023-07-10 19:36:11 +02:00
|
|
|
<head>
|
2023-07-14 18:14:00 +02:00
|
|
|
<meta name="viewport" content="width=device-width" />
|
2023-07-14 18:14:37 +02:00
|
|
|
<title>Carte des brocantes référencées sur le site Sabradou.com</title>
|
2023-07-13 21:04:57 +02:00
|
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
|
|
|
<script src="index.js"></script>
|
2023-07-13 18:31:31 +02:00
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.css" />
|
2023-07-11 18:03:40 +02:00
|
|
|
<link rel="stylesheet" href="style.css" />
|
2023-07-10 19:36:11 +02:00
|
|
|
</head>
|
2023-07-11 18:03:40 +02:00
|
|
|
|
2023-07-14 11:04:42 +02:00
|
|
|
<body>
|
2023-07-11 18:28:08 +02:00
|
|
|
<div class="header">
|
2023-07-13 18:31:31 +02:00
|
|
|
<h1>GÉOLOCALISATION DES BROCANTES RÉFÉRENCÉES</h1>
|
|
|
|
<h2>SUR LE SITE <a href="https://www.sabradou.com/" target="_blank">SABRADOU.COM</a></h2>
|
2023-07-13 21:04:57 +02:00
|
|
|
<form if="form" action="index.php" method="GET">
|
2023-07-14 18:14:00 +02:00
|
|
|
<label for="calendrier">Géolocaliser les brocantes du </label>
|
2023-07-14 16:22:23 +02:00
|
|
|
<select name="calendrier" onchange="this.form.submit();" id="calendrier-list">
|
2023-07-11 18:03:40 +02:00
|
|
|
<?php $calendrier = getCalendrier(); ?>
|
|
|
|
<?php foreach ($calendrier as $item): ?>
|
2023-07-14 16:22:23 +02:00
|
|
|
<?php $selected = isset($_GET['calendrier']) && $_GET['calendrier'] === $item['url'] ? 'selected' : ''; ?>
|
|
|
|
<option value="<?php echo $item['url']; ?>" <?php echo $selected; ?>><?php echo $item['node']; ?>
|
|
|
|
</option>
|
|
|
|
<?php endforeach; ?>
|
2023-07-11 18:03:40 +02:00
|
|
|
</select>
|
|
|
|
</form>
|
|
|
|
</div>
|
2023-07-13 18:31:31 +02:00
|
|
|
<div class="container">
|
2023-07-14 11:11:37 +02:00
|
|
|
<div class="map-column">
|
2023-07-13 18:31:31 +02:00
|
|
|
<?php
|
2023-07-14 16:22:23 +02:00
|
|
|
$jour = isset($_GET['calendrier']) ? $_GET['calendrier'] : '';
|
|
|
|
$citiesList = getCities($jour);
|
|
|
|
$citiesGeoCode = geocode($citiesList);
|
|
|
|
?>
|
|
|
|
<div id="map"></div>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.7.1/leaflet.js"></script>
|
|
|
|
<script>
|
|
|
|
// Tableau des villes et des coordonnées
|
|
|
|
var cities = <?php echo json_encode($citiesGeoCode); ?>;
|
2023-07-13 18:31:31 +02:00
|
|
|
|
2023-07-14 16:22:23 +02:00
|
|
|
// Créer la carte
|
|
|
|
var map = L.map('map').setView([50.5095, 2.6683], 9);
|
2023-07-13 18:31:31 +02:00
|
|
|
|
2023-07-14 16:22:23 +02:00
|
|
|
// Ajouter une couche de tuiles OpenStreetMap à la carte
|
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
|
|
attribution: 'Carte OpenStreetMap'
|
|
|
|
}).addTo(map);
|
2023-07-13 18:31:31 +02:00
|
|
|
|
2023-07-14 16:22:23 +02:00
|
|
|
// Placer des marqueurs pour chaque ville sur la carte
|
|
|
|
cities.forEach(function (city) {
|
|
|
|
var marker = L.marker([city.lat, city.lon]).addTo(map);
|
|
|
|
marker.bindPopup('<a href="' + city.href + '" target="_blank">' + city.name + '</a>');
|
|
|
|
});
|
2023-07-15 20:47:50 +02:00
|
|
|
|
|
|
|
if ("geolocation" in navigator) {
|
|
|
|
navigator.geolocation.getCurrentPosition(function (position) {
|
|
|
|
var lat = position.coords.latitude;
|
|
|
|
var lon = position.coords.longitude;
|
|
|
|
|
|
|
|
// Créer une icône CSS personnalisée avec une taille ajustée selon le niveau de zoom
|
|
|
|
var customIcon = L.divIcon({
|
|
|
|
className: 'red-marker',
|
|
|
|
iconSize: [15, 15], // Taille du marqueur ajustée
|
|
|
|
iconAnchor: [5, 5],
|
|
|
|
popupAnchor: [0, -3]
|
|
|
|
});
|
|
|
|
|
|
|
|
// Ajouter le marqueur avec l'icône personnalisée à la position de l'utilisateur
|
|
|
|
var marker = L.marker([lat, lon], { icon: customIcon }).addTo(map)
|
|
|
|
.bindPopup('Vous êtes là !')
|
|
|
|
|
|
|
|
|
|
|
|
// Centrer la carte sur la position de l'utilisateur
|
|
|
|
map.setView([lat, lon], 9);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-07-14 16:22:23 +02:00
|
|
|
</script>
|
2023-07-13 18:31:31 +02:00
|
|
|
</div>
|
2023-07-14 11:11:37 +02:00
|
|
|
<div class="cities-column">
|
|
|
|
<ul class="cities">
|
2023-07-14 15:59:21 +02:00
|
|
|
<?php $jour = isset($_GET['calendrier']) ? $_GET['calendrier'] : ''; ?>
|
|
|
|
<?php $citiesList = getCities($jour); ?>
|
2023-07-14 16:22:23 +02:00
|
|
|
<?php echo '<h3>' . getDatejour($jour) . '</h3>'; ?>
|
2023-07-14 11:11:37 +02:00
|
|
|
<?php if (isset($citiesList)): ?>
|
|
|
|
<?php foreach ($citiesList as $city): ?>
|
|
|
|
<li>
|
|
|
|
<?php
|
2023-07-14 16:22:23 +02:00
|
|
|
echo '<a href="' . $city['href'] . '" target="_blank">' . $city['name'] . '</a>'; ?>
|
2023-07-14 11:11:37 +02:00
|
|
|
</li>
|
|
|
|
<?php endforeach; ?>
|
|
|
|
<?php endif; ?>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
</div>
|
2023-07-13 18:31:31 +02:00
|
|
|
</div>
|
2023-07-10 19:36:11 +02:00
|
|
|
</body>
|
2023-07-11 18:03:40 +02:00
|
|
|
|
2023-07-11 14:08:23 +02:00
|
|
|
</html>
|