174 lines
No EOL
7.3 KiB
Smarty
174 lines
No EOL
7.3 KiB
Smarty
{extends file="views/layout.tpl"}
|
|
|
|
{block name="content"}
|
|
<main class="container mt-5 py-5">
|
|
|
|
<!-- Message après l'envoi d'email -->
|
|
{if isset($smarty.get.mail) && $smarty.get.mail === 'ok'}
|
|
<div class="alert alert-success">Email envoyé avec succès.</div>
|
|
{elseif isset($smarty.get.mail) && $smarty.get.mail === 'fail'}
|
|
<div class="alert alert-danger">Erreur lors de l'envoi de l'email.</div>
|
|
{/if}
|
|
|
|
<div class="row g-4">
|
|
|
|
<!-- Contenu principal du projet -->
|
|
<div class="col-lg-8">
|
|
|
|
<h1 class="fw-bold">{$objProject->getTitle()}</h1>
|
|
|
|
<p class="text-muted">
|
|
{$arrProject.category_name ?? 'Général'}
|
|
</p>
|
|
|
|
<div class="mb-4 shadow-sm {if !($smarty.env.IMG_PROJECT_PATH|cat:$objProject->getThumbnail())|file_exists}d-none{/if}" >
|
|
<img src="{$smarty.env.BASE_URL}/{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
|
|
class="img-fluid rounded w-100">
|
|
</div>
|
|
|
|
<div class="bg-light p-4 rounded mb-4">
|
|
<h4 class="border-bottom pb-2">Description</h4>
|
|
<p class="lead">{$objProject->getDescription()}</p>
|
|
|
|
<div class="mt-4" style="white-space: pre-wrap; overflow-wrap: break-word;">
|
|
{$objProject->getContent()}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Images du projet -->
|
|
<section id="galerie-projet">
|
|
<h2>Galerie du projet</h2>
|
|
<div class="row">
|
|
{foreach $arrImages as $image}
|
|
|
|
{* On affiche l'image si elle est approuvée OU si l'utlilisateur possède le projet OU si l'utlilisateur est Modérateur ET que l'image est disponible sur le serveur*}
|
|
{if (($image.image_status == 'approuvé') ||
|
|
(isset($smarty.session.user) && $smarty.session.user.user_status == 2) ||
|
|
(isset($smarty.session.user) && $smarty.session.user.user_id == $objProject->getUser_id())) && (($smarty.env.IMG_PROJECT_PATH|cat:$objProject->getThumbnail())|file_exists)}
|
|
|
|
<div class="col-md-4 mb-4">
|
|
<div class="card {if $image.image_status != 'approuvé'}border-warning shadow-none opacity-75{/if}">
|
|
|
|
<img src="{$smarty.env.BASE_URL}/{$smarty.env.IMG_PROJECT_PATH}{$image.image_name}" class="card-img-top" alt="{$image.image_alt}">
|
|
|
|
{* Visible uniquement par le modérateur *}
|
|
{if isset($smarty.session.user.user_status) && $smarty.session.user.user_status == 2}
|
|
<div class="moderator-tools border-top pt-2 mt-2">
|
|
<div class="d-flex gap-2">
|
|
<a href="{$smarty.env.BASE_URL}/project/change_image_status/{$image.image_id}?status=approuvé"
|
|
class="btn btn-sm btn-success">Valider</a>
|
|
|
|
<a href="{$smarty.env.BASE_URL}/project/delete_image/{$image.image_id}"
|
|
class="btn btn-sm btn-outline-danger"
|
|
onclick="return confirm('Supprimer définitivement ?')">Supprimer</a>
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
{/if}
|
|
{foreachelse}
|
|
<p>Aucune image disponible pour ce projet.</p>
|
|
{/foreach}
|
|
</div>
|
|
</section>
|
|
|
|
|
|
<!-- Formulaire qui envoie la demande au contrôleur (sendEmail) -->
|
|
<div class="card shadow-sm p-4 mb-5">
|
|
<form method="post" action="{$smarty.env.BASE_URL}/project/sendEmail">
|
|
|
|
<input type="hidden" name="project_id"
|
|
value="{$objProject->getId()}">
|
|
|
|
<input type="email" name="to_email"
|
|
class="form-control mb-3"
|
|
placeholder="Adresse email" required>
|
|
|
|
<button type="submit" class="btn btn-primary w-100">
|
|
Envoyer par email
|
|
</button>
|
|
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Sidebar : informations du créateur -->
|
|
<div class="col-lg-4">
|
|
<div class="card text-center shadow-sm p-4" {if $objProject->getCreatorName()|stripos:'minou' !== false}style=" background-color: #ff8c00 !important; /* Orange tigre */
|
|
background-image: repeating-linear-gradient(
|
|
45deg,
|
|
transparent,
|
|
transparent 30px,
|
|
rgba(0, 0, 0, 0.15) 30px,
|
|
rgba(0, 0, 0, 0.15) 60px
|
|
) !important;
|
|
border: 2px solid #000 !important;
|
|
color: #000 !important;
|
|
position: relative;
|
|
z-index: 1;"{/if}>
|
|
|
|
<a href="{$smarty.env.BASE_URL}/user/user/{$objProject->getCreatorName()}" class="text-decoration-none text-dark">
|
|
<img src="{$smarty.env.BASE_URL}/{$smarty.env.IMG_USER_PATH}{if ($smarty.env.IMG_USER_PATH|cat:($objProject->getUser_image()))|file_exists}{$objProject->getUser_image()}{else}images.jpg{/if}"
|
|
class="rounded-circle mb-3 mx-auto "
|
|
style="width:100px;height:100px;object-fit:cover;{if $objProject->getCreatorName()|stripos:'minou' !== false}
|
|
box-shadow: 0 0 0 4px #000; {/if}">
|
|
</a>
|
|
|
|
<h5 {if $objProject->getCreatorName()|stripos:'minou' !== false}style="font-weight: 800 !important;
|
|
text-transform: uppercase;
|
|
color: #000 !important;"{/if}>
|
|
{$objProject->getCreatorName()}
|
|
</h5>
|
|
|
|
<p class="text-muted small">
|
|
Publié le {$objProject->getCreation_date()}
|
|
</p>
|
|
|
|
<a href="mailto:{$arrProject['user_mail']}" class="btn btn-primary" {if $objProject->getCreatorName()|stripos:'minou' !== false}style="
|
|
background-color: #000 !important;
|
|
color: #ff8c00 !important;
|
|
border: none !important;
|
|
font-weight: bold !important;
|
|
transition: transform 0.2s;"{/if}>
|
|
Contacter le talent
|
|
</a>
|
|
|
|
{if $objProject->getCreatorName()|stripos:"minou" !== false}
|
|
<div class="small mt-2">MINOU NE MEURT JAMAIS ! 🐯</div>
|
|
{/if}
|
|
</div>
|
|
</div>
|
|
{*Controle de l'utilisateur ainsi que du status du projet + Suppression disponible pour l'utilisateur possédant le projet*}
|
|
{if isset($smarty.session.user)}
|
|
{if ($smarty.session.user.user_status == 2 || $smarty.session.user.user_id == $objProject->getUser_id())}
|
|
<div class="border rounded text-center">
|
|
<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 $smarty.session.user.user_id == $objProject->getUser_id()}
|
|
<a class="btn btn-sm m-1 btn-warning" href="{$smarty.env.BASE_URL}/project/addedit_project/{$objProject->getId()}" name="addedit">Modifier le projet</a>
|
|
{/if}
|
|
|
|
{*Conditions permettant au Modérateur de modifier le status d'un projet*}
|
|
{if $smarty.session.user.user_status == 2 && $objProject->getStatus() == "en_attente"}
|
|
<a class="btn btn-sm m-1 btn-success" href="{$smarty.env.BASE_URL}/project/accept/{$objProject->getId()}" name="toPublished">Accepter</a>
|
|
<a class="btn btn-sm m-1 btn-warning" href="{$smarty.env.BASE_URL}/project/refuse/{$objProject->getId()}" name="toRefused">Refuser</a>
|
|
</div>
|
|
{elseif $projectStatus == "refusé"}
|
|
<p class="text-danger fw-bold">Portfolio refusé</p>
|
|
{/if}
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</main>
|
|
{/block} |