-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin.html
109 lines (102 loc) · 4.23 KB
/
admin.html
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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Carte Leaflet - Administration</title>
<link rel="stylesheet" href="./css/vendor/leaflet.css"/>
<link rel="stylesheet" href="./css/main.css">
<link rel="stylesheet" href="./css/admin.css">
<link rel="stylesheet" href="./css/responsive.css">
</head>
<body>
<main>
<section id="carteSalles">
<div id="mapSalles"></div>
</section>
<section id="listeSalles">
<h1>Liste des salles</h1>
<?php if(isset($listeSalles)) echo $listeSalles; ?>
</section>
<section id="ajoutSalles">
<h1><?= (isset($modif)) ? "Modifier la salle" : "Ajouter une salle" ?></h1>
<?php if(isset($message['posSalle'])) echo alerte($message['posSalle']); ?>
<div id="mapAjout"></div>
<p class="aide">Cliquez sur la carte pour placer un marqueur, vous pouvez ensuite le déplacer à volonté.</p>
<form action="admin.php" method="POST">
<label for="nomSalle"><?php if(isset($message['nomSalle'])) echo alerte($message['nomSalle']); ?>
<input type="text" name="nomSalle" id="nomSalle" placeholder="Nom de la salle"<?php if(isset($modif)) {
echo " value=\"". $modif['nomSalle']. "\"";
}else if (isset($_POST['nomSalle'])) {
echo " value=\"". $_POST['nomSalle']. "\"";
}
if(isset($message['nomSalle'])){
echo " class=\"alerte\"";
} ?>>
</label>
<label for="adresseSalle"><?php if(isset($message['adresseSalle'])) echo alerte($message['adresseSalle']); ?>
<input type="text" name="adresseSalle" id="adresseSalle" placeholder="Adresse de la salle"<?php if(isset($modif)) {
echo " value=\"". $modif['adresseSalle']. "\"";
}else if (isset($_POST['adresseSalle'])) {
echo " value=\"". $_POST['adresseSalle']. "\"";
}
if(isset($message['adresseSalle'])){
echo " class=\"alerte\"";
} ?>>
</label>
<label for="sportsSalle"><?php if(isset($message['sportsSalle'])) echo alerte($message['sportsSalle']); ?>
<textarea name="sportsSalle" id="sportsSalle" placeholder="Un sport par ligne, ou séparés par des virgules"><?php if(isset($modif)) {
echo $modif['sportsSalle'];
}else if (isset($_POST['sportsSalle']) && strlen(trim($_POST['sportsSalle']))>0) {
echo $_POST['sportsSalle'];
}
if(isset($message['sportsSalle'])){
echo " class=\"alerte\"";
} ?></textarea>
</label>
<label for="posSalle">
<input type="text" name="posSalle" id="posSalle" readonly data-lat="" data-lng="" placeholder="Coordonnées de la salle"<?php if(isset($modif)) {
echo " value=\"". $modif['posSalle'][1]. ",". $modif['posSalle'][0]. "\"";
}elseif(isset($_POST['posSalle'])){
} ?>>
</label>
<?php
if (isset($modif)) :
?>
<input type="hidden" name="idSalle" value="<?= $modif['idSalle'] ?>">
<?php
endif;
?>
<input type="submit" name="submit" class="btn" value="Enregistrer la salle">
</form>
</section>
<div class="overlay">
<div id="dialogueSalle">
<h3>Voulez-vous vraiment supprimer les informations<br>sur "<span><?php ?></span>" ?</h3>
<div>
<button id="ouiSalle" class="btn">Oui</button><button id="nonSalle" class="btn">Non</button>
</div>
</div>
</div>
</main>
<?php
if (isset($modif) || isset($_POST['posSalle'])) :
if (isset($modif)) {
$pos[0]=$modif['posSalle'][1];
$pos[1]=$modif['posSalle'][0];
}elseif(isset($_POST['posSalle'])){
$tmp = explode(",", sanitizeString($_POST['posSalle']));
$pos[0]=(float)$tmp[0];
$pos[1]=(float)$tmp[1];
}
?>
<script>
let markerOldPos = [<?= $pos[0]. ",". $pos[1] ?>];
</script>
<?php
endif;
?>
<script src="./js/vendor/leaflet.js" defer></script>
<script src="./js/admin.js" defer></script>
</body>
</html>