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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
| <!--
*--------------------------------------------------------------------------------------------------*
* *
* *
*--------------------------------------------------------------------------------------------------*
-->
<?php
$trace = false;
require_once 'fonctions/controle_session.php';
require_once 'fonctions/Dates.php';
require_once 'classes/class_sondages.php';
$Class_Sondages = new sondages($GLOBALS['bdd']);
if ($trace) {
echo "<hr>POST : "; print_r($_POST);
echo "<hr>GET : "; print_r($_GET);
echo "<hr>Session Droits : "; print_r($_SESSION['droit']);
}
// On vérifie que l'utilisateur a bien les droits
if (!in_array("comite", $_SESSION['droit']) and !in_array("admin", $_SESSION['droit']) and !in_array("Sorties_Organisateur", $_SESSION['droit'])){
echo "<h4 id='msgerreur'>Tu n'as pas les droits suffisants pour consulter cette page</h4>";
die();
}
$idSondage = $_GET['idSondage'];
$LeSondage = $Class_Sondages->select_by_Sondage($idSondage);
$LesChoix = $Class_Sondages->select_All_Choix_By_Sondage($idSondage);
?>
<center>
<h1A>Détail de l'activité club</h1A>
<br><br>
<a href="index.php?page=sondages_liste"><input type="button" value="Retour sur les activités club" style="width:200px;"></a>
<br>
<h2>
<?php
echo $LeSondage['Titre'];
if ($LeSondage['Date_Evenement'] != "")
echo ", le " . DateAffichage($LeSondage['Date_Evenement'], '-');
?>
</h2>
</center>
<?php
// On regarde si l'un des choix est payant
$Au_Moins_Un_Choix_Payant = false;
foreach ($LesChoix as $UnElm)
if ($UnElm['Montant'] > 0) {
$Au_Moins_Un_Choix_Payant = true;
}
if ($Au_Moins_Un_Choix_Payant)
$Nb_Col = 3;
else
$Nb_Col = 2;
?>
<div id="wrapper">
<?php echo $LeSondage['Texte'];?>
</div>
<center>
<br><br>
<div id="bloc">
<table border="1" align="center" CELLPADDING="5" CELLSPACING="0">
<tr><th colspan="3"><h3>Les commentaires</h3></th></tr>
<tr>
<th width="150"> Date du commentaire </th>
<th width="150"> Personne ayant ajouté<br> le commentaire </th>
<th width="600"> Commentaire </th>
</tr>
<?php
$List_Sondages_Commentaire = $Class_Sondages->Liste_Commentaire($idSondage);
$k = 0;
foreach ($List_Sondages_Commentaire as $UnElm) {
$k++;
if( $k%2 == 0 ){
$color = "#FAFAFA";
}
else{
$color = "#F5ECCE";
}
?>
<tr bgcolor="<?php echo $color;?>" align="center" style="height:20px;text-align:center;"
onmouseover="this.style.backgroundColor='#D5E5ED';"
onmouseout="this.style.backgroundColor='';">
<td><?php echo DateAffichage(substr($UnElm['TS_Crea'], 0, 10), '-') . " à " . substr($UnElm['TS_Crea'], 10);?></td>
<td><?php echo $UnElm['Prenom'] . " " . $UnElm['Nom'];?></td>
<td><?php echo $UnElm['Commentaire'];?></td>
</tr>
<?php
}
?>
</table>
</div>
<br><br>
<?php $Nb_Col = 1;?>
<div id="wrapper">
<table border="1" align="center" CELLPADDING="5" CELLSPACING="0">
<tr><th colspan="<?php echo $Nb_Col;?>"><h3>Personnes autorisés à participer à l'activité club</h3></th></tr>
<tr>
<?php
$List_Droits = $Class_Sondages->select_All_Droits_By_Sondage($idSondage);
$k = 0;
foreach ($List_Droits as $UnElm) {
$k++;
if( $k%2 == 0 ){
$color = "#FAFAFA";
}
else{
$color = "#F5ECCE";
}
?>
<tr bgcolor="<?php echo $color;?>" align="center" style="height:20px;text-align:center;"
onmouseover="this.style.backgroundColor='#D5E5ED';"
onmouseout="this.style.backgroundColor='';">
<td><?php echo $UnElm['Libelle']; ?> </td>
<?php
}
?>
</tr>
</table>
</div>
<?php
if ($Au_Moins_Un_Choix_Payant)
$Nb_Col = 3;
else
$Nb_Col = 2;
?>
<div id="wrapper">
<table border="1" align="center" CELLPADDING="5" CELLSPACING="0">
<tr><th colspan="<?php echo $Nb_Col;?>"><h3>Choix de l'activité club</h3></th></tr>
<tr>
<th>Libelle</th>
<?php
if ($Au_Moins_Un_Choix_Payant)
echo "<th>Montant </th>";
?>
<th>Nb</th>
</tr>
<?php
$List_Choix = $Class_Sondages->select_All_Choix_By_Sondage($idSondage);
$k = 0;
$Nb_Chx = 0;
foreach ($List_Choix as $UnElm) {
$k++;
if( $k%2 == 0 ){
$color = "#FAFAFA";
}
else{
$color = "#F5ECCE";
}
?>
<tr bgcolor="<?php echo $color;?>" align="center" style="height:20px;text-align:center;"
onmouseover="this.style.backgroundColor='#D5E5ED';"
onmouseout="this.style.backgroundColor='';">
<td><?php echo $UnElm['Texte']; ?> </td>
<?php
if ($Au_Moins_Un_Choix_Payant)
echo "<td> " . number_format($UnElm['Montant'], 2) . " </td>";
// Nb de participants pour ce choix
$Req = "select sum(Nb)
from scf_sondages_licencies
where idSondage = $idSondage
and idChoix = " . $UnElm['idChoix'];
try {
$dbh = $GLOBALS['bdd']->query($Req);
$Result = $dbh->fetch();
}
catch (PDOException $e) {
echo "<h4><br>La requete est : ".$Req;
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
echo "<td>" . $Result[0] . "</td>";
$Nb_Chx += $Result[0];
}
?>
<tr>
<th> Total </th>
<?php
if ($Au_Moins_Un_Choix_Payant)
echo "<th> </th>";
?>
<th> <?php echo $Nb_Chx;?> </th>
</tr>
</table>
</div>
<br><br>
<?php
if ($Au_Moins_Un_Choix_Payant) {
?>
<div id="bloc">
<table border="1" align="center" CELLPADDING="5" CELLSPACING="0">
<tr><th colspan="<?php echo $Nb_Col?>"><h3>Liste des participants</h3></th></tr>
<tr>
<th> Nom </th>
<th> Date d'inscription </th>
<?php
if ($Au_Moins_Un_Choix_Payant)
echo "<th>Montant réglé</th>";
?>
</tr>
<?php
$List_Participants = $Class_Sondages->select_All_Participants($idSondage);
$k = 0;
$Total = 0;
foreach ($List_Participants as $UnElm) {
$Date_Participation = $Class_Sondages->select_max_Participation_idLicencie($idSondage, $UnElm['idLicencie']);
$LesChoix = $Class_Sondages->select_Choix_By_Participant($idSondage, $UnElm['idLicencie']);
$Montant_All_Choix = 0;
foreach ($LesChoix as $UnElm2)
if ($UnElm2['Montant'] > 0) {
$Montant_All_Choix += $UnElm2['Montant'] * $UnElm2['Nb'];
}
$k++;
if( $k%2 == 0 ){
$color = "#FAFAFA";
}
else{
$color = "#F5ECCE";
}
?>
<tr bgcolor="<?php echo $color;?>" align="center" style="height:20px;text-align:center;"
onmouseover="this.style.backgroundColor='#D5E5ED';"
onmouseout="this.style.backgroundColor='';">
<td><?php echo $UnElm['Prenom'] . " " . $UnElm['Nom'];?></td>
<td><?php echo DateAffichage(substr($Date_Participation['TS_Crea'], 0, 10), '-') . " à " . substr($Date_Participation['TS_Crea'], 11);?></td>
<?php
if ($Au_Moins_Un_Choix_Payant) {
// Est-ce que le licencié a choisi un choix payant ?
$Req = "select *
from scf_sondages_licencies a,scf_sondages_choix b
where a.idSondage = $idSondage
and a.idLicencie = " . $UnElm['idLicencie'] . "
and a.idSondage = b.idSondage
and a.idChoix = b.idChoix
and b.Montant > 0";
try {
$dbh = $GLOBALS['bdd']->query($Req);
$Result = $dbh->fetch();
}
catch (PDOException $e) {
echo "<h4><br>La requete est : ".$Req;
die('<br><strong>Erreur : ' . $e->getMessage()) . "</strong></h4>";
}
if ($Result["Montant"] > 0) {
echo "<td>";
$Somme = $Class_Sondages->Somme_Paye_By_idLicencie($idSondage, $UnElm['idLicencie']);
if ($Somme[0] > 0) {
$Diff = $Montant_All_Choix - $Somme[0];
echo number_format($Somme[0], 2) . " ";
if ($Diff > 0) echo "<font color='blue'><br>Reste à percevoir $Diff ";
if ($Diff < 0) echo "<font color='red'><br>Il y a un trop perçu de $Diff ";
}
else echo "En attente de réglement";
$Total += $Somme[0];
echo "</td>";
}
}
?>
</tr>
<?php
}
?>
<tr><td colspan="<?php echo $Nb_Col;?>"></td></tr>
<tr>
<?php
if ($Au_Moins_Un_Choix_Payant)
echo "<th></th>";
?>
<th>Total</th>
<th><?php echo number_format($Total, 2) . " ";?></th>
</tr>
</table>
</div>
<br>
<?php
}
$List_Choix = $Class_Sondages->select_All_Choix_By_Sondage($idSondage);
$Nb_Col = 2 + count($List_Choix);
if (isset($_POST['Tri_Inscription'])) {
$List_Participants = $Class_Sondages->select_All_Participants_Inscr($idSondage);
} else {
$List_Participants = $Class_Sondages->select_All_Participants($idSondage);
}
?>
<div id="bloc">
<form method="post" action="" id="form_inscription">
<?php
if (isset($_POST['Tri_Inscription'])) {
?>
<input type="submit" name="Tri_Nom" value="Trier par nom">
<?php
} else {?>
<input type="submit" name="Tri_Inscription" value="Trier par date">
<?php
}?>
</form>
<table border="1" align="center" CELLPADDING="5" CELLSPACING="0">
<tr><th colspan="<?php echo $Nb_Col?>"><h3>Liste des choix des participants</h3></th></tr>
<tr>
<th width="175px"> Participant </th>
<?php
foreach ($List_Choix as $UnElm)
echo "<th>" . $UnElm['Texte'] . "</th>";
?>
<th>Commentaire</th>
</tr>
<?php
$k = 0;
foreach ($List_Participants as $UnElm) {
$LesChoix_Participant = $Class_Sondages->select_Choix_By_Participant($idSondage, $UnElm['idLicencie']);
$Date_Participation = $Class_Sondages->select_max_Participation_idLicencie($idSondage, $UnElm['idLicencie']);
$k++;
if( $k%2 == 0 ){
$color = "#FAFAFA";
}
else{
$color = "#F5ECCE";
}
$Commentaire = "";
?>
<tr bgcolor="<?php echo $color;?>" align="center" style="height:20px;text-align:center;"
onmouseover="this.style.backgroundColor='#D5E5ED';"
onmouseout="this.style.backgroundColor='';">
<td><?php
echo "<a href='index.php?page=licencies_detail&UnLicencie= " . $UnElm['idLicencie'] . "'>" . $UnElm['Nom'] . " " . $UnElm['Prenom'] . "</a><br>";
echo DateAffichage(substr($Date_Participation['TS_Crea'], 0, 10), '-') . " à " . substr($Date_Participation['TS_Crea'], 11);
?>
</td>
<?php
foreach ($List_Choix as $UnElm2) {
echo "<td>";
foreach ($LesChoix_Participant as $UnChx) {
if ($UnElm2['idChoix'] == $UnChx['idChoix']) {
echo $UnChx['Nb'];
$Commentaire = $UnChx['Commentaire'];
}
}
echo "</td>";
}
?>
<td><?php echo $Commentaire?>
</tr>
<?php
}
?>
</table>
</div>
</center> |