parent
09f7c0c0ca
commit
0df7d9de8e
@ -1,23 +1,29 @@
|
||||
<?php
|
||||
namespace Controleur;
|
||||
|
||||
Class UserControler{
|
||||
use Gateway\QuoteGateway;
|
||||
|
||||
class UserControler {
|
||||
|
||||
private QuoteGateway $quoteGateway;
|
||||
|
||||
public function __construct() {
|
||||
global $co;
|
||||
$this->quoteGateway = new QuoteGateway($co);
|
||||
}
|
||||
|
||||
public function quiz() {
|
||||
global $vues;
|
||||
require_once $vues['quiz'];
|
||||
}
|
||||
|
||||
public function favorits() {
|
||||
public function favorite(array $args) {
|
||||
global $vues;
|
||||
|
||||
$user = $_SESSION['username'];
|
||||
|
||||
$idUser = $this->userGateway->getIdUser($user);
|
||||
|
||||
$userId = 1;
|
||||
|
||||
$suggestions = $this->favoritsGateway->getFavorits(0, 'fr');
|
||||
$favorites = $this->quoteGateway->getFavorites($userId);
|
||||
|
||||
require_once $vues['favorits'];
|
||||
require_once $vues['favorite'];
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,28 @@
|
||||
<?php
|
||||
global $twig;
|
||||
|
||||
// Rendu de l'en-tête
|
||||
echo $twig->render('head.html.twig', [
|
||||
'title' => "Accueil",
|
||||
'title' => "Favoris",
|
||||
'style' => "public/styles/styleAccueil.css",
|
||||
'scripts' => array("public/script/theme-toggle.js")
|
||||
]);
|
||||
|
||||
// Rendu du bandeau
|
||||
echo $twig->render('bandeau.html.twig');
|
||||
|
||||
echo "<h2>Favorits</h2>";
|
||||
if (!empty($favorites)) {
|
||||
echo "<h2>Vos favoris</h2>";
|
||||
echo "<div class='suggestions-container'>";
|
||||
foreach ($suggestions as $suggestion) {
|
||||
echo $twig->render('favorits.html.twig', [
|
||||
'quote' => $suggestion['content'],
|
||||
'movie' => $suggestion['title'],
|
||||
'character' => $suggestion['caracter'],
|
||||
'year' => $suggestion['dates'],
|
||||
'imagePath' => $suggestion['imgpath']
|
||||
foreach ($favorites as $favorite) {
|
||||
echo $twig->render('suggestion.html.twig', [
|
||||
'quote' => $favorite['content'],
|
||||
'movie' => $favorite['title'],
|
||||
'character' => $favorite['caracter'],
|
||||
'year' => $favorite['dates'],
|
||||
'imagePath' => $favorite['imgpath']
|
||||
]);
|
||||
}
|
||||
echo "</div>";
|
||||
} else {
|
||||
echo "<p>Vous n'avez pas encore de favorits</p>";
|
||||
}
|
||||
?>
|
Loading…
Reference in new issue