From c0aab723d7b2b18de769a8587d560fcfc0c6eb93 Mon Sep 17 00:00:00 2001 From: "laura.chevillet" Date: Mon, 19 Jan 2026 14:30:27 +0100 Subject: [PATCH] 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

-
+