FIX oubli
[cl7.git] / php / tx_inscrits.php
1 <?php # coding:utf-8
2
3 include_once("traitement_pre_affichage.php");
4
5 $participants = mysql_query("
6 SELECT id, pseudo, nom, prenom, clan_nom, clan_tag, remarques
7 FROM participants
8 ORDER by clan_nom, clan_tag, pseudo
9 ");
10
11 $periodes = mysql_query("SELECT nom_abrege FROM periodes ORDER BY id");
12 $debut_table = '
13 <table class="inscrits">
14 <tr>
15 <th>pseudo</th>
16 <th>nom</th>
17 <th>prénom</th>';
18 while($periode = mysql_fetch_object($periodes))
19 $debut_table .= '<th>'.$periode->nom_abrege.'</th>';
20 $debut_table .= '<th>remarques</th>
21 </tr>';
22
23 $clan_courant = null;
24
25 while($participant = mysql_fetch_object($participants))
26 {
27 if ($clan_courant !== $participant->clan_nom)
28 {
29 echo ($participant->clan_nom != '' ? '</table><h1>'.traitement_pre_affichage($participant->clan_nom).'</h1>' : ''), $debut_table;
30 $clan_courant = $participant->clan_nom;
31 }
32
33 $participations = mysql_query("
34 SELECT periodes.nom, participations.participant_id FROM periodes
35 LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = ".$participant->id."
36 ORDER BY id
37 ");
38
39 echo '<tr>';
40 echo '<td>', htmlentities($participant->clan_tag, ENT_QUOTES, "UTF-8"), traitement_pre_affichage($participant->pseudo), '</td>';
41 echo '<td>', traitement_pre_affichage($participant->nom), '</td>';
42 echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';
43 while ($participation = mysql_fetch_object($participations))
44 echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
45
46 echo '<td>', traitement_pre_affichage($participant->remarques), '</td>';
47 echo '</tr>';
48 }
49 echo '</table>';
50 ?>