-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhotels_en.php
More file actions
155 lines (138 loc) · 4.9 KB
/
hotels_en.php
File metadata and controls
155 lines (138 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<!-- Doctype pour rester comforme aux standards -->
<!-- lang pour accent pour synthèse vocale-->
<html lang="en">
<head>
<!-- charset = encodage des caractères -->
<meta charset="UTF-8" />
<!-- viewport pour la mise en page mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- link pour relier la feuille css -->
<link rel="stylesheet" href="restaurants-hotels.css" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="header.css" />
<link rel="stylesheet" href="footer.css" />
<script src="filtre-restaurants-hotels.js"></script>
<!-- Title pour le titre de l'onglet -->
<title>Hotels</title>
<link rel="icon" type="image/png" sizes="32x32" href="./img/favicon.ico">
</head>
<body>
<?php
include("./php/header_en.inc.php");
?>
<main>
<h1>Hotels</h1>
<div class="filtre">
<form>
<label for="price-filter">Filter by price :</label>
<select id="price-filter">
<option value="">Tous</option>
<option value="$ - Faible">$ - High</option>
<option value="$$ - Moyen">$$ - Medium</option>
<option value="$$$ - Élevé">$$$ - High</option>
</select>
<br>
<br>
<hr>
<br>
<label for="stars-filter">Filter by stars :</label>
<div id="stars-filter">
<input type="checkbox" id="star-1" value="1">
<label for="star-1">★</label>
<input type="checkbox" id="star-2" value="2">
<label for="star-2">★</label>
<input type="checkbox" id="star-3" value="3">
<label for="star-3">★</label>
<input type="checkbox" id="star-4" value="4">
<label for="star-4">★</label>
<input type="checkbox" id="star-5" value="5">
<label for="star-5">★</label>
</div>
</form>
</div>
<div class="cards">
<?php
include("./php/connexion.php");
try {
$resultat = $cnx->prepare("SELECT * FROM hotelsen");
$resultat->execute(); // Exécuter la requête pour récupérer les résultats
while ($ligne = $resultat->fetch(PDO::FETCH_ASSOC)) {
$hotelName = $ligne['nomhotel'];
$hotelAddress = $ligne['adrhotel'];
$imageUrl = $ligne['img'];
$stars = $ligne['etoiles'];
$priceLevel = $ligne['prix'];
$tags = $ligne['tags'];
$lien = $ligne['linkhotel'];
// Convertir les tags en un tableau
$tagsArray = explode(", ", $tags);
?>
<div class="card-restaurant-hotel">
<h3 class="card-title"><?php echo $hotelName; ?></h3>
<p class="card-address"><?php echo $hotelAddress; ?></p>
<div class="card-image" style="background-image: url('./img/Grenade/<?php echo $imageUrl; ?>');"></div>
<div class="card-details">
<div class="card-stars">
<?php
// Afficher les étoiles
for ($i = 0; $i < 5; $i++) {
if ($i < $stars) {
echo "★";
} else {
echo "☆";
}
}
?>
</div>
<div class="card-price">
<?php
// Afficher le niveau de prix
$priceSymbols = str_repeat("$", $priceLevel);
echo $priceSymbols . " - ";
// Afficher le niveau de prix
switch ($priceLevel) {
case 1:
echo "Faible";
break;
case 2:
echo "Moyen";
break;
case 3:
echo "Élevé";
break;
default:
echo "Inconnu";
break;
}
?>
</div>
</div>
<div class="card-tags">
<?php
// Afficher les tags
foreach ($tagsArray as $tag) {
echo "<div class='tags'>$tag</div>";
}
?>
</div>
<?php
echo "<a class='card-website' href='$lien'>Hotel website</a>";
?>
</div>
<?php
}
} catch (PDOException $e) {
echo "Erreur lors de l'exécution de la requête : " . $e->getMessage();
}
?>
</div>
</div>
<a href="#" class="top"> ↑ </a>
<?php
include("./php/footer_en.inc.php");
?>
<script src="script.js"></script>
</main>
</body>
</html>