diff --git a/controllers/project_controller.php b/controllers/project_controller.php index 47f9372..7c0bf09 100644 --- a/controllers/project_controller.php +++ b/controllers/project_controller.php @@ -98,6 +98,9 @@ * Fonction d'affichage de la page projet */ public function project (){ + + $objCategoryModel = new CategoryModel; + $arrCategory = $objCategoryModel->findAllCategory(); $objProjectModel = new ProjectModel; $arrProject = $objProjectModel->findAll(4); @@ -123,12 +126,12 @@ $_SESSION['thumbnail'] = $_FILES['imageThumbnail']['name']??""; $_SESSION['status'] = 'en_attente'; $_SESSION['user_id'] = $_SESSION['user']['user_id']; - + $_SESSION['category']= $_POST['category']??0; $objProject = new Project(); /** - * Créer par Besnik le GOAT et l'autre GOAT de Guillaume + * Créer par Besnik le GOAT et Guillaume * * @return bool pour savoir si le fichier existe, * puis déplace vers le fichier uploads avec les images projet des utilisateurs @@ -147,22 +150,21 @@ * 2. Hydratation avec les informations récupéré de l'utilisateur * 3. Envoie des données à la BDD */ - if (isset($_POST['sendMessage'])) { - $_SESSION['status'] = 'publié'; + if (isset($_POST['sendProject'])) { $objProject->hydrate($_SESSION); $objProject->setThumbnail($strDest); - var_dump($strDest); - var_dump($objProject); $objProjectModel->insert($objProject); } else if (isset($_POST['toContinue'])) { $objProject->hydrate($_SESSION); $objProject->setThumbnail($strDest); - $objProjectModel->insert($objProject); + //$objProjectModel->insert($objProject); } var_dump($_SESSION); var_dump($objProject); + + $this->_arrData['arrCategory'] = $arrCategory; $this->_arrData['arrProjectToDiplay'] = $arrProjectToDisplay; $this->_arrData['arrImageToDiplay'] = $arrImageToDisplay; diff --git a/models/project_model.php b/models/project_model.php index 9ca240f..7e91fb5 100644 --- a/models/project_model.php +++ b/models/project_model.php @@ -87,8 +87,8 @@ */ public function insert(object $objProject):bool{ - $strRq = "INSERT INTO project (project_title, project_description, project_thumbnail, project_content, project_status, project_creation_date) - VALUES (:title, :description, :thumbnail, :content, :status, DATE(NOW()))"; + $strRq = "INSERT INTO project (project_title, project_description, project_thumbnail, project_content, project_status, project_creation_date, project_user_id, project_category) + VALUES (:title, :description, :thumbnail, :content, :status, DATE(NOW()), :project_user_id, :project_category)"; $rqPrep = $this->_db->prepare($strRq); @@ -97,6 +97,8 @@ $rqPrep->bindValue(":thumbnail", $objProject->getThumbnail(), PDO::PARAM_STR); $rqPrep->bindValue(":content", $objProject->getContent(), PDO::PARAM_STR); $rqPrep->bindValue(":status", $objProject->getStatus(), PDO::PARAM_STR); + $rqPrep->bindValue(":project_user_id", $objProject->getUser_id(), PDO::PARAM_STR); + $rqPrep->bindValue(":project_category", $objProject->getCategory(), PDO::PARAM_STR); return $rqPrep->execute(); } diff --git a/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php b/templates_c/10875d611111c4d51c8263fe8f31fee7c6055e56_0.file_login.tpl.php index 09c194b..c36d7b2 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_698ed4e80d1241_05782427', + 'unifunc' => 'content_6993343ab09804_38716820', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_698ed4e80d1241_05782427 (\Smarty\Template $_smarty_tpl) { +function content_6993343ab09804_38716820 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\Folliow\\views'; $_smarty_tpl->getInheritance()->init($_smarty_tpl, true); ?> getInheritance()->instanceBlock($_smarty_tpl, 'Block_1501214486698ed4e807c474_40846729', "content"); +$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_19316887096993343aab3467_87777428', "content"); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); } /* {block "content"} */ -class Block_1501214486698ed4e807c474_40846729 extends \Smarty\Runtime\Block +class Block_19316887096993343aab3467_87777428 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 0cbe0cf..9ec2a97 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_698ee54027c692_47294813', + 'unifunc' => 'content_699337446f7ad3_43163205', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_698ee54027c692_47294813 (\Smarty\Template $_smarty_tpl) { +function content_699337446f7ad3_43163205 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\Folliow\\views\\_partial'; ?>