Jelajahi Sumber

On ouvre la liste des films au public

François 5 tahun lalu
induk
melakukan
3e09578bc0

+ 1 - 1
config/packages/security.yaml

@@ -42,7 +42,7 @@ security:
     # Easy way to control access for large sections of your site
     # Note: Only the *first* access control that matches will be used
     access_control:
-        - { path: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|fichefilm/) , roles: IS_AUTHENTICATED_ANONYMOUSLY }
+        - { path: ^/(login$|register$|motdepasseoublie$|resetpassword/token=|activate/token=|fichefilm/|$|liste-by/|liste-by_real/|recherche) , roles: IS_AUTHENTICATED_ANONYMOUSLY }
         - { path: ^/admin, roles: ROLE_ADMIN }
         - { path: ^/genre, roles: ROLE_MODERATEUR }
         - { path: ^/, roles: IS_AUTHENTICATED_REMEMBERED }

+ 1 - 1
src/Controller/VideothequeController.php

@@ -28,7 +28,7 @@ class VideothequeController extends AbstractController
 		return $this->render('videotheque/liste.html.twig', array(
 			'listeFilms'	=>	$listeFilms
 		));
-	}
+    }
 
     /**
      * @Route("/liste-by/{id}", name="videotheque_listepargenre")

+ 10 - 2
templates/base.html.twig

@@ -14,6 +14,14 @@
 				<span class="navbar-toggler-icon"></span>
 			</button>
 			<div class="collapse navbar-collapse" id="navbarsExampleDefault">
+				{% if not is_granted('IS_AUTHENTICATED_REMEMBERED') %}
+					<ul class="navbar-nav mr-auto">
+						<li class="nav-item
+						{% if app.request.attributes.get('_route') == 'videotheque_liste' %}active{% endif %}">
+							<a class="nav-link" href="{{ path('videotheque_liste') }}">Liste des films<span class="sr-only">(current)</span></a>
+						</li>
+					</ul>
+				{% endif %}
                 {%  if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
 				<ul class="navbar-nav mr-auto">
 					<li class="nav-item
@@ -52,12 +60,12 @@
 					<li>
 				</ul>
 				
-				{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
+				{#{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}#}
 				<form class="form-inline my-2 my-lg-0" action="{{ path('search_recherche') }}">
 					<input class="form-control mr-sm-2" name="q" type="text" placeholder="Rechercher" aria-label="Rechercher">
 					<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Go</button>
 				</form>
-				{% endif %}
+				{#{% endif %}#}
                 {%  if not is_granted('IS_AUTHENTICATED_REMEMBERED') %}
 					<ul class="navbar-nav">
 						<li class="nav-item"><a class="nav-link" href="{{ path('app_login') }}">Se connecter</a></li>

+ 49 - 44
templates/videotheque/liste.html.twig

@@ -9,15 +9,18 @@
 {% endblock %}
 
 {% block body %}
+	{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
 	<p><a class="btn btn-primary" role="button" href="{{ path('videotheque_ajouter') }}"><i class="fa fa-plus-square fa-lg"></i> Ajouter un film</a></p>
-
+	{% endif %}
 	<div class="table-responsive">
 		<table class="table table-bordered table-hover table-sm">
 			<thead class="thead-dark">
 				<tr>
-					<th>Voir</th>
-					<th>Vu</th>
-					<th>Ajouté par</th>
+					{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
+						<th>Voir</th>
+						<th>Vu</th>
+						<th>Ajouté par</th>
+					{% endif %}
 					<th>Titre du film</th>
 					<th>Genre</th>
 					<th>Réalisateur</th>
@@ -32,48 +35,50 @@
 			<tbody>
 				{% for film in listeFilms %}
 				<tr>
-					<td>
-						{%  if app.user.wantToSee(film) %}
-							{% set follow_icone = "fa fa-star fa-lg" %}
-							{% set follow_texte = "Supprimer ce film de votre liste à voir" %}
-						{% else %}
-							{% set follow_icone = "fa fa-star-o fa-lg" %}
-							{% set follow_texte = "Ajouter ce film à votre liste à voir" %}
-						{% endif %}
-						<a href="#" data-fonction="switch"
-									data-icone-actif="fa fa-star fa-lg"
-									data-icone-inactif="fa fa-star-o fa-lg"
-									data-path="{{ path('maliste_modifier_a_voir') }}"
-									data-toggle="tooltip"
-									title="{{ follow_texte }}"
-									data-content="{{ film.id }}">
-							<i class="{{ follow_icone }}"></i>
-						</a>
-					</td>
-					<td>
-						{%  if app.user.haveSeen(film) %}
-							{% set vu_icone = '<i class="fa fa-eye fa-lg text-success"></i>' %}
-						{% else %}
-							{% set vu_icone = '<i class="fa fa-eye-slash fa-lg text-secondary"></i>' %}
-						{% endif %}				
-						<a href="#" data-fonction="switch"
-									data-path="{{ path('maliste_modifier_vus') }}"
-									data-content="{{ film.id }}"
-									data-icone-actif = "fa fa-eye fa-lg text-success"
-									data-icone-inactif = "fa fa-eye-slash fa-lg text-secondary">
-							{{ vu_icone | raw }}
-						</a>
-					</td>
-					<td>
-						{%  if film.authered is defined %}
-							{% if film.authered.activeNow %}
-								<i class="fa fa-user text-success"></i>
+					{% if is_granted('IS_AUTHENTICATED_REMEMBERED') %}
+						<td>
+							{%  if app.user.wantToSee(film) %}
+								{% set follow_icone = "fa fa-star fa-lg" %}
+								{% set follow_texte = "Supprimer ce film de votre liste à voir" %}
 							{% else %}
-								<i class="fa fa-user-o text-secondary"></i>
+								{% set follow_icone = "fa fa-star-o fa-lg" %}
+								{% set follow_texte = "Ajouter ce film à votre liste à voir" %}
 							{% endif %}
-							{{ film.authered.username }}
-						{% endif %}
-					</td>
+							<a href="#" data-fonction="switch"
+										data-icone-actif="fa fa-star fa-lg"
+										data-icone-inactif="fa fa-star-o fa-lg"
+										data-path="{{ path('maliste_modifier_a_voir') }}"
+										data-toggle="tooltip"
+										title="{{ follow_texte }}"
+										data-content="{{ film.id }}">
+								<i class="{{ follow_icone }}"></i>
+							</a>
+						</td>
+						<td>
+							{%  if app.user.haveSeen(film) %}
+								{% set vu_icone = '<i class="fa fa-eye fa-lg text-success"></i>' %}
+							{% else %}
+								{% set vu_icone = '<i class="fa fa-eye-slash fa-lg text-secondary"></i>' %}
+							{% endif %}				
+							<a href="#" data-fonction="switch"
+										data-path="{{ path('maliste_modifier_vus') }}"
+										data-content="{{ film.id }}"
+										data-icone-actif = "fa fa-eye fa-lg text-success"
+										data-icone-inactif = "fa fa-eye-slash fa-lg text-secondary">
+								{{ vu_icone | raw }}
+							</a>
+						</td>
+						<td>
+							{%  if film.authered is defined %}
+								{% if film.authered.activeNow %}
+									<i class="fa fa-user text-success"></i>
+								{% else %}
+									<i class="fa fa-user-o text-secondary"></i>
+								{% endif %}
+								{{ film.authered.username }}
+							{% endif %}
+						</td>
+					{% endif %}
 					<td>
 						<a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{ film.titre }}</a>
 						{% if film.new %}<span class="badge badge-light">New</span>{% endif %}