Merge branch 'main' into guillaume

This commit is contained in:
Yass 2026-02-11 21:03:16 +01:00 committed by GitHub
commit 483ae3c9c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 1061 additions and 388 deletions

View file

@ -3,6 +3,8 @@
require("models/user_model.php");
require("entities/user_entity.php");
require("mother_controller.php");
require("./models/project_model.php");
require("./entities/project_entity.php");
class UserCtrl extends MotherCtrl {
@ -121,7 +123,6 @@ class UserCtrl extends MotherCtrl {
// Si pas d'erreurs => insertion
if (count($arrError) === 0) {
$objUserModel = new UserModel();
$boolInsert = $objUserModel->insert($objUser);
if ($objUserModel->mailExists($objUser->getMail())) {
@ -141,6 +142,46 @@ class UserCtrl extends MotherCtrl {
}
// Affichage de la vue inscription
$this->_arrData["arrError"] = $arrError;
$this->_display("inscription");
}
/**
* le controlleur affichage de la page user
*/
public function user(){
$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
if ($intId <= 0) {
header("Location: index.php");
exit;
}
//affichage info utilisateur
$objUserModel = new UserModel;
$arrUserData = $objUserModel->findUserById($intId);
if ($arrUserData === false) {
header("Location: index.php");
exit;
}
$objUser = new User;
$objUser->hydrate($arrUserData);
//affichage projet de l'utilisateur
$objProjectModel = new ProjectModel;
$arrProjects = $objProjectModel->findAll(0,'',$intId);
$arrProjectToDisplay = array();
foreach($arrProjects as $projectData) {
$objProject = new Project();
$objProject->hydrate($projectData);
$arrProjectToDisplay[] = $objProject;
}
$this->_arrData['user'] = $objUser;
$this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay;
$this->_display("user");
}
}