www

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

commit f8407d8b8f5cf607929be659702e719f015b6bb8
parent f3e1d57c35994acd8dfa3e31e2d186e97059c665
Author: Yoann <yoann.b87@voila.fr>
Date:   Sun, 20 Mar 2011 19:04:06 +0100

La page de création de partie est "terminée" il manque un peu de
pauffinage mais elle à l'air de marcher (a tester correctement quand
même).

Diffstat:
Mcode/serveur/php/createGame.php | 47+++++++++++++++++++++++++++++------------------
Mcode/serveur/php/ressources/simple.css | 3+++
Mcode/serveur/php/ressources/strings.inc | 3+++
3 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/code/serveur/php/createGame.php b/code/serveur/php/createGame.php @@ -91,12 +91,21 @@ if(isset($_POST['nbcloudwords'])) { if($err != true) $state = 2; + else { + $err = true; + $msg = $strings['err_creategame_cloud_fill_all']; + } + } else { $err = true; $msg = $strings['err_creategame_eq_relations']; } } + elseif (isset($_POST['centralword']) && empty($_POST['centralword'])) { + $err = true; + $msg = $strings['err_creategame_cloud_fill_all']; + } if($state == 2) { $respwords = getWordsAndResponses($nbwords); @@ -107,33 +116,38 @@ if(isset($_POST['nbcloudwords'])) { $addedWords = 0; if($respwords != -1 && isset($_POST['tDifficulty'])) { - $totalDifficulty = $_POST['tDifficulty']; + if(is_numeric($totalDifficulty = $_POST['tDifficulty'])) { - if(insertNode($centralword)) - $addedWords++; + if(insertNode($centralword)) + $addedWords++; - $centralword = getNodeEid($centralword); + $centralword = getNodeEid($centralword); - foreach($respwords as $key=>$rw) { - $difficulty = $totalDifficulty / count($respwords); + foreach($respwords as $key=>$rw) { + $difficulty = $totalDifficulty / count($respwords); - if(insertNode($respwords[$key][0])) - $addedWords++; + if(insertNode($respwords[$key][0])) + $addedWords++; - $cloud[$key] = array('pos'=>$key, 'd'=> $difficulty, 'eid'=>getNodeEid($respwords[$key][0]), - 'probaR1'=> probaOf("r1", $rw[1]), - 'probaR2'=> probaOf('r2', $rw[1]), - 'probaR0'=> probaOf('r0', $rw[1]), - 'probaTrash'=> probaOf('trash', $rw[1])); + $cloud[$key] = array('pos'=>$key, 'd'=> $difficulty, 'eid'=>getNodeEid($respwords[$key][0]), + 'probaR1'=> probaOf("r1", $rw[1]), + 'probaR2'=> probaOf('r2', $rw[1]), + 'probaR0'=> probaOf('r0', $rw[1]), + 'probaTrash'=> probaOf('trash', $rw[1])); + } + } + else { + $err = true; + $msg = $strings['err_creategame_isNumeric_tDifficulty']; } $state = 3; $msg = $strings['ok_creategame_game_create']; } - //cgInsert($centralword, $cloud, $r1, $r2, $totalDifficulty); + cgInsert($centralword, $cloud, $r1, $r2, $totalDifficulty); } - else { + elseif($state == 2) { $err = true; $msg = $strings['err_creategame_fill_all']; } @@ -141,8 +155,6 @@ if(isset($_POST['nbcloudwords'])) { else $err = true; - - ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -249,7 +261,6 @@ else echo '<tr><td colspan="4"><input type="submit" value="Enregistrer" /></td></tr>'; } elseif($state == 3) { - { echo '<p>nombre de mots ajoutés dans la base de données : '.$addedWords; } ?> diff --git a/code/serveur/php/ressources/simple.css b/code/serveur/php/ressources/simple.css @@ -112,10 +112,12 @@ form input[type=submit] { .creategame .wordsform { border-collapse : collapse; + margin-top : 20px; } .creategame .wordsform td { border : 1px solid #808080; + border-right : none; vertical-align : middle; padding : 1.5ex; text-align : right; @@ -127,6 +129,7 @@ form input[type=submit] { text-align : left; padding-left : 1em; padding-right : 3em; + border-left : 0; } diff --git a/code/serveur/php/ressources/strings.inc b/code/serveur/php/ressources/strings.inc @@ -13,6 +13,9 @@ $strings['err_contact_fill_all'] = "Veuillez remplir tout les champs."; $strings['err_creategame_fill_all'] = "Tous les mots du nuage ne sont pas renseignés."; $strings['err_creategame_nbwords_value'] = "Veuillez entrer une valeur supérieure à zéro."; $strings['ok_creategame_game_create'] = "La partie à bien été enregistrée."; +$strings['err_creategame_eq_relations'] = "Les deux relations doivent être différentes."; +$strings['err_creategame_isNumeric_tDifficulty'] = "La difficulté doit être une valeur numérique"; +$strings['err_creategame_cloud_fill_all'] = "Veuillez remplir l'intégralité des champs."; $strings['err_index_invalid_msg'] = "Paramètre de la requête invalide. Merci de nous signaler le problème."; $strings['err_index_redirect'] = "Erreur de redirection. Merci de nous signaler le problème.";