FIX #97
[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 <tr>
14 <th>pseudo</th>
15 <th>nom</th>
16 <th>prénom</th>';
17 $nb_periode = 0;
18 while($periode = mysql_fetch_object($periodes))
19 {
20 $debut_table .= '<th>'.$periode->nom_abrege.'</th>';
21 $nb_periode++;
22 }
23 $debut_table .= '<th>remarques</th>
24 </tr>';
25
26 $clan_courant = null;
27
28 echo '<table class="inscrits">';
29 while($participant = mysql_fetch_object($participants))
30 {
31 if ($clan_courant !== $participant->clan_nom)
32 {
33 echo ($participant->clan_nom != '' ? '<tr><td colspan="'. ($nb_periode + 4) .'"><h1>'.traitement_pre_affichage($participant->clan_nom).'</h1></td></tr>' : ''), $debut_table;
34 $clan_courant = $participant->clan_nom;
35 }
36
37 $participations = mysql_query("
38 SELECT periodes.nom, participations.participant_id FROM periodes
39 LEFT JOIN participations ON periodes.id = participations.periode_id AND participations.participant_id = ".$participant->id."
40 ORDER BY id
41 ");
42
43 echo '<tr>';
44 echo '<td>', htmlentities($participant->clan_tag, ENT_QUOTES, "UTF-8"), traitement_pre_affichage($participant->pseudo), '</td>';
45 echo '<td>', traitement_pre_affichage($participant->nom), '</td>';
46 echo '<td>', traitement_pre_affichage($participant->prenom), '</td>';
47 while ($participation = mysql_fetch_object($participations))
48 echo '<td '.($participation->participant_id == $participant->id ? 'class="participe"' : '').'></td>';
49
50 echo '<td>', traitement_pre_affichage($participant->remarques), '</td>';
51 echo '</tr>';
52 }
53 echo '</table>';
54 ?>
55