Débug (non finin) et début controller addedit_project

This commit is contained in:
GuillaumeH-Cci 2026-02-18 18:56:50 +01:00
parent b6ca898069
commit 747bc76de2
12 changed files with 35 additions and 18 deletions

View file

@ -120,10 +120,12 @@
$_SESSION['title'] = $_POST['titleProject']??"";
$_SESSION['description'] = $_POST['descProject']??"";
$_SESSION['content'] = $_POST['textProject']??"";
$_SESSION['category']= $_POST['category']??0;
$_SESSION['thumbnail'] = $_FILES['imageThumbnail']['name']??"";
$_SESSION['images'] = $_FILES['imageProject']['name']??"";
$_SESSION['status'] = 'en_attente';
$_SESSION['user_id'] = $_SESSION['user']['user_id']??null;
$_SESSION['category']= $_POST['category']??0;
$objProject = new Project();
@ -137,7 +139,7 @@
if (($_SESSION['thumbnail'] != null)){
$strDest = "";
if ((count($_FILES) > 0) && ($_FILES['imageProject']['error'] != 4)){
$strDest = 'uploads/projects/'.$_FILES['imageProject']['name'];
$strDest = 'uploads/projects/' . $_FILES['imageProject']['name'];
move_uploaded_file($_FILES['imageProject']['tmp_name'], $strDest);
}
}
@ -148,11 +150,13 @@
* 3. Envoie des données à la BDD
*/
if (isset($_POST['sendProject'])) {
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProject->hydrate($_SESSION);
$objProject->setThumbnail($strDest);
$objProjectModel->insert($objProject);
header("Location: index.php");
exit;
// header("Location:index.php");
// exit;
var_dump($_SESSION);
var_dump($objProject);
}
// } else if (isset($_POST['toContinue'])) {
@ -163,13 +167,10 @@
// exit;
// }
var_dump($_SESSION);
var_dump($objProject);
$this->_arrData['arrCategory'] = $arrCategory;
$this->_arrData['arrProjectToDiplay'] = $arrProjectToDisplay;
$this->_arrData['arrImageToDiplay'] = $arrImageToDisplay;
$this->_display("project"); // <A changer pour récupérer l'ancien formulaire
// $this->_display('addedit_project'); // <A changer pour récupérer le nouveau formulaire
}

View file

@ -110,7 +110,6 @@ class Project extends Entity{
$this->_content = $content;
}
/**
* Récupération de la date de création
* @param string lang de formatage de la date (par défaut = "fr_FR")

View file

@ -125,6 +125,12 @@
return $rqPrep->fetch();
}
/**
* Fonction de changement de status (accepter) d'un projet en BDD
* @author Guillaume
* @param int $id l'id du projet
* @return bool Est-ce que la requête s'est bien passée
*/
public function accept(int $id){
//SQL pour changer le status en accept
@ -136,6 +142,12 @@
return $this->_db->query($strRq);
}
/**
* Fonction de changement de status (refusé) d'un projet en BDD
* @author Guillaume
* @param int $id l'id du projet
* @return bool Est-ce que la requête s'est bien passée
*/
public function refuse(int $id){
$strRq = "UPDATE project
@ -144,7 +156,13 @@
return $this->_db->query($strRq);
}
/**
* Fonction de suppression d'un projet en BDD
* @author Guillaume
* @param int $id l'id du projet
* @return bool Est-ce que la requête s'est bien passée
*/
public function delete(int $id){
$strRq = "DELETE FROM project
@ -155,6 +173,7 @@
/**
* Fonction de mise à jour d'un projet en BDD
* @author Guillaume
* @param object $objProject L'objet utilisateur
* @return bool Est-ce que la requête s'est bien passée
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

View file

@ -7,17 +7,17 @@
<div class="mb-3">
<label class="form-label">Titre</label>
<input type="text" name="titleProject" class="form-control" required>
<input type="text" name="titleProject" class="form-control {if (isset($arrError['title'])) } is-invalid {/if} " value="{$objProject->getTitle()}" required>
</div>
<div class="mb-3">
<label class="form-label">Description (courte)</label>
<textarea name="descProject" class="form-control" rows="2"></textarea>
<textarea name="descProject" class="form-control {if (isset($arrError['descProject'])) } is-invalid {/if} " rows="2">{$objProject->getDescription()}</textarea>
</div>
<div class="mb-3">
<label class="form-label">Texte complet du Portfolio</label>
<textarea name="textProject" class="form-control" rows="5"></textarea>
<textarea name="textProject" class="form-control {if (isset($arrError['content'])) } is-invalid {/if}" rows="5">{$objProject->getContent()}</textarea>
</div>
<div class="col-6 mb-3">
@ -26,9 +26,7 @@
<select class="form-select" id="category" name="category">
<option value="0" {if $intCategory == 0}selected{/if}>Toutes les catégories</option>
{foreach $arrCategory as $arrDetCategory}
<option value="{$arrDetCategory['category_id']}"
{if $intCategory == $arrDetCategory['category_id']}selected{/if}
>
<option value="{$arrDetCategory['category_id']}" {if $intCategory == $arrDetCategory['category_id']}selected{/if}>
{$arrDetCategory['category_name']}
</option>
{/foreach}