From 42c1f06acf58c573f89267c099d8f359d480a16d Mon Sep 17 00:00:00 2001
From: clement <clemmercier45@gmail.com>
Date: Tue, 17 Jun 2014 16:19:33 +0200
Subject: [PATCH] list views for all

---
 class/animal.php      | 11 +++++++++++
 controller/animal.php | 31 +++++++++++++++++++++++++++++++
 controller/fact.php   | 31 +++++++++++++++++++++++++++++++
 controller/ord.php    | 31 +++++++++++++++++++++++++++++++
 controller/rdv.php    | 31 +++++++++++++++++++++++++++++++
 controller/stats.php  | 37 +++++++++++++++++++++++++++++++++++++
 6 files changed, 172 insertions(+)
 create mode 100644 controller/animal.php
 create mode 100644 controller/fact.php
 create mode 100644 controller/ord.php
 create mode 100644 controller/rdv.php
 create mode 100644 controller/stats.php

diff --git a/class/animal.php b/class/animal.php
index 532e31f..fe79944 100644
--- a/class/animal.php
+++ b/class/animal.php
@@ -2,6 +2,7 @@
 
 class Animal extends Objet
 {
+    private $id;
     private $nom;
     private $proprio;
     private $race;
@@ -13,6 +14,16 @@ class Animal extends Objet
     private $taille;
     private $code;
 
+    public function id()
+    {
+        return $this->id;
+    }
+    
+    public function setId($id)
+    {
+        $this->id = $id;
+    }
+
     public function nom()
     {
         return $this->nom;
diff --git a/controller/animal.php b/controller/animal.php
new file mode 100644
index 0000000..98300ab
--- /dev/null
+++ b/controller/animal.php
@@ -0,0 +1,31 @@
+<?php
+/*
+	Controller animal, handle CRUD for animal.
+*/
+
+// Implemented actions
+$actions = array("listeAnimal", "addAnimal", "editAnimal");
+
+// Check action is correct
+if(!in_array($action, $actions)) {
+	$action = "listeAnimal";
+}
+
+switch($action) {
+	case "listeAnimal":
+		$listArray = Animal::getAll();
+		$listParams = array("title" => "Liste des animaux de la clinique",
+							"keys" => array("nom", "proprio", "race", "poids", "genre", "sterile", "date de naissance", "date de décès", "taille", "code d'identification"));
+		include 'view/list.php';
+		break;
+	case "addAnimal":
+
+		break;
+	case "editAnimal":
+
+		break;
+	default:
+		include 'view/404.php';
+		break;
+}
+
diff --git a/controller/fact.php b/controller/fact.php
new file mode 100644
index 0000000..15ef8b2
--- /dev/null
+++ b/controller/fact.php
@@ -0,0 +1,31 @@
+<?php
+/*
+	Controller Facture, handle CRUD for factures.
+*/
+
+// Implemented actions
+$actions = array("listeFact", "addFact", "editFact");
+
+// Check action is correct
+if(!in_array($action, $actions)) {
+	$action = "listeFact";
+}
+
+switch($action) {
+	case "listeFact":
+		$listArray = Employe::getAll();
+		$listParams = array("title" => "Liste des factures",
+							"keys" => array("id", "employe", "animal", "date_edition", "date_paiement", "moyen_paiement", "prix_total"));
+		include 'view/list.php';
+		break;
+	case "addFact":
+
+		break;
+	case "editFact":
+
+		break;
+	default:
+		include 'view/404.php';
+		break;
+}
+
diff --git a/controller/ord.php b/controller/ord.php
new file mode 100644
index 0000000..2093337
--- /dev/null
+++ b/controller/ord.php
@@ -0,0 +1,31 @@
+<?php
+/*
+	Controller Ordonnance, handle CRUD for ordonnances.
+*/
+
+// Implemented actions
+$actions = array("listeOrd", "addOrd", "editOrd");
+
+// Check action is correct
+if(!in_array($action, $actions)) {
+	$action = "listeOrd";
+}
+
+switch($action) {
+	case "listeOrd":
+		$listArray = Employe::getAll();
+		$listParams = array("title" => "Liste des ordonnances",
+							"keys" => array("id", "animal", "veterinaire", "date", "prix"));
+		include 'view/list.php';
+		break;
+	case "addOrd":
+
+		break;
+	case "editOrd":
+
+		break;
+	default:
+		include 'view/404.php';
+		break;
+}
+
diff --git a/controller/rdv.php b/controller/rdv.php
new file mode 100644
index 0000000..0fff0e9
--- /dev/null
+++ b/controller/rdv.php
@@ -0,0 +1,31 @@
+<?php
+/*
+	Controller Rdv, handle CRUD for meeting.
+*/
+
+// Implemented actions
+$actions = array("listeRdv", "addRdv", "editRdv");
+
+// Check action is correct
+if(!in_array($action, $actions)) {
+	$action = "listeRdv";
+}
+
+switch($action) {
+	case "listeRdv":
+		$listArray = Employe::getAll();
+		$listParams = array("title" => "Liste des rendez-vous",
+							"keys" => array("id", "animal", "veterinaire", "date", "duree"));
+		include 'view/list.php';
+		break;
+	case "addPersonnel":
+
+		break;
+	case "addClient":
+
+		break;
+	default:
+		include 'view/404.php';
+		break;
+}
+
diff --git a/controller/stats.php b/controller/stats.php
new file mode 100644
index 0000000..168efd2
--- /dev/null
+++ b/controller/stats.php
@@ -0,0 +1,37 @@
+<?php
+/*
+	Controller personne, handle CRUD for personnel and client.
+*/
+
+// Implemented actions
+$actions = array("listePersonnel", "listeClient", "addPersonnel", "addClient", "editPersonnel", "editClient");
+
+// Check action is correct
+if(!in_array($action, $actions)) {
+	$action = "listePersonnel";
+}
+
+switch($action) {
+	case "listePersonnel":
+		$listArray = Employe::getAll();
+		$listParams = array("title" => "Liste du personnel",
+							"keys" => array("id", "nom", "prenom", "isVeterinaire", "idNational"));
+		include 'view/list.php';
+		break;
+	case "listeClient":
+		$listArray = Client::getAll();
+		$listParams = array("title" => "Liste des clients",
+							"keys" => array("id", "nom", "prenom", "numTel"));
+		include 'view/list.php';
+		break;
+	case "addPersonnel":
+
+		break;
+	case "addClient":
+
+		break;
+	default:
+		include 'view/404.php';
+		break;
+}
+
-- 
GitLab