Ajustement de la partie ajout/modif/suppression des projets
This commit is contained in:
parent
80dcaee91c
commit
a846fa104f
7 changed files with 31 additions and 29 deletions
|
|
@ -216,6 +216,4 @@ class Project extends Entity{
|
|||
public function setUser_image($user_image){
|
||||
$this->_user_image = $user_image;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -140,14 +140,14 @@
|
|||
|
||||
/**
|
||||
* 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){
|
||||
|
||||
$strRq = "UPDATE project
|
||||
SET project_status= 'publié'
|
||||
SET project_status = 'publié',
|
||||
project_edit_date = NOW()
|
||||
WHERE project_id =".$id;
|
||||
|
||||
return $this->_db->query($strRq);
|
||||
|
|
@ -155,14 +155,14 @@
|
|||
|
||||
/**
|
||||
* 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
|
||||
SET project_status= 'refusé'
|
||||
SET project_status = 'refusé',
|
||||
project_edit_date = NOW()
|
||||
WHERE project_id =".$id;
|
||||
|
||||
return $this->_db->query($strRq);
|
||||
|
|
@ -170,13 +170,13 @@
|
|||
|
||||
/**
|
||||
* 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_soft_project(int $intId): bool {
|
||||
$strRq = "UPDATE project
|
||||
SET project_deleted_at = NOW()
|
||||
SET project_deleted_at = NOW(),
|
||||
project_edit_date = NOW()
|
||||
WHERE project_id = :id";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
|
@ -187,7 +187,6 @@
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
@ -197,7 +196,9 @@
|
|||
SET project_title = :title,
|
||||
project_description = :description,
|
||||
project_content = :content,
|
||||
project_thumbnail = :thumbnail
|
||||
project_thumbnail = :thumbnail,
|
||||
project_status = 'en_attente',
|
||||
project_edit_date = NOW()
|
||||
WHERE project_id = :id";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
|
@ -213,7 +214,6 @@
|
|||
|
||||
/**
|
||||
* Fonction de récupération d'image d'un projet en BDD
|
||||
* @author Guillaume
|
||||
* @param int $objProject L'Id du projet choisit
|
||||
* @return array Un tableau avec les informations de la bdd
|
||||
*/
|
||||
|
|
@ -231,7 +231,6 @@
|
|||
|
||||
/**
|
||||
* Fonction de récupération d'image d'un projet en BDD
|
||||
* @author Guillaume
|
||||
* @param int $id L'Id de l'image choisit
|
||||
* @return array Un tableau avec les informations de la bdd
|
||||
*/
|
||||
|
|
@ -244,12 +243,13 @@
|
|||
|
||||
/**
|
||||
* Fonction de modifications de status de l'image d'un projet en BDD
|
||||
* @author Guillaume
|
||||
* @param int $id L'Id de l'image choisit, string $status le status choisit
|
||||
* @return array Un tableau avec les informations de la bdd
|
||||
*/
|
||||
public function updateImageStatus(int $id, string $status): bool {
|
||||
$strRq = "UPDATE image SET image_status = :status WHERE image_id = :id";
|
||||
$strRq = "UPDATE image
|
||||
SET image_status = :status
|
||||
WHERE image_id = :id";
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
$rqPrep->bindValue(':status', $status, PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
|
|
@ -258,12 +258,12 @@
|
|||
|
||||
/**
|
||||
* Fonction de récupération d'image d'un projet en BDD
|
||||
* @author Guillaume
|
||||
* @param int $id L'Id de l'image choisit
|
||||
* @return array Un tableau avec les informations de la bdd
|
||||
*/
|
||||
public function findImage(int $id): array|bool {
|
||||
$strRq = "SELECT * FROM image WHERE image_id = :id";
|
||||
$strRq = "SELECT * FROM image
|
||||
WHERE image_id = :id";
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
$rqPrep->bindValue(':id', $id, PDO::PARAM_INT);
|
||||
$rqPrep->execute();
|
||||
|
|
@ -273,7 +273,6 @@
|
|||
|
||||
/**
|
||||
* Ajoute une image liée à un projet dans la table 'image'
|
||||
* @author Guillaume
|
||||
* @param string $fileName Nom du fichier image
|
||||
* @param int $projectId ID du projet parent
|
||||
* @param string $alt Texte alternatif
|
||||
|
|
|
|||
|
|
@ -80,13 +80,16 @@
|
|||
date('Y-m-d H:i:s', time() + (15*24*60*60))
|
||||
, PDO::PARAM_STR);
|
||||
return $rqPrep->execute();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getTokenUser(string $hash){
|
||||
$strRq = $this->_db->prepare("SELECT token_user_id FROM tokens WHERE token_hash = :hash AND token_expire_at > NOW()");
|
||||
$strRq->execute(['hash' => $hash]);
|
||||
return $strRq->fetch();
|
||||
}
|
||||
|
||||
|
||||
public function deleteToken(string $hash){
|
||||
$strRq = $this->_db->prepare("DELETE FROM tokens WHERE token_hash = :hash");
|
||||
return $strRq->execute(['hash' => $hash]);
|
||||
|
|
|
|||
BIN
uploads/projects/69a049e86a0f4.webp
Normal file
BIN
uploads/projects/69a049e86a0f4.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
BIN
uploads/projects/69a049e8834a4_gallery.webp
Normal file
BIN
uploads/projects/69a049e8834a4_gallery.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
|
|
@ -33,14 +33,14 @@
|
|||
</a>
|
||||
</p>
|
||||
<p class="small text-muted mb-0">
|
||||
<i class="bi bi-geo-alt"></i> Colmar
|
||||
<i class="bi bi-geo-alt">Colmar</i>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mt-3">
|
||||
<small class="text-muted">
|
||||
<i class="bi bi-clock"></i> <time>{$objProject->getCreation_date()}</time>
|
||||
<i class="bi bi-clock"><time>{$objProject->getCreation_date()}</time></i>
|
||||
</small>
|
||||
{if $objProject->getStatus() != "refusé"}
|
||||
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@
|
|||
<div class="row mb-2">
|
||||
|
||||
{foreach from=$arrProjectToDisplay item=objProject}
|
||||
{if $objProject->getStatus() !== "refusé"}
|
||||
{include file="views/_partial/preview.tpl"}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</section>
|
||||
{/block}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue