From f9217a5c83b3040ec2edd4967ef1046b1322b233 Mon Sep 17 00:00:00 2001
From: Table <romain.drouin@ensiie.fr>
Date: Sat, 7 May 2016 14:40:21 +0200
Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20page=20g=C3=A9rant=20les=20je?=
 =?UTF-8?q?ux?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/controller/AdminController.php |  6 ++++-
 app/kernel/Router.php              |  5 ++++
 app/view/Admin/displayJeu.html     | 38 ++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 app/view/Admin/displayJeu.html

diff --git a/app/controller/AdminController.php b/app/controller/AdminController.php
index dcc0152..2ec7d37 100644
--- a/app/controller/AdminController.php
+++ b/app/controller/AdminController.php
@@ -5,6 +5,10 @@ class AdminController extends Controller {
     public function display() {
         $this->view->display();
     }
-    
+
+    public function displayJeu() {
+        $this->view->nonValide = Admin::getListeJeuNonValide();
+        $this->view->display();
+    }
 
 }
\ No newline at end of file
diff --git a/app/kernel/Router.php b/app/kernel/Router.php
index 9f664dc..b91874d 100644
--- a/app/kernel/Router.php
+++ b/app/kernel/Router.php
@@ -134,6 +134,11 @@ class Router { // classe PHP permettant l'analyse de l'URL des requêtes
 				$result["controller"] = 'Admin';
 				$result['action'] = "display";
 			}
+
+			else if($parts[0] == "admin" && count($parts) == 2 && $parts[1] == 'jeu') {
+				$result["controller"] = 'Admin';
+				$result['action'] = "displayJeu";
+			}
 			
 			// à chaque fois qu'on crée une nouvelle page, il faut rajouter un cas à cet endroit !
 			
diff --git a/app/view/Admin/displayJeu.html b/app/view/Admin/displayJeu.html
new file mode 100644
index 0000000..a3dd8ed
--- /dev/null
+++ b/app/view/Admin/displayJeu.html
@@ -0,0 +1,38 @@
+<?php
+	$page_title = "Page d'administration";
+include(ROOT."/app/view/Includes/header.include.html");
+?>
+
+<?php if(isset($_SESSION['user']) && Admin::estAdmin($_SESSION['user']->slug)) { ?>
+
+<article>
+    <h3 class="stat-title">Jeu(x) non Validé(s)</h3>
+    <table class="jeux-preferes">
+        <?php //if(!empty($this->nonValide)){
+            foreach($this->nonValide as $ligne) {
+            print "
+            <tr>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\"> <img src=\"".BASE_URL."/images/jeu/".$ligne['slug'].".jpg\" alt=\"logo de ".$ligne['nom']."\" /></a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['nom']."</a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['min_joueurs']."</a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['max_joueurs']."</a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['min_equipes']."</a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['max_equipes']."</a></td>
+                <td><a href=\"".BASE_URL."/jeu/".$ligne['slug']."\">".$ligne['type']."</a></td>
+                <td><a href=\"\">Accepeter</a></td>
+                <td><a href=\"\">Refuser</a></td>
+            </tr>
+            ";
+            //}
+        }
+        ?>
+    </table>
+</article>
+
+<?php } else { ?>
+
+<article class="msg-erreur">Vous n'êtes pas connecté comme administrateur</article>'
+
+<?php } ?>
+
+<?php include(ROOT."/app/view/Includes/footer.include.html"); ?>
-- 
GitLab