X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=php%2Fpages%2Fjeux_joues.php;h=276c8f5630cd3fd1d66977b10f5f65d0788baeb9;hb=424a8f0a34fc72fe64daaac4686f991a298933a3;hp=a05a38803392cd74c5ebd493e782fcb99b59f8c8;hpb=23bc2016d5fbd8f7daa9b7ba5c7fa862709ff7a7;p=cl7.git diff --git a/php/pages/jeux_joues.php b/php/pages/jeux_joues.php index a05a388..276c8f5 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 : @@ -23,12 +28,14 @@ $jeux_query = pg_query(" SELECT jeux.id, jeux.nom, + jeux.type, + jeux.url, array_agg(jeux_choisis.participant_id) AS participants, (COUNT(*) + (CASE WHEN bool_and(jeux_choisis.participant_id is null) THEN -1 ELSE 0 END)) as nb_vote FROM jeux LEFT JOIN jeux_choisis ON jeux.id = jeux_choisis.jeu_id - GROUP BY jeux.id, jeux.nom + GROUP BY jeux.id, jeux.nom, jeux.type, jeux.url ORDER BY nb_vote DESC, jeux.nom "); @@ -37,7 +44,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++) @@ -45,25 +52,33 @@ while ($jeu = pg_fetch_object($jeux_query)) $a_vote = in_array($participant->info->id, $participants); } + + $a_url = preg_match('/^https?:\/\/.+$/', $jeu->url); echo '', - $participant->existe() ? '' : '', + $vote_possible ? '' : '', '', - ''; + '', + '', + ''; } echo '
VotesJeux
VotesNomType
' . $jeu->nb_vote . '' . traitement_pre_affichage($jeu->nom) . '
' . ($a_url ? '' : '') . traitement_pre_affichage($jeu->nom) . ($a_url ? '' : '') . '' . traitement_pre_affichage($jeu->type) . 'x
'; -if ($participant->existe()) +if ($vote_possible) echo ' -

Autre :

+

Ajouter : + + + +

'; 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