From c0aab723d7b2b18de769a8587d560fcfc0c6eb93 Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Mon, 19 Jan 2026 14:30:27 +0100 Subject: [PATCH 1/6] creaction entite & model image. Finalisation page projet --- app/controllers/project_controller.php | 23 +++++++ app/entities/category_entity.php | 4 +- app/entities/image_entity.php | 90 ++++++++++++++++++++++++++ app/entities/mother_entity.php | 2 +- app/models/image_model.php | 25 +++++++ app/views/project.php | 24 +++---- 6 files changed, 154 insertions(+), 14 deletions(-) create mode 100644 app/entities/image_entity.php create mode 100644 app/models/image_model.php diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index 4f6a656..497401b 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -3,6 +3,8 @@ require("../app/entities/project_entity.php"); require("../app/models/category_model.php"); require("../app/entities/category_entity.php"); + require("../app/models/image_model.php"); + require("../app/entities/image_entity.php"); /** * Le controler des Project @@ -84,9 +86,30 @@ * Fonction d'affichage de la page projet */ + public function project (){ + + $objProjectModel = new ProjectModel; + $arrProject = $objProjectModel->findAll(4); + $arrProjectToDiplay = array(); + foreach($arrProject as $arrDetProject){ + $objProject = new Project; + $objProject->hydrate($arrDetProject); + $arrProjectToDiplay[] = $objProject; + } + + $objImageModel = new ImageModel; + $arrImage = $objImageModel->findAllImage(4); + $arrImageToDiplay = array(); + foreach($arrImage as $arrDetImage){ + $objImage = new Image; + $objImage->hydrate($arrDetImage); + $arrImageToDiplay[] = $objImage; + } + include("../app/views/partials/header.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 index eecebdc..72ac739 100644 --- a/app/entities/category_entity.php +++ b/app/entities/category_entity.php @@ -1,5 +1,7 @@ _prefix = 'image_'; + } + + // Méthode Getter et Setter + + /** + * Récuperation de l'id de l'image + * @return int l'id de l'image + */ + public function getId():int{ + return $this->_id; + } + + /** + * Mise à jour de l'id de l'image + * @param int le nouvelle id + */ + public function setId($id){ + $this->_id = $id; + } + + /** + * Récuperation du nom de l'image + * @return string nom de l'image + */ + public function getName(){ + return $this->_name; + } + + /** + * Mise à jour du nom de l'image + * @param string le nouveau nom de l'image + */ + public function setName($name){ + $this->_name = $name; + } + + /** + * Récuperation de l'alt + * @return string contenu de l'alt + */ + public function getAlt(){ + return $this->_alt; + } + + /** + * Mise à jour de l'alt + * @param string le nouveau contenu de l'alt + */ + public function setAlt($alt){ + $this->_alt = $alt; + } + + /** + * Récuperation du statut de la photo + * @return string du statut + */ + public function getStatus(){ + return $this->_status; + } + + /** + * Mise à jour du statut de la photo + * @param string le nouveau statut de la photo + */ + public function setStatus($status){ + $this->_status = $status; + } + + } \ No newline at end of file diff --git a/app/entities/mother_entity.php b/app/entities/mother_entity.php index c564be4..992fb89 100644 --- a/app/entities/mother_entity.php +++ b/app/entities/mother_entity.php @@ -2,7 +2,7 @@ /** * Classe d'un Mere de tout objet - * @author Yass + * @author Yass & Laura */ class Entity{ diff --git a/app/models/image_model.php b/app/models/image_model.php new file mode 100644 index 0000000..9515ecd --- /dev/null +++ b/app/models/image_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/project.php b/app/views/project.php index f5356bd..6552ae4 100644 --- a/app/views/project.php +++ b/app/views/project.php @@ -1,24 +1,24 @@ -
-
-

Alimenter votre projet

- -
+
+

Alimenter votre projet

+
+ +
-

Description

+

Description

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

-
-

Photos behind the scene

-
- +
+

Photos behind the scene

+
+ <?php echo $objImage->getAlt(); ?>
-
+

Other projects

-
+
Date: Mon, 19 Jan 2026 15:46:30 +0100 Subject: [PATCH 2/6] =?UTF-8?q?maj=20models,=20entit=C3=A9=20et=20page=20r?= =?UTF-8?q?echerche,=20d=C3=A9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_controller.php | 12 +++--- app/models/category_model.php | 8 ++-- app/models/image_model.php | 2 +- app/models/project_model.php | 54 +++++++++++++++++++++++++- 4 files changed, 64 insertions(+), 12 deletions(-) diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index 497401b..3bb4a79 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -51,11 +51,10 @@ $strEndDate = $_GET['enddate']??''; $intCategory = $_GET['category']??0; - // Récupération des Projects + // Récupération des projetc $objProjectModel = new ProjectModel; - - // Depuis PHP 8 - accès direct aux paramètres - $arrProject = $objProjectModel->findAll(); + $arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate, + strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory); // Initialisation d'un tableau => objets $arrProjectToDisplay = array(); @@ -63,10 +62,11 @@ foreach($arrProject as $arrDetProject){ $objProject = new Project; $objProject->hydrate($arrDetProject); - $arrProjectToDisplay[] = $objProject; } - + + var_dump($arrProjectToDisplay); + // Récupération des utilisateurs require_once("../app/models/user_model.php"); $objUserModel = new UserModel; diff --git a/app/models/category_model.php b/app/models/category_model.php index aa13516..4aa3e6c 100644 --- a/app/models/category_model.php +++ b/app/models/category_model.php @@ -1,10 +1,10 @@ 0){ + $strRq .= $strWhere." project_creatorname = ".$intAuthor; + $strWhere = " AND "; + } + + // Recherche par catégorie + if ($intAuthor > 0){ + $strRq .= $strWhere." project_category = ".$intCategory; + $strWhere = " AND "; + } + + // Recherche par dates + if ($intPeriod == 0){ + // Par date exacte + if ($strDate != ''){ + $strRq .= $strWhere." project_creation_date = '".$strDate."'"; + } + }else{ + // Par période de dates + if ($strStartDate != '' && $strEndDate != ''){ + $strRq .= $strWhere." project_creation_date BETWEEN '".$strStartDate."' AND '".$strEndDate."'"; + }else{ + if ($strStartDate != ''){ + // A partir de + $strRq .= $strWhere." project_creation_date >= '".$strStartDate."'"; + }else if ($strEndDate != ''){ + // Avant le + $strRq .= $strWhere." project_creation_date <= '".$strEndDate."'"; + } + } + } + + $strRq .= " ORDER BY project_creation_date DESC"; + + if ($intLimit > 0){ $strRq .= " LIMIT ".$intLimit; } From c5f3ef2d0f8b6ae34e72042bf0ef112e86ab6108 Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Mon, 19 Jan 2026 16:25:37 +0100 Subject: [PATCH 3/6] =?UTF-8?q?d=C3=A9but=20correction=20du=20bug=20de=20r?= =?UTF-8?q?echerche=20et=20en=20vrai=20j'ai=20corrig=C3=A9=20pas=20mal=20d?= =?UTF-8?q?e=20trucs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_controller.php | 14 +++++++------- app/models/project_model.php | 2 +- app/views/search.php | 3 +-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index 3bb4a79..cde267c 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -43,13 +43,13 @@ include('../app/views/partials/header.php'); //Récupérer les informations du Formulaire - $strKeywords = $_GET['keywords']??''; - $intAuthor = $_GET['author']??0; - $intPeriod = $_GET['period']??0; - $strDate = $_GET['date']??''; - $strStartDate = $_GET['startdate']??''; - $strEndDate = $_GET['enddate']??''; - $intCategory = $_GET['category']??0; + $strKeywords = $_POST['keywords']??''; + $intAuthor = $_POST['author']??0; + $intPeriod = $_POST['period']??0; + $strDate = $_POST['date']??''; + $strStartDate = $_POST['startdate']??''; + $strEndDate = $_POST['enddate']??''; + $intCategory = $_POST['category']??0; // Récupération des projetc $objProjectModel = new ProjectModel; diff --git a/app/models/project_model.php b/app/models/project_model.php index f55917d..aaaea21 100644 --- a/app/models/project_model.php +++ b/app/models/project_model.php @@ -31,7 +31,7 @@ // Recherche par auteur if ($intAuthor > 0){ - $strRq .= $strWhere." project_creatorname = ".$intAuthor; + $strRq .= $strWhere." project_user = ".$intAuthor; $strWhere = " AND "; } diff --git a/app/views/search.php b/app/views/search.php index c64b875..a1e5b9c 100644 --- a/app/views/search.php +++ b/app/views/search.php @@ -86,8 +86,7 @@ foreach($arrCategory as $arrDetCategory){ ?> Date: Tue, 20 Jan 2026 09:14:29 +0100 Subject: [PATCH 4/6] =?UTF-8?q?d=C3=A9bugage=20barre=20de=20recherche=20to?= =?UTF-8?q?ut=20sauf=20auteur.=20Maj=20balise=20script=20en=20footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/project_controller.php | 5 +++-- app/models/project_model.php | 2 +- app/views/partials/footer.php | 27 ++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index cde267c..a752af9 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -39,6 +39,9 @@ public function search(){ + //variable pour faire fonctionner le script en footer + $strPage = "search"; + // inclusion du header include('../app/views/partials/header.php'); @@ -65,8 +68,6 @@ $arrProjectToDisplay[] = $objProject; } - var_dump($arrProjectToDisplay); - // Récupération des utilisateurs require_once("../app/models/user_model.php"); $objUserModel = new UserModel; diff --git a/app/models/project_model.php b/app/models/project_model.php index aaaea21..b342121 100644 --- a/app/models/project_model.php +++ b/app/models/project_model.php @@ -31,7 +31,7 @@ // Recherche par auteur if ($intAuthor > 0){ - $strRq .= $strWhere." project_user = ".$intAuthor; + $strRq .= $strWhere." user_id = ".$intAuthor; $strWhere = " AND "; } diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php index 1d2a71c..7aca433 100644 --- a/app/views/partials/footer.php +++ b/app/views/partials/footer.php @@ -1,5 +1,32 @@

coucou c'est le footer

+ + + \ No newline at end of file From e15003fc5c46a05c963507aaec936bdbcf13451f Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Wed, 21 Jan 2026 16:17:57 +0100 Subject: [PATCH 5/6] Bug recherche auteur ok --- app/controllers/project_controller.php | 1 - app/entities/image_entity.php | 9 ++++---- app/models/project_model.php | 3 ++- app/views/partials/footer.php | 29 +------------------------- app/views/search.php | 25 ++++++++++++++++++++++ 5 files changed, 33 insertions(+), 34 deletions(-) diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index a752af9..b8cf009 100644 --- a/app/controllers/project_controller.php +++ b/app/controllers/project_controller.php @@ -53,7 +53,6 @@ $strStartDate = $_POST['startdate']??''; $strEndDate = $_POST['enddate']??''; $intCategory = $_POST['category']??0; - // Récupération des projetc $objProjectModel = new ProjectModel; $arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate, diff --git a/app/entities/image_entity.php b/app/entities/image_entity.php index cf43548..b919d67 100644 --- a/app/entities/image_entity.php +++ b/app/entities/image_entity.php @@ -9,10 +9,11 @@ require_once("mother_entity.php"); class Image extends Entity{ - private int $_id; - protected string $_name = ''; - protected string $_alt = ''; - protected string $_status =''; + private int $_id; + private string $_name = ''; + private string $_alt = ''; + private string $_status =''; + private int $_project = 0; diff --git a/app/models/project_model.php b/app/models/project_model.php index b342121..6b1fecb 100644 --- a/app/models/project_model.php +++ b/app/models/project_model.php @@ -36,7 +36,7 @@ } // Recherche par catégorie - if ($intAuthor > 0){ + if ($intCategory > 0){ $strRq .= $strWhere." project_category = ".$intCategory; $strWhere = " AND "; } @@ -70,6 +70,7 @@ } // Lancer la requête et récupérer les résultats + var_dump($strRq); return $this->_db->query($strRq)->fetchAll(); } } \ No newline at end of file diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php index 7aca433..0310f3f 100644 --- a/app/views/partials/footer.php +++ b/app/views/partials/footer.php @@ -1,32 +1,5 @@

coucou c'est le footer

- - - - + \ No newline at end of file diff --git a/app/views/search.php b/app/views/search.php index a1e5b9c..a6b8e02 100644 --- a/app/views/search.php +++ b/app/views/search.php @@ -167,3 +167,28 @@
+ From 16289a1c155dd182a159d41899f1e383c58aa68b Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Fri, 23 Jan 2026 09:20:05 +0100 Subject: [PATCH 6/6] =?UTF-8?q?D=C3=A9but=20mise=20en=20page=20footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/partials/footer.php | 31 +++++++++++++++++++++++++++++-- public/assests/css/style.css | 14 ++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php index 0310f3f..c380f5b 100644 --- a/app/views/partials/footer.php +++ b/app/views/partials/footer.php @@ -1,5 +1,32 @@ -

coucou c'est le footer

- + \ No newline at end of file diff --git a/public/assests/css/style.css b/public/assests/css/style.css index 74cb2d6..c1209cd 100644 --- a/public/assests/css/style.css +++ b/public/assests/css/style.css @@ -96,3 +96,17 @@ body { height: 20%; padding: 0.75rem; } + +.footer{ + color: white; + background-color: #0000ff; +} + +.footer ul{ + list-style: none; +} + +.footer a{ + text-decoration: none; + color: white; +}