From 12ba69cb8013c55f983b926eb2e079043fbbf719 Mon Sep 17 00:00:00 2001
From: Eliah REBSTOCK <eliah.rebstock@ensiie.fr>
Date: Tue, 26 Apr 2016 11:16:59 +0200
Subject: [PATCH] fonction verify sur PartieControleur

---
 app/controller/PartieController.php | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/app/controller/PartieController.php b/app/controller/PartieController.php
index b4f0d74..2955880 100644
--- a/app/controller/PartieController.php
+++ b/app/controller/PartieController.php
@@ -13,9 +13,29 @@ class PartieController extends Controller
         $this->view->listej = Profil::getList();
         $this->view->display();
     }
-
+    
     public function displayValid(){
         $this->view->display();
     }
+    
+    public function verify(){
+
+        if(!isset($_POST['jeu']) || !isset($_POST['joueurs']) || !isset($_POST['scores'])) {
+            //appeler une fonction d'erreur
+            echo "<h1>Erreur : variables absentes</h1>";
+            die();
+        }
+        $data = $_POST;
+
+        $scores = explode(";", $data["scores"]);
+        print_r($scores);
+        if (count($scores) != count($data["joueurs"])){
+            //appeler une fonction d'erreur
+            echo "<h1>Erreur : variables pb</h1>";
+            die();
+        }
+        
+        Partie::addPartie($data['joueurs'], $scores, $data['jeu']);
+    }
 
 }
\ No newline at end of file
-- 
GitLab