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