From a448d0e2b472216507d9f9a1432e6a166e3080e0 Mon Sep 17 00:00:00 2001 From: Guillaume HESS Date: Tue, 17 Feb 2026 16:25:33 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9bug=20et=20ajout=20de=20la=20page=20adde?= =?UTF-8?q?dit=5Fproject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/project_controller.php | 19 +++++- controllers/user_controller.php | 67 ++++++++++++------- ...263fe8f31fee7c6055e56_0.file_login.tpl.php | 10 +-- ...26123a0c3ef155eae59b_0.file_footer.tpl.php | 6 +- ...dd21546b63477a6bc296_0.file_layout.tpl.php | 10 +-- ...da665dc59ccdf89588f2_0.file_search.tpl.php | 10 +-- ...533821a89d7d735c5727_0.file_header.tpl.php | 10 +-- ...22152a4d410b20abede_0.file_preview.tpl.php | 6 +- ...f203d582a8cc367e0bd265_0.file_home.tpl.php | 66 +++++++++--------- ...6d4c74f4917d3685101_0.file_project.tpl.php | 10 +-- views/_partial/header.tpl | 2 +- views/addedit_project.tpl | 27 ++++++++ views/home.tpl | 54 +++++++-------- views/project_display.tpl | 13 ++-- 14 files changed, 186 insertions(+), 124 deletions(-) create mode 100644 views/addedit_project.tpl diff --git a/controllers/project_controller.php b/controllers/project_controller.php index 7c0bf09..6d57fd3 100644 --- a/controllers/project_controller.php +++ b/controllers/project_controller.php @@ -125,7 +125,7 @@ $_SESSION['content'] = $_POST['textProject']??""; $_SESSION['thumbnail'] = $_FILES['imageThumbnail']['name']??""; $_SESSION['status'] = 'en_attente'; - $_SESSION['user_id'] = $_SESSION['user']['user_id']; + $_SESSION['user_id'] = $_SESSION['user']['user_id']??null; $_SESSION['category']= $_POST['category']??0; $objProject = new Project(); @@ -169,6 +169,9 @@ $this->_arrData['arrImageToDiplay'] = $arrImageToDisplay; $this->_display("project"); + + header("Location: index.php"); + exit; } @@ -308,4 +311,18 @@ header("Location: index.php"); exit; } + + public function modify(){ + + //Récupéré l'id dans l'url + $intId = $_GET['id']; + + //Je créer un nouveau model pour exec la commande SQL + $objProjectModel = new ProjectModel; + $objProjectModel->modify($intId); + + //Redirection vers la page projet + header("Location: index.php?ctrl=project&action=addedit_project&id=".$intId); + exit; + } } \ No newline at end of file diff --git a/controllers/user_controller.php b/controllers/user_controller.php index 1a3b464..e2cebfa 100644 --- a/controllers/user_controller.php +++ b/controllers/user_controller.php @@ -151,37 +151,52 @@ class UserCtrl extends MotherCtrl { */ public function user(){ - $intId = isset($_GET['id']) ? (int)$_GET['id'] : 0; + $intId = isset($_GET['id']) ? (int)$_GET['id'] : 0; - if ($intId <= 0) { - header("Location: index.php"); - exit; - } + if ($intId <= 0) { + header("Location: index.php"); + exit; + } - //affichage info utilisateur - $objUserModel = new UserModel; - $arrUserData = $objUserModel->findUserById($intId); + //affichage info utilisateur + $objUserModel = new UserModel; + $arrUserData = $objUserModel->findUserById($intId); - if ($arrUserData === false) { - header("Location: index.php"); - exit; - } - $objUser = new User; - $objUser->hydrate($arrUserData); + 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); + //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; - } + $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"); + $this->_arrData['user'] = $objUser; + $this->_arrData['arrProjectToDisplay'] = $arrProjectToDisplay; + $this->_display("user"); } + + public function addedit_project(){ + + // Voir si l'utilisateur est connecté ? Retour sur l'index sinon + $intId = isset($_GET['id']) ? (int)$_GET['id'] : 0; + + if ($intId <= 0){ + header("Location: index.php"); + exit; + } + + header("Location: index.php?ctrl=project&action=addedit_project"); + exit; + } + } diff --git a/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php b/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php index c36d7b2..912788f 100644 --- a/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php +++ b/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php @@ -1,11 +1,11 @@ getCompiled()->isFresh($_smarty_tpl, array ( 'version' => '5.7.0', - 'unifunc' => 'content_6993343ab09804_38716820', + 'unifunc' => 'content_699485bdc8dc40_80399906', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_6993343ab09804_38716820 (\Smarty\Template $_smarty_tpl) { +function content_699485bdc8dc40_80399906 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\Folliow\\views'; $_smarty_tpl->getInheritance()->init($_smarty_tpl, true); ?> getInheritance()->instanceBlock($_smarty_tpl, 'Block_19316887096993343aab3467_87777428', "content"); +$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1446317869699485bdc3a914_83043646', "content"); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); } /* {block "content"} */ -class Block_19316887096993343aab3467_87777428 extends \Smarty\Runtime\Block +class Block_1446317869699485bdc3a914_83043646 extends \Smarty\Runtime\Block { public function callBlock(\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\Folliow\\views'; diff --git a/templates_c/233722999fd7fbe3307e26123a0c3ef155eae59b_0.file_footer.tpl.php b/templates_c/233722999fd7fbe3307e26123a0c3ef155eae59b_0.file_footer.tpl.php index 9ec2a97..8e726af 100644 --- a/templates_c/233722999fd7fbe3307e26123a0c3ef155eae59b_0.file_footer.tpl.php +++ b/templates_c/233722999fd7fbe3307e26123a0c3ef155eae59b_0.file_footer.tpl.php @@ -1,11 +1,11 @@ getCompiled()->isFresh($_smarty_tpl, array ( 'version' => '5.7.0', - 'unifunc' => 'content_699337446f7ad3_43163205', + 'unifunc' => 'content_699487a439efe3_65678140', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_699337446f7ad3_43163205 (\Smarty\Template $_smarty_tpl) { +function content_699487a439efe3_65678140 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\Folliow\\views\\_partial'; ?>