Merge branch 'main' into besnik

This commit is contained in:
Yass 2026-01-23 11:53:49 +01:00 committed by GitHub
commit c1c3a75aa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 1661 additions and 7 deletions

View file

@ -0,0 +1,115 @@
<?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');
}
}

View file

@ -32,18 +32,11 @@ class UserCtrl{
$arrError[] = "Mail ou mot de passe invalide";
}else{
// Ajoute l'utilisateur en session
/*$_SESSION['firstname'] = $arrResult['user_firstname'];
$_SESSION['name'] = $arrResult['user_name'];
$_SESSION['id'] = $arrResult['user_id'];*/
// j'enlève le mot de passe avant la session
//unset($arrResult['user_pwd']);
$_SESSION['user'] = $arrResult;
$_SESSION['success'] = "Bienvenue, vous êtes bien connecté";
header("Location:index.php");
exit;
//var_dump($_SESSION);
//var_dump("Connecté");
}
}
}