diff --git a/Seance5-6/seance/index.php b/Seance5-6/seance/index.php index a035d740d613ea7479dea5fb7f5b8d497f84314c..fea1236f22ccc8993deffd80133e1cd600857f77 100644 --- a/Seance5-6/seance/index.php +++ b/Seance5-6/seance/index.php @@ -27,6 +27,7 @@ $app->get('/api/games/',function() { + $app->run(); //echo "<a href='Question1.php'>question 1 -- afficher (name, deck) les personnages du jeu 12342</a><br>"; diff --git a/Seance5-6/seance/src/controller/IndexController.php b/Seance5-6/seance/src/controller/IndexController.php index 728087ec218361c9a7f27a8a407e7f034ce75fa3..9688da3f0b3b3cc3ab7b2b49a9d0c897d2fdf822 100644 --- a/Seance5-6/seance/src/controller/IndexController.php +++ b/Seance5-6/seance/src/controller/IndexController.php @@ -17,11 +17,24 @@ class IndexController } public static function partie2() { + + $game = Game::select('id','name','alias','deck')->where('id','<=','200')->get(); + // $game = Game::where('id','=',1)->get(); + // $json = json_encode($game,JSON_FORCE_OBJECT); + $json = '{ "games" : [ '; + foreach($game as $key => $value) { + $json = $json . '"game" :{'; + $json = $json . json_encode($value) . ',},"links" :{"self": {"href":"/api/games/'.$value->id.'"}}'; + } + $json = $json . ']}'; + $cq2 = new CQuestion2($json); + $cq2->render(); + /* $game = Game::select('id','name','alias','deck')->where('id','<=','200')->get(); // $game = Game::where('id','=',1)->get(); // $json = json_encode($game,JSON_FORCE_OBJECT); - $json = '{ "games" : [ '; foreach($game as $key => $value) { +<<<<<<< HEAD $json = $json . json_encode($value) . ','; /*$json = $json . '{ "id": ' . $value->id . ', @@ -36,12 +49,18 @@ class IndexController "name":' . $value->name . ', "deck":' . $value->deck . ', } - ';*/ + '; } } $json = $json . ']}'; +======= + $value->description = "..."; + } + $json = json_encode($game); +>>>>>>> e2c791070c5330916f63fb55c2b639a71a327bcb $cq2 = new VuePartie2($json); - $cq2->render(); + $cq2->render();*/ } + } \ No newline at end of file diff --git a/Seance5-6/seance/src/view/VuePartie1.php b/Seance5-6/seance/src/view/VuePartie1.php index 1967e6bfa8a59ee76ec4dfc163a88e296a331faf..1a7f1ad9ec76a1afceaeff963447d5e804c08571 100644 --- a/Seance5-6/seance/src/view/VuePartie1.php +++ b/Seance5-6/seance/src/view/VuePartie1.php @@ -12,21 +12,21 @@ class VuePartie1 $json = json_encode($game); $this->content = <<< END -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8" content="application/json"> - - <link rel="stylesheet" href="css/main.css"> - - <title>photobox</title> -</head> + <!DOCTYPE html> + <html lang="fr"> + <head> + <meta charset="UTF-8" content="application/json"> + + <link rel="stylesheet" href="css/main.css"> + + <title>photobox</title> + </head> -<body> + <body> -$json + $json -</body> + </body> END; diff --git a/Seance5-6/seance/src/view/VuePartie2.php b/Seance5-6/seance/src/view/VuePartie2.php index a7c83edba117a886a942221ae1b4631a62152540..892645ff4691e38cb9fdf8610597520ae852402b 100644 --- a/Seance5-6/seance/src/view/VuePartie2.php +++ b/Seance5-6/seance/src/view/VuePartie2.php @@ -21,12 +21,11 @@ class VuePartie2 <link rel="stylesheet" href="css/main.css"> - <title>photobox</title> + <title>AppliBD</title> </head> <body> - <h1>Titre</h1> - <p>$json</p> + $json </body> END;