92 lines
No EOL
3.1 KiB
PHP
92 lines
No EOL
3.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");
|
|
|
|
/**
|
|
* 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);
|
|
$arrProjectToDisplay = array();
|
|
foreach($arrProject as $arrDetProject){
|
|
$objProject = new Project;
|
|
$objProject->hydrate($arrDetProject);
|
|
$arrProjectToDisplay[] = $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(){
|
|
|
|
// 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
|
|
$objProjectModel = new ProjectModel;
|
|
|
|
// Depuis PHP 8 - accès direct aux paramètres
|
|
$arrProject = $objProjectModel->findAll();
|
|
|
|
// 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 (){
|
|
include("../app/views/partials/header.php");
|
|
include('../app/views/project.php');
|
|
include('../app/views/partials/footer.php');
|
|
}
|
|
} |