From be00b55731b4314883f4d716d5d5ad4233cfbb4d Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Wed, 2 Dec 2015 11:19:29 +0100 Subject: [PATCH] ajout du Systeme de Repo --- .gitignore | 3 ++ repositories/StaticRepo.php | 57 ++++++++++++++++++++++++++++++++ repositories/exemple_config.json | 6 ++++ repositories/index.html | 0 4 files changed, 66 insertions(+) create mode 100644 .gitignore create mode 100755 repositories/StaticRepo.php create mode 100644 repositories/exemple_config.json create mode 100755 repositories/index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41fbd7c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/.idea +/.project +/repositories/config.json diff --git a/repositories/StaticRepo.php b/repositories/StaticRepo.php new file mode 100755 index 0000000..cd746e9 --- /dev/null +++ b/repositories/StaticRepo.php @@ -0,0 +1,57 @@ +prepare('SELECT Annee FROM Annees + ORDER BY Annees.Annee DESC + LIMIT 1'); + $req->execute(); + $result = $req->fetch(PDO::FETCH_ASSOC); + static::$annee = $result['Annee']; + } + + return static::$annee; + } + + /** + * @return bool test de la Connexion + */ + public static function testConnexion(){ + return static::getConnexion() instanceof PDO; + } +} + +?> diff --git a/repositories/exemple_config.json b/repositories/exemple_config.json new file mode 100644 index 0000000..6469b2f --- /dev/null +++ b/repositories/exemple_config.json @@ -0,0 +1,6 @@ +{ + "host": "serveurMySql", + "login": "leLogin", + "password": "leMotDePasse", + "database": "nomBaseDeDonnée" +} diff --git a/repositories/index.html b/repositories/index.html new file mode 100755 index 0000000..e69de29