www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f7b50013ffdf9af0bca445fe7ffe4cf865ad4f9d
parent 22879841b0424c6f232043fdfc388179190abbf3
Author: Yoann Bonavero <yoann.b87@voila.fr>
Date:   Wed,  9 Mar 2011 11:14:56 +0100

Continuation de la page de création de partie.

Diffstat:
Mcode/serveur/php/createGame.php | 13+++++++++++++
Mcode/serveur/php/pticlic.php | 15+++++++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/code/serveur/php/createGame.php b/code/serveur/php/createGame.php @@ -1,5 +1,6 @@ <?php require_once("ressources/strings.inc"); +require_once("pticlic.php"); session_start(); $state = 0; @@ -17,6 +18,8 @@ if(isset($_POST['nbcloudwords'])) { $state = 1; if($state == 1) { + $relations = get_game_relations(); + for($i = 0; $i < $nbwords; $i++) if(!isset($_POST['word'.$i]) || empty($_POST['word'.$i])) { $err = true; @@ -67,6 +70,16 @@ if($err == false) } elseif($state == 1) { echo '<table class="wordsform">'; + echo '<tr><td><label for="relation1">Relation 1 : </label></td>'; + echo '<td class="inputcell"><select name="relation1">'; + foreach($relations as $r) + echo '<option value="'.$r[0].'">'.$r[1].'</option>'; + echo '</select></td>'; + echo '<td><label for="relation2">Relation 2 : </label></td>'; + echo '<td class="inputcell"><select name="relation2">'; + foreach($relations as $r) + echo '<option value="'.$r[0].'">'.$r[1].'</option>'; + echo '</select></td>'; echo '<input type="hidden" name="nbcloudwords" value="'.$nbwords.'" />'; echo '<tr><td colspan="2"><label for="centralword">Mot central : </label><br /><br /></td>'; echo '<td colspan="2" class="inputcell"><input type="text" name="centralword" value="'; diff --git a/code/serveur/php/pticlic.php b/code/serveur/php/pticlic.php @@ -546,4 +546,19 @@ function setGame($user, $pgid, $gid, $answers) return $scores; } +/** Fourni l'ensembles des relations pouvant apparaître dans le jeu. +* @return array : un tableau de realtions. +*/ +function get_game_relations() +{ + $reqlations = array(); + $db = getDB(); + + $res = $db->query("SELECT num,name FROM type_relation"); + + while($r = $res->fetchArray()) + $relations[] = $r; + + return $relations; +} ?>