116 lines
No EOL
4.1 KiB
PHP
116 lines
No EOL
4.1 KiB
PHP
<?php
|
|
require("../app/models/project_model.php");
|
|
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
|
|
* @author Yasser & Laura
|
|
*/
|
|
class ProjectCtrl{
|
|
|
|
/**
|
|
* Fonction d'affichage de la page d'acceuil
|
|
*/
|
|
|
|
public function home(){
|
|
|
|
$objProjectModel = new ProjectModel;
|
|
$arrProject = $objProjectModel->findAll(4);
|
|
$arrProjectToDiplay = array();
|
|
foreach($arrProject as $arrDetProject){
|
|
$objProject = new Project;
|
|
$objProject->hydrate($arrDetProject);
|
|
$arrProjectToDiplay[] = $objProject;
|
|
}
|
|
|
|
include('../app/views/partials/header.php');
|
|
include('../app/views/home.php');
|
|
include('../app/views/partials/footer.php');
|
|
|
|
}
|
|
|
|
/**
|
|
* Fonction d'affichage de la barre de recherche
|
|
*/
|
|
|
|
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 = $_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;
|
|
$arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate,
|
|
strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory);
|
|
|
|
// Initialisation d'un tableau => objets
|
|
$arrProjectToDisplay = array();
|
|
// Boucle de transformation du tableau de tableau en tableau d'objets
|
|
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;
|
|
$arrUser = $objUserModel->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 (){
|
|
|
|
$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');
|
|
|
|
}
|
|
} |