4 * Représente un participant.
8 public $info; # Toute les infos du membre sous la forme d'un objet
9 public $valide; # Savoir si le participant existe
11 static private $NB_VOTES_PAR_PARTICIPANT = 3;
14 * Constructeur, peut être appelé sous trois formes différentes.
16 function Participant($v1=NULL, $v2=NULL)
18 # aucunes valeurs transmise => ce n'est pas un participant valide
19 if ($v1 == NULL && $v2 == NULL)
25 if (is_string($v1) && is_string($v2)) # Aucun des arguments n'est vide alors c'est le pseudo et le password qui ont été transmis
26 $res = mysql_query("SELECT * FROM participants WHERE pseudo = '" . addslashes($v1) . "' AND password = '" . addslashes($v2) . "'");
27 else # Sinon c'est l'id
28 $res = mysql_query("SELECT * FROM participants WHERE id = " . addslashes($v1));
30 if (mysql_error() || mysql_num_rows($res) == 0)
32 $this->valide
= FALSE;
36 $this->info
= mysql_fetch_object($res);
42 * Renvoie le nombre de votes restant pour le participant.
44 function nb_vote_restant()
46 $nombre_de_vote = mysql_fetch_array(mysql_query("
47 SELECT COUNT(*) FROM participants RIGHT JOIN jeux_choisis ON participants.id = jeux_choisis.participant_id
48 WHERE participants.id = " . $this->info
->id
. "
49 GROUP BY participants.id
52 return Participant
::$NB_VOTES_PAR_PARTICIPANT - $nombre_de_vote[0];
56 * Renvois TRUE si le nombre de participant max est atteint.
58 static function nombre_participant_max_atteint()
61 $res_SQL = mysql_query("SELECT COUNT(*) FROM participants");
62 $nb_participant = mysql_fetch_row($res_SQL);
64 return $nb_participant[0] >= $config->get('nb_max_participant');
68 * Renvois le nombre de places restantes.
70 static function nombre_place_restante()
73 $res_SQL = mysql_query("SELECT COUNT(*) FROM participants");
74 $nb_participant = mysql_fetch_row($res_SQL);
76 return $config->get('nb_max_participant') - $nb_participant[0];