La page de création de partie insère les données dans la base de donnée
lorsque le formulaire est bien rempli.
This commit is contained in:
parent
39ac793589
commit
c80ce179d8
|
@ -297,21 +297,21 @@ function cgInsert($centerEid, $cloud, $r1, $r2, $totalDifficulty)
|
|||
$db->exec("commit;");
|
||||
}
|
||||
|
||||
function decodeGame($json) {
|
||||
$game = JSON_decode($json,true);
|
||||
|
||||
$centerEid = getNodeEid($game['centralWord']);
|
||||
foreach($game['cloud'] as $w)
|
||||
function decodeAndInsertGame($game) {
|
||||
$centerEid = getNodeEid($game['center']);
|
||||
$r1 = $game['relations'][0];
|
||||
$r2 = $game['relations'][1];
|
||||
foreach($game['cloud'] as $key => $w)
|
||||
$cloud[] = Array("eid" => getNodeEid($w['name']),
|
||||
"pos" => $key,
|
||||
"d" => 5,
|
||||
"probaR1" => $w['relations'][0] ? "1" : "0",
|
||||
"probaR2" => $w['relations'][0] ? "1" : "0",
|
||||
"probaR0" => $w['relations'][0] ? "1" : "0",
|
||||
"probaTrash" => $w['relations'][0] ? "1" : "0");
|
||||
"probaR2" => $w['relations'][1] ? "1" : "0",
|
||||
"probaR0" => $w['relations'][2] ? "1" : "0",
|
||||
"probaTrash" => $w['relations'][3] ? "1" : "0");
|
||||
|
||||
|
||||
print_r($cloud);
|
||||
insertCreatedGame($centerEid,$cloud,$r1,$r2,10);
|
||||
}
|
||||
|
||||
function insertCreatedGame($centerEid, $cloud, $r1, $r2, $totalDifficulty)
|
||||
|
|
|
@ -156,10 +156,10 @@ $(function() {
|
|||
exit.cloud.push({
|
||||
name:$("#word-"+i).val(),
|
||||
relations:[
|
||||
$("#r1-"+i).is(":checked"),
|
||||
$("#r2-"+i).is(":checked"),
|
||||
$("#r3-"+i).is(":checked"),
|
||||
$("#r4-"+i).is(":checked")
|
||||
$("#r1-"+i).is(":checked") ? "1":"0",
|
||||
$("#r2-"+i).is(":checked") ? "1":"0",
|
||||
$("#r3-"+i).is(":checked") ? "1":"0",
|
||||
$("#r4-"+i).is(":checked") ? "1":"0"
|
||||
]
|
||||
});
|
||||
}
|
||||
|
|
|
@ -81,11 +81,10 @@ function main()
|
|||
echo getGameRelationsJSON();
|
||||
}
|
||||
else if($action == 6) {
|
||||
var_dump($_GET['game']);
|
||||
if (!isset($_GET['game']))
|
||||
errRequestIncomplete();
|
||||
|
||||
//decodeGame($_GET['game']);
|
||||
decodeAndInsertGame($_GET['game']);
|
||||
|
||||
} else {
|
||||
throw new Exception("Commande inconnue", 2);
|
||||
|
|
Loading…
Reference in New Issue
Block a user