header got favs and logout
This commit is contained in:
parent
d557c7e353
commit
c5c57796a4
@ -8,14 +8,14 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use App\Entity\Album;
|
use App\Entity\Album;
|
||||||
Use App\Utils;
|
use App\Utils;
|
||||||
|
|
||||||
#[Route('/favorite')]
|
#[Route('/favorite')]
|
||||||
class FavoriteController extends AbstractController
|
class FavoriteController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
#[Route('/remove/{album_id}', name: 'app_remove_favorite')]
|
#[Route('/remove/{album_id}', name: 'app_remove_favorite')]
|
||||||
public function removeFromFavorites(int $album_id ): Response
|
public function removeFromFavorites(int $album_id): Response
|
||||||
{
|
{
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
$album = $entityManager->getRepository(Album::class)->findBy(
|
$album = $entityManager->getRepository(Album::class)->findBy(
|
||||||
@ -35,7 +35,7 @@ class FavoriteController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/add/{album_id}', name: 'app_add_favorite')]
|
#[Route('/add/{album_id}', name: 'app_add_favorite')]
|
||||||
public function addToFavorites(int $album_id ,Request $request, EntityManagerInterface $entityManager): Response
|
public function addToFavorites(int $album_id, Request $request, EntityManagerInterface $entityManager): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
@ -54,18 +54,18 @@ class FavoriteController extends AbstractController
|
|||||||
return new Response("ca a marche");
|
return new Response("ca a marche");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/', name: 'app_favorites')]
|
#[Route('/', name: 'app_favorite')]
|
||||||
public function index(Request $request): Response
|
public function index(Request $request): Response
|
||||||
{
|
{
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
|
|
||||||
$all_liked = array();
|
$all_liked = array();
|
||||||
foreach($user->getLiked() as $liked){
|
foreach ($user->getLiked() as $liked) {
|
||||||
$release = Utils::makeRequest("GET", "/releases/".strval($liked->getAlbumId()), []);
|
$release = Utils::makeRequest("GET", "/releases/" . strval($liked->getAlbumId()), []);
|
||||||
$release = array_merge(
|
$release = array_merge(
|
||||||
$release,
|
$release,
|
||||||
["fruit" => $liked->getFruits()]
|
["fruit" => $liked->getFruits()]
|
||||||
);
|
);
|
||||||
array_push(
|
array_push(
|
||||||
$all_liked,
|
$all_liked,
|
||||||
$release,
|
$release,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@ -41,16 +41,19 @@
|
|||||||
<img src="{{ asset('/styles/search.svg') }}" alt="Search" />
|
<img src="{{ asset('/styles/search.svg') }}" alt="Search" />
|
||||||
</label>
|
</label>
|
||||||
</form>
|
</form>
|
||||||
|
{% if app.user %}
|
||||||
|
<div>
|
||||||
|
<a class="no-style" href="{{url('app_favorite')}}">Favorites</a>
|
||||||
|
<a class="no-style" href="{{url('app_logout')}}">Logout</a>
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
<div>
|
<div>
|
||||||
<a class="no-style" href="{{url('app_register')}}">Register</a>
|
<a class="no-style" href="{{url('app_register')}}">Register</a>
|
||||||
<a class="no-style" href="{{url('app_login')}}">Login</a>
|
<a class="no-style" href="{{url('app_login')}}">Login</a>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif%}
|
||||||
</header>
|
</header>
|
||||||
{% endblock %}
|
{% endblock %} {% block body %}{% endblock %} {% block footer %}
|
||||||
|
|
||||||
{% block body %}{% endblock %}
|
|
||||||
|
|
||||||
{% block footer %}
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>Done by: Capelier 🏳️⚧️ — Rubini 💅 — Simaila 🤓 — V????? 🛠️</p>
|
<p>Done by: Capelier 🏳️⚧️ — Rubini 💅 — Simaila 🤓 — V????? 🛠️</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
Loading…
Reference in New Issue
Block a user