From: Greg Burri Date: Mon, 21 Sep 2009 13:10:45 +0000 (+0200) Subject: MOD #134 X-Git-Url: http://git.euphorik.ch/?p=cl7.git;a=commitdiff_plain;h=912c54815fb34d93de674af2bcf3acc85ce7421d MOD #134 --- diff --git a/php/controller.php b/php/controller.php index cad4352..41381ac 100644 --- a/php/controller.php +++ b/php/controller.php @@ -96,7 +96,7 @@ class Controller } } # vote pour des jeux (autorisé même lorsque les inscriptions sont terminées) - else if (isset($_POST['set_jeux_joues']) && $this->participant->existe()) + else if (isset($_POST['set_jeux_joues']) && $this->participant->existe() && !$config->get("inscription_terminees")) { $votes = $_POST['votes']; if (!$votes) @@ -121,7 +121,8 @@ class Controller pg_query("BEGIN"); $res = pg_query_params("SELECT id FROM jeux WHERE nom = $1", array($jeu)); if ($id = pg_fetch_object($res)) - array_unshift($votes, $id->id); + if (!in_array($id->id, $votes)) + array_unshift($votes, $id->id); } } diff --git a/php/pages/jeux_joues.php b/php/pages/jeux_joues.php index a05a388..9c531ec 100644 --- a/php/pages/jeux_joues.php +++ b/php/pages/jeux_joues.php @@ -5,14 +5,19 @@ include_once("php/traitement_pre_affichage.php"); if (!$participant->existe()) { echo '

Remarque : Il faut être inscrit pour pouvoir voter.

'; +} +else if ($config->get("inscription_terminees")) +{ + echo '

Remarque : Les inscriptions sont terminées, il n\'est plus possible de voter.

'; } - + +$vote_possible = !$config->get("inscription_terminees") && $participant->existe(); echo '

- ', ($participant->existe() ? '' : ''), ''; + ', ($vote_possible ? '' : ''), ''; # /!\ Attention, requête un poil tricky : # On souhait avoir une liste des jeux joués avec pour chaque tuple : @@ -37,7 +42,7 @@ while ($jeu = pg_fetch_object($jeux_query)) $a_vote = FALSE; # est-ce que le participant courant à voté pour ce jeu ? - if ($participant->existe()) + if ($vote_possible) { $participants = split(",", ereg_replace("[{-}]", "", $jeu->participants)); for($i = 0; $i < count($participants); $i++) @@ -47,7 +52,7 @@ while ($jeu = pg_fetch_object($jeux_query)) } echo '', - $participant->existe() ? '' : '', + $vote_possible ? '' : '', '', ''; } @@ -55,7 +60,7 @@ while ($jeu = pg_fetch_object($jeux_query)) echo '
VotesJeux
VotesJeux
' . $jeu->nb_vote . '' . traitement_pre_affichage($jeu->nom) . '
'; -if ($participant->existe()) +if ($vote_possible) echo '

Autre :

'; @@ -63,7 +68,7 @@ if ($participant->existe()) echo '
'; # affichage du nombre de vote restant -if ($participant->existe()) +if ($vote_possible) echo '

Nombre de votes restant : ' . $participant->nb_vote_restant() . '

'; ?> \ No newline at end of file