correction bug suppression
Some checks are pending
Deploy production (servyass) / deploy (push) Waiting to run
Some checks are pending
Deploy production (servyass) / deploy (push) Waiting to run
This commit is contained in:
parent
d2549828d0
commit
4583eac7cf
4 changed files with 27 additions and 7 deletions
|
|
@ -482,15 +482,21 @@
|
||||||
*/
|
*/
|
||||||
public function delete(){
|
public function delete(){
|
||||||
|
|
||||||
if (!isset($_SESSION['user']) || $_SESSION['user']['user_status'] != 2) {
|
$objProjectModel = new ProjectModel();
|
||||||
header('Location: '.$_ENV['BASE_URL']);
|
$intId = $_GET['id'] ?? null;
|
||||||
exit;
|
$project = $objProjectModel->findOne($intId);
|
||||||
|
if (
|
||||||
|
!isset($_SESSION['user']) ||
|
||||||
|
$_SESSION['user']['user_status'] != 2 ||
|
||||||
|
!$project ||
|
||||||
|
$project['project_creatorname'] == $_SESSION['user']['user_pseudo']
|
||||||
|
) {
|
||||||
|
header('Location: '.$_ENV['BASE_URL']);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$intId = $_GET['id'] ?? null;
|
|
||||||
|
|
||||||
if ($intId) {
|
if ($intId) {
|
||||||
$objProjectModel = new ProjectModel();
|
|
||||||
if ($objProjectModel->delete_soft_project((int) $intId)) {
|
if ($objProjectModel->delete_soft_project((int) $intId)) {
|
||||||
$_SESSION['success'] = "Le projet a été archivé avec succès.";
|
$_SESSION['success'] = "Le projet a été archivé avec succès.";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
BIN
uploads/projects/69a95f336d8be.webp
Normal file
BIN
uploads/projects/69a95f336d8be.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 124 KiB |
|
|
@ -145,7 +145,11 @@
|
||||||
{if isset($smarty.session.user)}
|
{if isset($smarty.session.user)}
|
||||||
{if ($smarty.session.user.user_status == 2 || $smarty.session.user.user_id == $objProject->getUser_id())}
|
{if ($smarty.session.user.user_status == 2 || $smarty.session.user.user_id == $objProject->getUser_id())}
|
||||||
<div class="border rounded text-center">
|
<div class="border rounded text-center">
|
||||||
<a class="btn btn-sm m-1 btn-danger" href="{$smarty.env.BASE_URL}/project/delete/{$objProject->getId()}" name="toDelete">Supprimer le projet</a>
|
<a class="btn btn-sm btn-danger flex-fill"
|
||||||
|
href="{$smarty.env.BASE_URL}/project/delete/{$objProject->getId()}"
|
||||||
|
name="toDelete"
|
||||||
|
onclick="return confirm('Attention ! Êtes-vous sûr de vouloir supprimer ce projet ? Cette action est irréversible.');">
|
||||||
|
Supprimer</a>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,17 @@
|
||||||
<div class="row m-0">
|
<div class="row m-0">
|
||||||
{if count($arrProjectToDisplay) > 0}
|
{if count($arrProjectToDisplay) > 0}
|
||||||
{foreach $arrProjectToDisplay as $objProject}
|
{foreach $arrProjectToDisplay as $objProject}
|
||||||
{include file="views/_partial/preview.tpl"}
|
{assign var="isAuthor" value=(isset($smarty.session.user) && $smarty.session.user.user_id == $objProject->getUser_id())}
|
||||||
|
{assign var="isModerator" value=(isset($smarty.session.user) && $smarty.session.user.user_status == 2)}
|
||||||
|
{assign var="isDeleted" value=($objProject->getDeleted_at() !== null)}
|
||||||
|
{assign var="isRefused" value=($objProject->getStatus() == "refusé")}
|
||||||
|
|
||||||
|
{if $isModerator
|
||||||
|
|| ($isAuthor && !$isDeleted)
|
||||||
|
|| (!$isRefused && !$isDeleted)}
|
||||||
|
|
||||||
|
{include file="views/_partial/preview.tpl"}
|
||||||
|
{/if}
|
||||||
{/foreach}
|
{/foreach}
|
||||||
{else}
|
{else}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue