diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index 4f6a656..b8cf009 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 @@ -37,23 +39,24 @@ public function search(){ + //variable pour faire fonctionner le script en footer + $strPage = "search"; + // inclusion du header 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; - - // Récupération des Projects + $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; - - // 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(); @@ -61,10 +64,9 @@ foreach($arrProject as $arrDetProject){ $objProject = new Project; $objProject->hydrate($arrDetProject); - $arrProjectToDisplay[] = $objProject; } - + // Récupération des utilisateurs require_once("../app/models/user_model.php"); $objUserModel = new UserModel; @@ -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/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 .= " 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/models/project_model.php b/app/models/project_model.php index 85742ae..6b1fecb 100644 --- a/app/models/project_model.php +++ b/app/models/project_model.php @@ -1,9 +1,16 @@ 0){ + $strRq .= $strWhere." user_id = ".$intAuthor; + $strWhere = " AND "; + } + + // Recherche par catégorie + if ($intCategory > 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; } // 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 1d2a71c..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/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

-
+
+ 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; +}