Ver Fonte

Ma liste de films à voir

François há 6 anos atrás
pai
commit
583fab5bb6

+ 3 - 8
app/Resources/views/base.html.twig

@@ -18,6 +18,9 @@
 
 			<div class="collapse navbar-collapse" id="navbarsExampleDefault">
 				<ul class="navbar-nav mr-auto">
+					<li class="nav-item">
+						<a class="nav-link" href="{{ path('videothequepersonnelle_maliste') }}">Ma liste de films<span class="sr-only">(current)</span></a>
+					</li>
 					<li class="nav-item">
 						<a class="nav-link" href="{{ path('videotheque_liste') }}">Liste des films<span class="sr-only">(current)</span></a>
 					</li>
@@ -59,14 +62,6 @@
 				<h1>{% block titre %}{% endblock %}</h1>
 			</header>
 			<main role="main">
-				{#<nav class="col-md-2">
-					<ul class="nav flex-column">
-						<li class="nav-item"><a class="nav-link" href="{{  path('videotheque_liste') }}">Liste des films</a></li>
-						<li class="nav-item"><a class="nav-link" href="{{ path('realisateur_liste') }}">Liste réalisateurs</a></li>
-					</ul>
-				</nav>
-				#}
-				{#<div class="col-md-10">#}
 				<div>
 					{% for message in app.flashes('success') %}
 					<div class="alert alert-success alert-dismissible fade show" role="alert">

+ 11 - 1
src/AppBundle/Controller/VideothequePersonnelleController.php

@@ -16,6 +16,16 @@ class VideothequePersonnelleController extends Controller
      * @Route("/maliste/", name="videothequepersonnelle_maliste")
      */
 	public function maListeAction (Request $request)
+    {
+        $films = $this->getUser()->getFilms();
+
+        return $this->render('@App/videotheque/liste.html.twig', array(
+            'listeFilms'    =>  $films
+        ));
+    }
+
+
+	/*public function maListeAction (Request $request)
     {
         $resultats = array();
         $user = $this->getUser();
@@ -23,7 +33,7 @@ class VideothequePersonnelleController extends Controller
             $resultats[$key] = $this->get('serializer')->serialize($film, 'json');
         }
         return new JsonResponse($resultats);
-    }
+    }*/
 
     /**
      * @Route("/maliste/ajouter/", name="maliste_modifier")

+ 10 - 0
src/AppBundle/Repository/FilmRepository.php

@@ -19,4 +19,14 @@ class FilmRepository extends \Doctrine\ORM\EntityRepository
             ->getQuery();
         return $query->getSingleResult();
     }
+
+    public function findAllByUser(\AppBundle\Entity\User $user) {
+        $qb = $this->createQueryBuilder('f');
+        $query = $qb
+            ->select('f')
+            ->where('f.usersWantToView = :user')
+            ->setParameter('user', $user)
+            ->getQuery();
+        return $query->getResult();
+    }
 }

+ 2 - 2
src/AppBundle/Resources/views/videotheque/liste.html.twig

@@ -7,12 +7,11 @@
 	<thead class="thead-dark">
 		<tr>
 			<th>Voir</th>
+			<th>Vu</th>
 			<th>Ajouté par</th>
 			<th>Titre du film</th>
 			<th>Réalisateur</th>
 			<th>Année</th>
-			{#<th>Commentaire</th>#}
-			{#<th>Note</th>#}
 			<th>Actions</th>
 		</tr>
 	</thead>
@@ -27,6 +26,7 @@
 
                 {%  endif %}
 			</td>
+			<td></td>
 			<td>{%  if film.authered is defined %}{{ film.authered.username }}{% endif %}</td>
 			<td><a href="{{ path('videotheque_voirfilm', {'id': film.id}) }}">{{ film.titre }}</a></td>
 			<td>