| Current Path : /home/happyrenas/myreco.online/ |
Linux webd005.cluster105.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 |
| Current File : /home/happyrenas/myreco.online/fiche.php |
<?
include("configuration.php");
include("includes/fonctions.php");
$page="fiche.php";
// Échapper le token de la requête
$token = $db->escape($_REQUEST['token']);
if (!$token) exit;
$donnees_mrx = extraireMRXDonnees($_REQUEST);
$mrx_variable = $donnees_mrx['mrx_variable'];
$mrx_array = $donnees_mrx['mrx_array'];
// Récupération des informations de la fiche hébergement
$myquery = "SELECT * FROM heb WHERE token = '$token'";
$fiche = $db->get_row($myquery);
if (!$fiche || !$fiche->id) exit;
// Redirection si hébergement en version "lite"
if ($fiche->name == 'lite') {
header("Refresh:0; url=fiche_lite.php?token=$token");
exit;
}
// ➤ Gestion de la langue
if (isset($_GET['langue']) && in_array(strtoupper($_GET['langue']), $langues)) {
$_SESSION['langue'] = strtoupper($_GET['langue']);
}
if (isset($_SESSION['langue']) && in_array($_SESSION['langue'], $langues)) {
$langue = $_SESSION['langue'];
} else {
$country_code = strtoupper($fiche->country_code ?? 'FR');
$langue = in_array($country_code, $langues) ? $country_code : 'FR';
$_SESSION['langue'] = $langue; // On l'enregistre aussi
}
$trad = chargerTraductions($langue);
// ➤ Mise à jour du compteur et de la date d'affichage
$date_last_flash = date("Y-m-d H:i");
$db->query("UPDATE heb SET compteur_affichage = compteur_affichage + 1, date_last_flash = '$date_last_flash' WHERE id = {$fiche->id}");
// Paramètres passés
$query = $_GET['query'] ?? 'proche';
$categorie = $_GET['categorie'] ?? 'a_voir';
$zones = [$query]; // tableau avec UNE seule zone sélectionnée
$categories = [$categorie]; // tableau avec UNE seule catégorie sélectionnée
$token_fiche_visite = $db->escape($_REQUEST['token_fiche_visite']);
// Envoi email si nécessaire
if ($token_fiche_visite) {
include("include_envoi_email.php");
}
// Gestion des préférences d'affichage
$neplusafficher = $db->escape($_REQUEST['neplusafficher']);
if ($neplusafficher == "1") {
$_SESSION['neplusafficher'] = "1";
} elseif ($neplusafficher == "reset") {
$_SESSION['neplusafficher'] = "";
}
// Traitement email saisi (par exemple newsletter ou reco)
$saisie_email = $db->escape($_REQUEST['saisie_email']);
if ($saisie_email) {
include("include_myrecoeat.php");
}
?>
<html class="no-js" lang="<?echo $country_code;?>">
<head>
<?include("includes/google_head.php");?>
<meta charset="utf-8">
<title>MyReco.Online</title>
<meta name="description" content="">
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="https://www.myreco.online/img/icone.png" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="css/custom.css">
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<style>
@media (max-width: 575.98px) {
.btn-km {
padding: .15rem .35rem; /* plus serré */
font-size: .75rem; /* plus petit */
line-height: 1.2;
}
}
</style>
</head>
<body>
<div id="halt_loader_overlay"></div>
<div id="halt_loader" class=""><i class="fa fa-spinner fa-spin"></i> <?echo $trad['Chargement des informations, merci de patienter'] ?? '⚠️';?></div>
<div id="halt_initialisation" class=""><i class="fa fa-spinner fa-spin"></i> <?echo $trad['Premiere initialisation merci de patienter'] ?? '⚠️';?></div>
<?
include("includes/google_body.php");?>
<nav class="navbar fixed-top navbar-light bg-light">
<div class="container d-flex justify-content-between align-items-center">
<!-- Logo -->
<div>
<img src="img/logo_myreco.png" alt="Logo" class="d-none d-md-block" style="height: 40px;">
<img src="img/logo_myreco.png" alt="Logo Mobile" class="d-md-none" style="height: 15px;">
</div>
<!-- Boutons + Sélecteur de langue -->
<div class="d-flex align-items-center">
<!-- Boutons de distance -->
<a class="ml-1 btn btn-secondary btn-sm btn-km text-white <?php if ($query=="proche") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=proche&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">0-30km</a>
<a class="ml-1 btn btn-secondary btn-sm btn-km text-white <?php if ($query=="median") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=median&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">30-60km</a>
<a class="ml-1 btn btn-secondary btn-sm btn-km text-white <?php if ($query=="lointain") echo 'active'; ?>" onclick="showLoader();"
href="fiche.php?token=<?php echo $token; ?>&query=lointain&categorie=<?php echo $categorie; ?>&<?php echo $mrx_variable; ?>">60-100km</a>
<!-- Dropdown langue avec drapeau -->
<div class="dropdown ml-1">
<button class="btn btn-sm btn-km btn-outline-secondary dropdown-toggle d-flex align-items-center" type="button" id="dropdownLangue" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img src="img/flag/ico/<?php echo strtolower($langue ?? 'fr'); ?>.png" alt="flag" style="height: 16px; width: auto; margin-right: 5px;">
<?php echo strtoupper($langue ?? 'FR'); ?>
</button>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownLangue">
<?php
foreach ($langues as $l) {
$url = "fiche.php?token=$token&query=$query&categorie=$categorie&$mrx_variable&langue=$l";
$img = "img/flag/ico/" . strtolower($l) . ".png";
echo "<a class='dropdown-item d-flex align-items-center' href='$url'>
<img src='$img' alt='$l' style='height: 16px; width: auto; margin-right: 8px;'> $l
</a>";
}
?>
</div>
</div>
</div>
</div>
</nav>
<div class="mt-3 mb-3"> </div>
<?if ($saisie_email) {?>
<div class="container mt-4">
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<?echo $trad['Merci vous pouvez accéder à MyReco Eat'] ?? '⚠️';?><a target="_blank" href="<?echo $lien_myreco_eat;?>"> <?echo $trad['en cliquant ici'] ?? '⚠️';?></a><br>
<?echo $trad['Appli toujours gratuite et sans pub'] ?? '⚠️';?> <br>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</div>
<?}?>
<!-- Bouton flottant toggle -->
<button id="btnToggleCarte" class="btn btn-primary btn-lg rounded-circle shadow"
style="position: fixed; top: 50px; right: 20px; z-index: 2000;">
<i class="fas fa-map"></i>
</button>
<!-- Modale fullscreen -->
<div class="modal fade" id="modalCarte" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-xl" role="document" style="max-width: 100%; height: 100%; margin: 0;">
<div class="modal-content" style="height: 100%; border-radius: 0;">
<div class="modal-body p-0" style="height: 100%;">
<!-- Conteneur Leaflet -->
<div id="map" style="height: 100%; width: 100%;"></div>
</div>
</div>
</div>
</div>
<?
$resultat = verifierOuRecupererPhoto($fiche->token, "heb");
$hebergement_photo ='img/hebergement.png';
if ($resultat['url']) {$hebergement_photo=$resultat['url'];}
$tableau_liste_brut = recupererLieuxCarte($fiche, $zones, $categories, true);
$tableau_liste = array_filter($tableau_liste_brut, function($item) use ($mrx_array) {
return !in_array($item['token'], $mrx_array);
});
$tableau_liste_proprio = recupererLieuxCarteProprio($fiche);
if ($categorie=="reco") {$tableau_liste=$tableau_liste_proprio;}
$numero=0;
?>
<div class="container mycards">
<div class="row">
<?php
foreach ($tableau_liste as $lieu) {
$numero++;
$lien_reservation = getLienReservation($lieu['id']);
?>
<div class="col-sm-4 py-2 mb-2">
<div class="card h-100">
<div id="demo<?echo $lieu['id'];?>" class="carousel slide" data-interval="999999999" data-touch="true" data-ride="carousel">
<div class="carousel-inner">
<?php
$photoLocale = trim($lieu['photo_locale'] ?? '');
$src = $photoLocale ? "../" . ltrim($photoLocale, "/") : "img/placeholder.svg";
?>
<div class="carousel-item active">
<img
class="js-photo-lazy"
src="<?php echo htmlspecialchars($src); ?>"
data-token="<?php echo htmlspecialchars($lieu['token']); ?>"
data-table="vis"
data-has-photo="<?php echo $photoLocale ? '1' : '0'; ?>"
alt="<?php echo htmlspecialchars($lieu['name']); ?>"
loading="lazy"
style="width:100%;height:auto;object-fit:cover;"
>
</div>
</div>
<p class="basdroite" style="position:absolute;margin-left:0;border:0px;"><span style="background-color:#34DA66!important;font-size:0.9rem;color:#ffffff!important;" class="badge"><i class="far fa-heart "></i> <?echo $lieu['compteur_like'];?></span></p>
</div>
<p style="position:absolute;margin-left:0;border:0px;"><span style="background-color:#6B757D!important;font-size:1.5rem;color:#ffffff!important;" class="badge"><?echo $numero;?></span></p>
<div class="description card-body text-center">
<h3 class="card-title"><?echo $lieu['name'];?></h3>
<h4 class="card-subtitle"><span style="font-size:16px;"><?echo $lieu['postal_code'];?></span> <?echo $lieu['city'];?></h4>
<p><?echo $trad['A'] ?? '⚠️';?> <?echo $lieu['distance'];?> km</p>
<?php if ($lien_reservation) { ?>
<p><a target="_blank" href="<?php echo htmlspecialchars($lien_reservation); ?>">
<span class="badge badge-info"><?php echo $trad['Réserver'] ?? '⚠️'; ?></span>
</a></p>
<?php } ?>
<p>
<?
if (strlen($lieu['dernier_avis'])>100){
echo mb_substr($lieu['dernier_avis'],0,101);?>
<span class="collapse" id="more<?echo $lieu['id'];?>"><?echo mb_substr($lieu['dernier_avis'],101);?></span>
<span><a href="#more<?echo $lieu['id'];?>" data-toggle="collapse">... <i class="fa fa-caret-down"></i></a></span>
<?} else {
echo $lieu['dernier_avis'];
}
?>
</p><p></p><?//echo "<pre>";print_r ($lieu);echo "</pre>";?>
</div>
<div style="padding-left:4!important;padding-right:4!important;" class="card-footer card-p">
<div class="row">
<div class="col-4 text-center mt-1">
<span class="text-center"><?echo $lieu['rating'];?></span><br>
<div class="rating-box text-center">
<div class="rating text-center" style="width:<?echo $lieu['rating_percent'];?>%;"></div>
</div>
</div>
<div class="col-4 mt-2 d-flex justify-content-center align-items-center">
<a title="<?echo strip_tags($trad['J aime'] ?? '⚠️');?>" href="" data-toggle="modal" data-target="#form<?echo $lieu['id'];?>" class="mx-2">
<i class="far fa-thumbs-up fa-xl" style="color:#34DA66!important;"></i>
</a>
<a title="<?echo strip_tags($trad['Je signale'] ?? '⚠️');?>" href="" data-toggle="modal" data-target="#formbad<?echo $lieu['id'];?>" class="mx-2">
<i class="far fa-thumbs-down fa-xl" style="color:#f20f0f!important;"></i>
</a>
</div>
<div class="col-4 mt-2" >
<a class="btn btn-light btn-sm" target="_blank" href="<?echo $lieu['googleMapsLink'];?>"><?echo $trad['Plus d info'] ?? '⚠️';?></a>
</div>
</div>
</div>
</div>
</div><?php if ($numero == 3) { ?>
<div class="col-12 py-3">
<div class="text-center">
<a target="_blank" href="https://find.myreco.online/"><img src="img/pub_myreco.png"
alt="Pub MyReco"
style="width:100%; max-width:1200px; "></a>
</div>
</div>
<?php } ?>
<!----------
🔁 MODALE 🔁
------------>
<div class="modal fade" id="form<?echo $lieu['id'];?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header border-bottom-0">
<h5 class="modal-title" id="exampleModalLabel"><?echo $trad['Votre avis'] ?? '⚠️';?><br></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="post" action="fiche.php">
<input type="hidden" name="name" value="<?echo $name;?>">
<input type="hidden" name="token_fiche_visite" value="<?php echo htmlspecialchars($lieu['token']); ?>">
<input type="hidden" name="token" value="<?echo $token;?>">
<input type="hidden" name="query" value="<?echo $query;?>">
<input type="hidden" name="categorie" value="<?echo $categorie;?>">
<?php
for ($i = 1; $i <= 15; $i++) {
$varName = 'mrx' . $i;
$value = isset($$varName) ? $$varName : ''; // sécurité si jamais une variable manque
echo '<input type="hidden" name="' . $varName . '" value="' . htmlspecialchars($value) . '">' . "\n";
}
?>
<div class="modal-body">
<div class="form-group">
<textarea class="form-control" id="avis" name="avis" rows="6" placeholder="<?echo $trad['Laissez un petit commentaire positif'] ?? '⚠️';?>"></textarea>
</div>
</div>
<div class="modal-footer border-top-0 d-flex justify-content-center">
<button type="submit" class="btn btn-success"><?echo $trad['Je signale'] ?? '⚠️';?></button>
<h6 class="modal-title" id="exampleModalLabel"><br><?echo $trad['Les prochains clients de cet hébergement'] ?? '⚠️';?></h5>
</div>
</form>
</div>
</div>
</div>
<!----------
🔁 MODALE 🔁
------------>
<div class="modal fade" id="formbad<?echo $lieu['id'];?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header border-bottom-0">
<h5 class="modal-title" id="exampleModalLabel"><?echo $trad['Signaler un problème sur ce lieu'] ?? '⚠️';?><br></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="post" action="fiche.php">
<input type="hidden" name="name" value="<?echo $name;?>">
<input type="hidden" name="token_fiche_visite" value="<?php echo htmlspecialchars($lieu['token']); ?>">
<input type="hidden" name="token" value="<?echo $token;?>">
<input type="hidden" name="query" value="<?echo $query;?>">
<input type="hidden" name="categorie" value="<?echo $categorie;?>">
<?php
for ($i = 1; $i <= 15; $i++) {
$varName = 'mrx' . $i;
$value = isset($$varName) ? $$varName : ''; // sécurité si jamais une variable manque
echo '<input type="hidden" name="' . $varName . '" value="' . htmlspecialchars($value) . '">' . "\n";
}
?>
<div class="modal-body">
<div class="form-group">
<div class="radio-list">
<label class="radio">
<input type="radio" name="choix_bad" value="<?echo $trad['Catégorie incorrecte'] ?? '⚠️';?>" required>
<span></span>
<?echo $trad['Catégorie incorrecte'] ?? '⚠️';?>
</label><br>
<label class="radio">
<input type="radio" name="choix_bad" value="<?echo $trad['Peu intéressant'] ?? '⚠️';?>">
<span></span>
<?echo $trad['Peu intéressant'] ?? '⚠️';?>
</label><br>
<label class="radio">
<input type="radio" name="choix_bad" value="<?echo $trad['Inapproprié'] ?? '⚠️';?>">
<span></span>
<?echo $trad['Inapproprié'] ?? '⚠️';?>
</label><br>
<label class="radio">
<input type="radio" name="choix_bad" value="<?echo $trad['Fermé'] ?? '⚠️';?>">
<span></span>
<?echo $trad['Fermé'] ?? '⚠️';?>
</label><br>
</div>
</div>
</div>
<div class="modal-footer border-top-0 d-flex justify-content-center">
<button type="submit" class="btn btn-success"><?echo $label_jaime_bad;?></button>
<h6 class="modal-title" id="exampleModalLabel"><br><?echo $trad['Les prochains clients de cet hébergement'] ?? '⚠️';?></h5>
</div>
</form>
</div>
</div>
</div>
<?
}
?>
</div>
</div>
<!----------
🔁 MODALE 🔁
------------>
<div class="modal fade" id="lite" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header border-bottom-0">
<p class="modal-title" id="exampleModalLabel1">
<?echo $trad['prolonger'] ?? '⚠️';?>
</p>
<button type="button" class="close neplusafficher" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form method="GET" action="fiche.php">
<input type="hidden" name="token" value="<?echo $token;?>">
<input type="hidden" name="query" value="<?echo $query;?>">
<input type="hidden" name="categorie" value="<?echo $categorie;?>">
<?php
for ($i = 1; $i <= 15; $i++) {
$varName = 'mrx' . $i;
$value = isset($$varName) ? $$varName : ''; // sécurité si jamais une variable manque
echo '<input type="hidden" name="' . $varName . '" value="' . htmlspecialchars($value) . '">' . "\n";
}
?>
<div class="modal-body">
<div class="form-group">
<input required type="email" class="form-control" id="saisie_email" name="saisie_email" placeholder="<?echo $trad['Votre adresse email'] ?? '⚠️';?>">
</div>
</div>
<div class="modal-footer border-top-0 d-flex justify-content-center">
<button type="submit" class="btn btn-success">
<?echo $trad['Valider'] ?? '⚠️';?>
</button>
<button type="reset" class="btn btn-secondary neplusafficher">
<?echo $trad['Ne plus afficher'] ?? '⚠️';?>
</button>
</div>
</form>
</div>
</div>
</div>
<?if (count($tableau_liste)==0)
{?>
<div class="row justify-content-center">
<div class="col-4">
<div class="p-3 border bg-light text-center">
<?echo $trad['Aucun résultat'] ?? '⚠️';?>
</div>
</div>
</div>
<?}
?>
<div class="mt-3 mb-3"> </div>
<nav class="navbar fixed-bottom navbar-light bg-light">
<div class="container d-flex justify-content-between align-items-center">
<a class="btn btn-secondary btn-km text-white <?if ($categorie=="a_voir") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=a_voir"><?echo $trad['A voir'] ?? '⚠️';?></a>
<a class="btn btn-secondary btn-km text-white <?if ($categorie=="restaurant") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=restaurant"><?echo $trad['Restaurant'] ?? '⚠️';?></a>
<a class="btn btn-secondary btn-km text-white <?if ($categorie=="ludique") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=ludique"><?echo $trad['Ludique'] ?? '⚠️';?></a>
<a class="btn btn-secondary btn-km text-white <?if ($categorie=="soiree") {?> active<?}?>" onclick="showLoader();" href="fiche.php?token=<?echo $token;?>&categorie=soiree"><?echo $trad['En soirée'] ?? '⚠️';?></a>
<a class="mt-3 btn btn-block btn-secondary text-white <?if ($categorie=="reco") {?> active<?}?>" href="fiche.php?token=<?echo $token;?>&categorie=reco"><?echo $trad['Les recos du proprio'] ?? '⚠️';?></a>
</div>
</nav>
<script type="text/javascript" src="js/notify.js"></script>
<!-- Leaflet -->
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
(function () {
const imgs = document.querySelectorAll('img.js-photo-lazy');
if (!imgs.length) return;
const targets = Array.from(imgs).filter(img => img.dataset.hasPhoto !== '1');
// fallback si IntersectionObserver absent
if (!('IntersectionObserver' in window)) {
targets.forEach(img => fetchOne(img));
return;
}
const io = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (!entry.isIntersecting) return;
const img = entry.target;
io.unobserve(img);
fetchOne(img);
});
}, { rootMargin: '300px 0px' });
targets.forEach(img => io.observe(img));
async function fetchOne(img) {
const token = img.dataset.token;
const table = img.dataset.table || 'vis';
try {
const r = await fetch(`ajax_photo_visite.php?table=${encodeURIComponent(table)}&token=${encodeURIComponent(token)}`, {
credentials: 'same-origin'
});
const data = await r.json();
if (data && data.ok && data.url) {
// Ton HTML utilise "../" + photo_locale => on respecte ça
const newSrc = "../" + String(data.url).replace(/^\//, '');
img.src = newSrc + (newSrc.includes('?') ? '&' : '?') + 'v=' + Date.now();
img.dataset.hasPhoto = '1';
}
} catch (e) {
// on garde le placeholder
}
}
})();
</script>
<script>
$(document).ready( function(){
<?php if ($fiche && $fiche->initialisation != 1): ?>
if (typeof showLoaderInitialisation === 'function') {
showLoaderInitialisation();
$.post('ajax_initialiser_hebergement.php', { token: '<?= $fiche->token ?>' }, function (response) {
console.log(response.message);
location.reload();
}, 'json').fail(function () {
alert('Erreur lors de l\'initialisation.');
if (typeof hideLoader === 'function') hideLoader();
});
} else {
console.warn('⚠️ showLoaderInitialisation() non défini.');
}
<?php endif; ?>
var $btn = $("#btnToggleCarte");
var $modal = $("#modalCarte");
var map = null;
var markersAdded = false; // ⬅️ évite d’ajouter deux fois les marqueurs
// Toggle bouton flottant
$btn.on("click", function () {
if (!$modal.hasClass("show")) $modal.modal("show");
else $modal.modal("hide");
});
// Quand la modale s'ouvre
$modal.on("shown.bs.modal", function () {
$btn.html('<i class="fas fa-times"></i>');
if (!map) {
// ⚠️ pas de setView, on fera un fitBounds
map = L.map('map');
L.tileLayer('https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap',
maxZoom: 18
}).addTo(map);
} else {
map.invalidateSize(); // important au ré-affichage de la modale
}
if (!markersAdded) {
markersAdded = true;
var latCentre = <?= str_replace(',', '.', $fiche->latitude) ?>;
var lngCentre = <?= str_replace(',', '.', $fiche->longitude) ?>;
// Icônes
var redIcon = new L.Icon({
iconUrl: 'img/marker-icon-red.png',
shadowUrl: 'img/marker-shadow.png',
iconSize: [25, 41],
iconAnchor: [12, 41],
popupAnchor: [1, -34],
shadowSize: [41, 41]
});
var icons = {
a_voir: new L.Icon({ iconUrl: 'img/marker-icon-blue.png', shadowUrl: 'img/marker-shadow.png', iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41] }),
restaurant: new L.Icon({ iconUrl: 'img/marker-icon-green.png', shadowUrl: 'img/marker-shadow.png', iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41] }),
soiree: new L.Icon({ iconUrl: 'img/marker-icon-orange.png', shadowUrl: 'img/marker-shadow.png', iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41] }),
ludique: new L.Icon({ iconUrl: 'img/marker-icon-violet.png', shadowUrl: 'img/marker-shadow.png', iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41] }),
visite_proprio: new L.Icon({ iconUrl: 'img/marker-icon-yellow.png', shadowUrl: 'img/marker-shadow.png', iconSize:[25,41], iconAnchor:[12,41], popupAnchor:[1,-34], shadowSize:[41,41] })
};
var boundsArray = [];
// Marqueur hébergement
var markerHeb = L.marker([latCentre, lngCentre], { icon: redIcon }).addTo(map)
.bindPopup(`<b><?= addslashes($fiche->name) ?> (<?= count($tableau_liste) ?> lieux)</b><br><img src="<?= $hebergement_photo ?>" width="120">`)
.openPopup();
boundsArray.push([latCentre, lngCentre]);
// Lieux « publics »
<?php foreach ($tableau_liste as $lieu): ?>
(function(){
var latlng = [<?= $lieu['latitude'] ?>, <?= $lieu['longitude'] ?>];
var categorie = "<?= $lieu['categorie'] ?>";
var icon = icons[categorie] || icons.a_voir;
var marker = L.marker(latlng, { icon: icon }).addTo(map);
marker.bindPopup(`<b><?= addslashes($lieu['name']) ?></b><br>
<i>Catégorie : <?= $lieu['categorie'] ?></i><br>
(<?= $lieu['distance'] ?> km)<br>
<br><img src="https://www.myreco.online<?echo $lieu['photo_locale'];?>" width="200">`);
boundsArray.push(latlng);
})();
<?php endforeach; ?>
// Lieux « proprio »
<?php if (!empty($tableau_liste_proprio)) { foreach ($tableau_liste_proprio as $lieu): ?>
(function(){
var latlng = [<?= $lieu['latitude'] ?>, <?= $lieu['longitude'] ?>];
var icon = icons['visite_proprio'] || icons.a_voir;
var marker = L.marker(latlng, { icon: icon }).addTo(map);
marker.bindPopup(`<b><?= addslashes($lieu['name']) ?></b><br>
<i>Catégorie : Mes recos</i><br>
<br><img src="https://www.myreco.online<?echo $lieu['photo_locale'];?>" width="200">`);
boundsArray.push(latlng);
})();
<?php endforeach; } ?>
// Ajuste le zoom sur tous les points
if (boundsArray.length) {
map.fitBounds(boundsArray, { padding: [30, 30] });
}
}
});
// Quand la modale se ferme
$modal.on("hidden.bs.modal", function () {
$btn.html('<i class="fas fa-map"></i>');
// « reset » la carte à chaque fermeture
// map.remove();
// map = null;
// markersAdded = false;
});
//showLoader();
<?
$aucun_mrx = empty(array_filter($mrx_array));
if ($categorie == "restaurant" && $_SESSION['neplusafficher'] == '' && $aucun_mrx) { ?>
setTimeout(function() {
$('#lite').modal('show');
}, 5000);
$(".neplusafficher").click(function(){
console.log("neplusafficher");
// Récupérer l'URL actuelle
let currentUrl = window.location.href;
// Créer un objet URL pour manipuler facilement les paramètres
let url = new URL(currentUrl);
// Ajouter ou mettre à jour le paramètre "neplusafficher"
url.searchParams.set('neplusafficher', '1');
// Recharger la page avec le nouveau paramètre
window.location.href = url.toString();
});
<?}?>
$('.coeur_nombre').on('click', function (e) {
var valeur = $(this).text();
valeur = parseInt(valeur);
$(this).text(valeur+1);
})
$('#demo').carousel({
interval: false
});
<?if ($miseajour) {?>
$.notify('Votre commmentaire a bien été envoyé pour validation', {
autoHide: true,
autoHideDelay: 2000,
globalPosition: 'top center',
className: 'success'
});
<?}?>
});
</script>
</body>
</html>