Skip to content
Snippets Groups Projects
Commit cc6746d4 authored by PERRIN Antoine's avatar PERRIN Antoine
Browse files
parents 55422da2 0474fec4
No related branches found
No related tags found
No related merge requests found
......@@ -18,14 +18,16 @@ class SecurityController extends AbstractController
$user = $this->getUser();
if ($user) {
if ($user->getDateDebutSommeil()){
if (!in_array("ROLE_ADMIN",$user->getRoles()) && $user->getDateDebutSommeil()){
$dateActuelle = new \DateTime();
if ($user->getDateDebutSommeil() <= $dateActuelle && $dateActuelle <= $getDateFinSommeil()) {
$user->setSommeil(true);
}
}else{
if(!in_array("ROLE_ADMIN",$user->getRoles())){
$user->setSommeil(false);
}
}
return $this->redirectToRoute('app_home_page');
}
......
......
......@@ -67,11 +67,11 @@
<h3>Date de validité</h3>
{{ annonce.DateDebut | date('d-m-Y')}}
{% if is_granted('ROLE_ADMIN')%}
{% if is_granted('ROLE_ADMIN') and annonce.litiges|length > 0 %}
<hr>
<h3>Litiges</h3>
{% for litige in annonce.litiges %}
{{litige.descrLitige}} <bt> {{litige.getStringStatus}} {{litige.dateLitige|date('d/m/y')}}
{{litige.idUtilisateur.login}} : {{litige.descrLitige}} <bt> {{litige.getStringStatus}} {{litige.dateLitige|date('d/m/y')}}
<a href="{{ path('app_home_page', {'id': litige.id}) }}"><button class="btn-connexion2" id="btnLitige">Résoudre ce litige</button></a>
<br/>
{% endfor %}
......
......
......@@ -4,7 +4,7 @@
{% if app.user %}
<div>
{% if app.user.isSommeil() == false %}
{% if not is_granted('ROLE_ADMIN') and app.user.isSommeil() == false %}
<a href="{{ path("app_annonce_creation")}}"><button class="creation_annonce">Publier une annonce</button></a>
{% endif %}
</div>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment