From 47ee556a8cb4b281da1a26ee42f6cd58a7d11c0d Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Mon, 19 Jan 2026 11:27:18 +0100 Subject: [PATCH] =?UTF-8?q?HTML/CSS/PHP=20recherche=20par=20cat=C3=A9gorie?= =?UTF-8?q?=20ok.=20creation=20et=20update=20entit=C3=A9s,=20models=20et?= =?UTF-8?q?=20controllers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_controller.php | 26 +++++++++--- app/entities/category_entity.php | 55 ++++++++++++++++++++++++++ app/models/category_model.php | 25 ++++++++++++ app/views/search.php | 25 +++++++++++- 4 files changed, 125 insertions(+), 6 deletions(-) create mode 100644 app/entities/category_entity.php create mode 100644 app/models/category_model.php diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index 8a2e188..4f6a656 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -1,17 +1,19 @@ findAllUsers(); + + // Récupération des catégories + require_once("../app/models/category_model.php"); + $objCategoryModel = new CategoryModel; + $arrCategory = $objCategoryModel->findAllCategory(); + include('../app/views/search.php'); include('../app/views/partials/footer.php'); } + /** + * Fonction d'affichage de la page projet + */ + public function project (){ include("../app/views/partials/header.php"); - include('../app/views/project.php'); + include('../app/views/project.php'); include('../app/views/partials/footer.php'); - } } \ No newline at end of file diff --git a/app/entities/category_entity.php b/app/entities/category_entity.php new file mode 100644 index 0000000..eecebdc --- /dev/null +++ b/app/entities/category_entity.php @@ -0,0 +1,55 @@ +_prefix = 'category_'; + } + + // Méthode Getter et Setter + + /** + * Récuperation de l'id du Projet + * @return int l'id de la catégorie + */ + public function getId():int{ + return $this->_id; + } + + /** + * Mise à jour de l'id de la catégorie + * @param int le nouvelle id + */ + public function setId($id){ + $this->_id = $id; + } + + /** + * Récuperation du nom de la catégorie + * @return string nom de la catégorie + */ + public function getName(){ + return $this->_name; + } + + /** + * Mise à jour du nom de la catégorie + * @param string le nouveau nom de la catégorie + */ + public function setName($name){ + $this->_name = $name; + } + + +} \ No newline at end of file diff --git a/app/models/category_model.php b/app/models/category_model.php new file mode 100644 index 0000000..aa13516 --- /dev/null +++ b/app/models/category_model.php @@ -0,0 +1,25 @@ + 0){ + $strRq .= " LIMIT ".$intLimit; + } + + // Lancer la requête et récupérer les résultats + return $this->_db->query($strRq)->fetchAll(); + } + } \ No newline at end of file diff --git a/app/views/search.php b/app/views/search.php index b6fe7c7..c64b875 100644 --- a/app/views/search.php +++ b/app/views/search.php @@ -43,7 +43,7 @@ -
+
Type de recherche par date
@@ -74,6 +74,29 @@
+ +
+
+ Type de recherche par catégories +
+ + +
+
+