MOD #137 création de classes et suppression de variables globales
[cl7.git] / php / panel.php
1 <?php # coding:utf-8
2
3 include_once("traitement_pre_affichage.php");
4
5 /**
6 * Représente le panel latéral contenant la liste des inscrits,
7 * la boite de login et d'autres informations.
8 */
9 class Panel
10 {
11 private $participant;
12
13 function Panel($participant)
14 {
15 $this->participant;
16 }
17
18 function rendre()
19 {
20 # selection de tous les participants
21 $res_SQL = mysql_query("SELECT pseudo FROM participants ORDER BY id");
22
23 echo '<div id="nbParticipants"><em>', mysql_num_rows($res_SQL), '</em> inscrit', (mysql_num_rows($res_SQL) > 1 ? 's' : ''), '</div>';
24
25 # affichage des participants
26 if (mysql_num_rows($res_SQL) > 0)
27 echo '<ul id="participants">';
28 for ($i=0; $i<mysql_num_rows($res_SQL); $i++)
29 {
30 mysql_data_seek($res_SQL, $i);
31 $le_participant_pseudo = mysql_fetch_object($res_SQL);
32 echo '<li>', traitement_pre_affichage($le_participant_pseudo->pseudo, 8), '</li>';
33 }
34 if (mysql_num_rows($res_SQL) > 0)
35 echo '</ul>';
36
37 if($this->participant->valide)
38 {
39 echo'
40 <form method="post" action="index.php?';
41
42 foreach($HTTP_GET_VARS as $nom => $valeur)
43 echo $nom,'=',$valeur,'&amp;';
44
45 echo'">
46 <p><input type="hidden" name="effacer_cookie" value="1" /></p>
47 <p><input type="submit" value="logout" /></p>
48 </form>';
49 }
50 else
51 {
52 if (isset($log)) echo '<em>[erreur de loggation]</em>';
53
54 echo'
55 <form method="post" action="index.php?';
56
57 foreach($HTTP_GET_VARS as $nom => $valeur)
58 echo $nom,'=',$valeur,'&amp;';
59
60 echo'">
61 <p>login / pass</p>
62 <p><input type="hidden" name="log" value="1" /></p>
63 <p><input type="text" name="pseudo" size="10" maxlength="30" /></p>
64 <p><input type="password" name="password" size="10" maxlength="10" /></p>
65 <p><input type="submit" value="oki" class="submitInvisible" /></p>
66 </form>
67 ';
68 }
69 }
70 }
71 ?>