From b3d87e4664d9a17c9122e1917bd9dcf605955d59 Mon Sep 17 00:00:00 2001 From: Lucas Mascaro Date: Wed, 2 Dec 2015 13:31:37 +0100 Subject: [PATCH] =?UTF-8?q?mise=20en=20place=20des=20repo=20+=20d=C3=A9fin?= =?UTF-8?q?ition=20des=20fonctions=20+=20d=C3=A9but=20d'impl=C3=A9mentatio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoloader.php | 2 +- repositories/repos/MedecinRepo.php | 40 +++++++++++++++++++++++ repositories/repos/PatientRepo.php | 52 ++++++++++++++++++++++++++++++ repositories/repos/RDVRepo.php | 44 +++++++++++++++++++++++++ repositories/repos/StatsRepo.php | 22 +++++++++++++ 5 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 repositories/repos/MedecinRepo.php create mode 100644 repositories/repos/PatientRepo.php create mode 100644 repositories/repos/RDVRepo.php create mode 100644 repositories/repos/StatsRepo.php diff --git a/autoloader.php b/autoloader.php index da6f80f..6f2b45e 100755 --- a/autoloader.php +++ b/autoloader.php @@ -13,7 +13,7 @@ function autoloader($class) { if(strpos($class, 'StaticRepo') !== FALSE){ require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'repositories'.DIRECTORY_SEPARATOR.$class . '.php'; } - //si on charge un Repo + //si on charge un repos elseif(strpos($class, 'Repo') !== FALSE){ require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'repositories'.DIRECTORY_SEPARATOR.'repos'.DIRECTORY_SEPARATOR.$class . '.php'; diff --git a/repositories/repos/MedecinRepo.php b/repositories/repos/MedecinRepo.php new file mode 100644 index 0000000..4545fda --- /dev/null +++ b/repositories/repos/MedecinRepo.php @@ -0,0 +1,40 @@ +connexion = StaticRepo::getConnexion(); + } + + public function getById($id){ + $req = $this->connexion->prepare('SELECT * FROM Medecin WHERE Id = :id'); + $req->execute(['id' => $id]); + return $req->fetchAll(); + + } + + public function add($civilite,$prenom,$nom){ + + } + + public function delete($idPatient){ + + } + + public function search($nom,$prenom){ + + } + + public function getPatients($idMedecin){ + + } + +} \ No newline at end of file diff --git a/repositories/repos/PatientRepo.php b/repositories/repos/PatientRepo.php new file mode 100644 index 0000000..caa6dd4 --- /dev/null +++ b/repositories/repos/PatientRepo.php @@ -0,0 +1,52 @@ +connexion = StaticRepo::getConnexion(); + } + + public function getById($id){ + $req = $this->connexion->prepare('SELECT * FROM Patient WHERE Id = :id'); + $req->execute(['id' => $id]); + return $req->fetchAll(); + + } + + public function add($civilite,$prenom,$nom,$adresse,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){ + + $req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)'); + $req->execute(['civilite' => $civilite, + 'nom' => $nom, + 'prenom' => $prenom, + 'adresse' => $adresse, + 'ville' => $ville, + 'codePostal' => $codePostal, + 'dateNaissance' => $dateNaissance, + 'lieuNaissance' => $lieuNaissance, + 'numSecu' => $numSecu, + 'medecin' => $medecinTraitant ]); + + } + + public function delete($idPatient){ + + } + + public function updateMedecinTraitant($idPatient,$IdMedecin){ + + } + + public function search($nom,$prenom){ + + } + +} \ No newline at end of file diff --git a/repositories/repos/RDVRepo.php b/repositories/repos/RDVRepo.php new file mode 100644 index 0000000..da8644d --- /dev/null +++ b/repositories/repos/RDVRepo.php @@ -0,0 +1,44 @@ +connexion = StaticRepo::getConnexion(); + } + + public function getById($id){ + $req = $this->connexion->prepare('SELECT * FROM RDV WHERE Id = :id'); + $req->execute(['id' => $id]); + return $req->fetchAll(); + + } + + public function getByDate($date){ + + } + + public function delete($idPatient){ + + } + + public function add($timestamp,$duree,$idPatient,$idMedecin){ + + } + + public function updateDateTime($idRDV,$dateTime){ + + } + + public function getByPatientAndDate($idPatient,$date){ + + } + +} \ No newline at end of file diff --git a/repositories/repos/StatsRepo.php b/repositories/repos/StatsRepo.php new file mode 100644 index 0000000..f7072dc --- /dev/null +++ b/repositories/repos/StatsRepo.php @@ -0,0 +1,22 @@ +connexion = StaticRepo::getConnexion(); + } + + public function getStats(){ + + } + + +} \ No newline at end of file