|
|
@ -45,6 +45,91 @@ Class QuoteGateway{
|
|
|
|
return $result;
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//======================== PARTI ADMIN ========================
|
|
|
|
|
|
|
|
//Probablement à déplacer dans un autre fichier
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getQuoteIsValide():array{
|
|
|
|
|
|
|
|
//obtenir les quotes en attentes de validation par l'admin
|
|
|
|
|
|
|
|
$query = 'SELECT * FROM Quote WHERE isValid=:bool';
|
|
|
|
|
|
|
|
$this->con->executeQuery($query,array(':bool' => array(false, PDO::PARAM_BOOL)));
|
|
|
|
|
|
|
|
$result=$this->con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function validQuote(int $id){
|
|
|
|
|
|
|
|
//Valider la quote par l'admin
|
|
|
|
|
|
|
|
$query ='UPDATE Quote SET isValid=:newValide WHERE id_Quote=:id';
|
|
|
|
|
|
|
|
$this->con->executeQuery($query,array(':id' => array($id,PDO::PARAM_INT)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function validQuote(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)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateContent(int $id, string $newContent):array{
|
|
|
|
|
|
|
|
//Update le contexte de quote passé en paramètre
|
|
|
|
|
|
|
|
$queryUpdate = 'UPDATE Quote SET content=:newContent WHERE id_quote=:idQuote';
|
|
|
|
|
|
|
|
$con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newContent'=> array($newContent, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Renvoie le nouveau contexte de quote
|
|
|
|
|
|
|
|
$queryReponse = 'SELECT content FROM Quote WHERE id_quote=:idQuote';
|
|
|
|
|
|
|
|
$con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
$result = $con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateTimeCode(int $id, string $newTimeCode):array{
|
|
|
|
|
|
|
|
//Update le time code de quote passé en paramètre
|
|
|
|
|
|
|
|
$queryUpdate = 'UPDATE Quote SET timecode=:newTimeCode WHERE id_quote=:idQuote';
|
|
|
|
|
|
|
|
$con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTimeCode'=> array($newTimeCode, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Renvoie le nouveau contexte de quote
|
|
|
|
|
|
|
|
$queryReponse = 'SELECT timecode FROM Quote WHERE id_quote=:idQuote';
|
|
|
|
|
|
|
|
$con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
$result = $con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateDate(int $id, int $newDate):array{
|
|
|
|
|
|
|
|
//Update la date de quote passé en paramètre
|
|
|
|
|
|
|
|
$queryUpdate = 'UPDATE Source SET dateSource =:newdate WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)';
|
|
|
|
|
|
|
|
$con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newDate'=> array($newDate, PDO::PARAM_INT)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Renvoie la nouvelle date de quote
|
|
|
|
|
|
|
|
$queryReponse = 'SELECT s.dateSource FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource';
|
|
|
|
|
|
|
|
$con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
$result = $con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateTitle(int $id, string $newTitle):array{
|
|
|
|
|
|
|
|
//Update le titre de l'oeuvre de quote passé en paramètre
|
|
|
|
|
|
|
|
$queryUpdate = 'UPDATE Source SET title =:newTitle WHERE idSource = (SELECT idSource FROM Quote WHERE idQuote =:idQuote)';
|
|
|
|
|
|
|
|
$con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newTitle'=> array($newTitle, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Renvoie le nouveau titre de quote
|
|
|
|
|
|
|
|
$queryReponse = 'SELECT s.title FROM Source s, Quote q WHERE id_quote=:idQuote AND s.idSource = q.idSource';
|
|
|
|
|
|
|
|
$con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
$result = $con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function updateNameCharacter(int $id, string $newNameCharacter):array{
|
|
|
|
|
|
|
|
//Update le personnage de l'oeuvre de quote passé en paramètre
|
|
|
|
|
|
|
|
$queryUpdate = 'UPDATE Character SET name =:newNameCharacter WHERE idCharacter = (SELECT idCharacter FROM Quote WHERE idQuote =:idQuote)';
|
|
|
|
|
|
|
|
$con->executeQuery($queryUpdate, array(':idQuote'=>array($id, PDO::PARAM_STR), ':newNameCharacter'=> array($newNameCharacter, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Renvoie le nouveau personnage de quote
|
|
|
|
|
|
|
|
$queryReponse = 'SELECT c.title FROM Character c, Quote q WHERE id_quote=:idQuote AND c.idCharacter = q.idCharacter';
|
|
|
|
|
|
|
|
$con->executeQuery($queryReponse, array(':idQuote'=>array($id, PDO::PARAM_STR)));
|
|
|
|
|
|
|
|
$result = $con->getResults();
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|