ADD informations concernant les jours pendant lesquels les participants sont présent...
[cl7.git] / php / tx_inscrits.php
index 89ff6a0..eac8390 100644 (file)
@@ -2,33 +2,47 @@
 \r
 include_once("traitement_pre_affichage.php");\r
 \r
-$res = mysql_query("SELECT pseudo, nom, prenom, age, clan_nom, clan_tag, remarques FROM participants ORDER by clan_nom, clan_tag, pseudo");\r
-\r
+$participants = mysql_query("
+   SELECT id, pseudo, nom, prenom, clan_nom, clan_tag, remarques
+   FROM participants
+   ORDER by clan_nom, clan_tag, pseudo
+");\r
+
+$periodes = mysql_query("SELECT nom_abrege FROM periodes ORDER BY id");\r
 $debut_table = '\r
 <table class="inscrits">\r
  <tr>\r
   <th>pseudo</th>\r
   <th>nom</th>\r
-  <th>prénom</th>\r
-  <th>age</th>\r
-  <th>remarques</th>\r
+  <th>prénom</th>';
+while($periode = mysql_fetch_object($periodes))
+   $debut_table .= '<th>'.$periode->nom_abrege.'</th>';\r
+$debut_table .= '<th>remarques</th>\r
  </tr>';\r
  \r
 $clan_courant = null;\r
 \r
-while($participant = mysql_fetch_object($res))\r
+while($participant = mysql_fetch_object($participants))\r
 {  \r
    if ($clan_courant !== $participant->clan_nom)\r
    {\r
       echo ($participant->clan_nom != '' ? '</table><h1>'.traitement_pre_affichage($participant->clan_nom).'</h1>' : ''), $debut_table;\r
       $clan_courant = $participant->clan_nom;\r
-   }\r
+   }
+   
+   $participations = mysql_query("
+      SELECT periodes.nom, participations.participant_id FROM periodes
+      LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = ".$participant->id."
+      ORDER BY id
+   ");\r
    \r
    echo '<tr>';\r
        echo '<td>', htmlentities($participant->clan_tag, ENT_QUOTES, "UTF-8"), traitement_pre_affichage($participant->pseudo), '</td>';\r
        echo '<td>', traitement_pre_affichage($participant->nom), '</td>';\r
-       echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';\r
-       echo '<td>', traitement_pre_affichage($participant->age), '</td>';\r
+       echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';
+   while ($participation = mysql_fetch_object($participations))
+      echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
+   \r
        echo '<td>', traitement_pre_affichage($participant->remarques), '</td>';\r
        echo '</tr>';\r
 }\r