You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
<?php
|
|
namespace Controleur;
|
|
use Model\CommentaryModel;
|
|
use Gateway\CommentaryGateway;
|
|
use Model\UserModel;
|
|
use Gateway\UserGateway;
|
|
|
|
|
|
use Gateway\QuoteGateway;
|
|
|
|
|
|
class UserControler {
|
|
|
|
private QuoteGateway $quoteGateway;
|
|
private CommentaryModel $cMod;
|
|
private UserModel $uMod;
|
|
|
|
public function __construct() {
|
|
global $co;
|
|
$this->quoteGateway = new QuoteGateway($co);
|
|
$this->cMod = new CommentaryModel(new CommentaryGateway($co));
|
|
$this->uMod = new UserModel(new UserGateway($co));
|
|
}
|
|
|
|
public function quiz() {
|
|
global $vues;
|
|
require_once $vues['quiz'];
|
|
}
|
|
|
|
|
|
public function addComment(){
|
|
$id = $_POST['idQuote'];
|
|
$this->cMod->createComment($_POST['content'],$_POST['idQuote'],$this->uMod->getIdByUsername($_SESSION['user']));
|
|
header("Location: /~kemondejar/WF-Website/quote/$id");
|
|
}
|
|
|
|
|
|
public function favorite(array $args) {
|
|
global $vues;
|
|
|
|
$userId = 1;
|
|
|
|
$favorites = $this->quoteGateway->getFavorites($userId);
|
|
|
|
require_once $vues['favorite'];
|
|
}
|
|
}
|