modif gateway + model quote

pull/21/head
kevin.modejar 6 months ago
parent 15a3e67b38
commit ca989f81fc

@ -36,11 +36,11 @@ Class QuoteGateway{
return $result;
}
public function getComment(int $id):array{
public function searchId(string $id):array{
//obtention des commentaire d'une citation
$query="SELECT c.id_comment u.username, u.imgPath, c.comment, c.date FROM Commentary c JOIN Quote q ON c.quote = q.id_quote JOIN User u ON u.id_user = c.user JOIN Image i ON i.id_img = u.img WHERE id_quote = :id;";
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
//recherche par id
$query="SELECT q.id_quote, q.content, c.caracter, c.img_path, s.title, s.date, q.like, q.language FROM Quote q JOIN Caracter c ON c.id_caracter = q.id_caracter JOIN Source s ON s.id_source = q.id_source WHERE q.id_quote = '%:id%' AND q.isValid = true;";
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_STR)));
$result=$this->con->getResults();
return $result;
}
@ -64,7 +64,7 @@ Class QuoteGateway{
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
}
public function validQuote(int $id){
public function invalidQuote(int $id){
//Invalide la quote par l'admin (suppression)
$query ='DELETE FROM Quote WHERE id_Quote=:id';
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));

@ -11,9 +11,9 @@
$this->gateway = $gate;
}
public function searchQuote(string $quote,int $numpage,string $language) : Quote{
$res = $this->gateway->searchQuote($quote,$numpage,$language);
return new Quote($res[0]['']);
public function searchId(int $id): Quote{
$res = $this->gate->searchId($id)[0];
return new Quote($res["q.id_quote"],$res["q.content"],$res["c.caracter"],$res["c.img_path"],$res["s.title"],$res["s.date"],$res["q.like"],$res["q.language"]);
}
}

@ -1,14 +1,6 @@
<?php
//appele avec index.php ne pas metre si controleur fonctionnel
require __DIR__ . '/../vendor/autoload.php';
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
//global $twig;
global $twig;
echo $twig->render('head.html.twig', array(
'title' => "Quote",

@ -2,10 +2,10 @@
<div class="nav">
<a href="favorite.html"><img src="../images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="../images/light.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="quiz.html"><img src="../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
<a href="/quizz/1"><img src="../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
</div>
<div class="logo">
<a href="accueil.html"><img src="../images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
<a href="/"><img src="../images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<a href="profil.html"><img src="../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>

Loading…
Cancel
Save