Merge remote-tracking branch 'origin/master'
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
# Conflicts: # Source/Config/config.phpinterestingProfiles
commit
f2e61dfb1f
@ -0,0 +1,91 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table Admin afin de gérer l'espace administrateur.
|
||||||
|
*/
|
||||||
|
class GatewayAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'ajouter un administrateur dans la base de données.
|
||||||
|
*
|
||||||
|
* @param string $login Login du nouvel adimin
|
||||||
|
* @param string $hash Mot de passe au format hash du nouvel admin
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addAdmin(string $login, string $hash): void
|
||||||
|
{
|
||||||
|
$query = "INSERT INTO Admin(login, hash) VALUES(:login, :hash)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':login' => array($login, PDO::PARAM_STR),
|
||||||
|
':hash' => array($hash, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer le mot de passe en format hash du login passé en argument,
|
||||||
|
* afin de vérifier si la connection de l'utilisateur.
|
||||||
|
*
|
||||||
|
* @param string $login Login du coup duquel on veut récupérer le hash associé
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPassword(string $login): array
|
||||||
|
{
|
||||||
|
$query = 'SELECT Hash FROM Admin WHERE Login = :login';
|
||||||
|
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':login' => array($login, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de changer le mot de passe de l'administrateur dont le login
|
||||||
|
* et le nouveau mot de passe au format hash est passé en argument.
|
||||||
|
*
|
||||||
|
* @param string $login Login dont on change le mot de passe
|
||||||
|
* @param string $hash Nouveau mot de passe au format hash
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function changePassword(string $login, string $hash): void
|
||||||
|
{
|
||||||
|
$query = "UPDATE Admin SET hash = :hash WHERE login = :login";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':login' => array($login, PDO::PARAM_STR),
|
||||||
|
':hash' => array($hash, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer un administrateur de la base de donnée par un login passé en paramètre.
|
||||||
|
*
|
||||||
|
* @param string $login Login du compte qui sera supprimé
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteAdmin(string $login): void
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM Admin WHERE login = :login";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':login' => array($login, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use BusinessClass\Form;
|
||||||
|
use BusinessClass\Question;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
class GatewayForm
|
||||||
|
{
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function insertForm(Form $form): void
|
||||||
|
{
|
||||||
|
if (empty($this->getForm())) {
|
||||||
|
$query = "INSERT INTO Form(title, description) VALUES(:title, :desc)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':title' => array($form->getTitle(), PDO::PARAM_STR),
|
||||||
|
':desc' => array($form->getDescription(), PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getForm(): array
|
||||||
|
{
|
||||||
|
$query = "SELECT * FROM Form";
|
||||||
|
$this->connection->executeQuery($query);
|
||||||
|
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteForm(Form $form): void
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM Form WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function assignKeywordToQuestion(string $keyword, string $response, int $idQuestion): void
|
||||||
|
{
|
||||||
|
$query = "SELECT pr.id
|
||||||
|
FROM Propose p, PossibleResponse pr
|
||||||
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
||||||
|
AND pr.content = :response";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($idQuestion, PDO::PARAM_INT),
|
||||||
|
':response' => array($response, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
$idPossibleResponse = $this->connection->getResults()[0][0];
|
||||||
|
|
||||||
|
$query = "INSERT INTO Reference(possibleResponse, keyword) VALUES(:possibleResponse, :keyword)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':possibleResponse' => array($idPossibleResponse, PDO::PARAM_INT),
|
||||||
|
':keyword' => array($keyword, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteKeywordFromQuestion(string $keyword, string $response, Question $question): void
|
||||||
|
{
|
||||||
|
$query = "SELECT pr.id FROM Propose p, PossibleResponse r
|
||||||
|
WHERE p.question = :id AND p.possibleResponse = pr.id
|
||||||
|
AND pr.content = :response";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($question->getId(), PDO::PARAM_INT),
|
||||||
|
':response' => array($response, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
$idPossibleResponse = $this->connection->getResults()[0][0];
|
||||||
|
|
||||||
|
$query = "DELETE FROM Reference WHERE response = :idResponse AND keyword = :idKeword";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':idResponse' => array($idPossibleResponse, PDO::PARAM_INT),
|
||||||
|
':idKeword' => array($keyword, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateTitleToForm(string $title, Form $form): void
|
||||||
|
{
|
||||||
|
$query = "UPDATE Form SET title = :title WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':title' => array($title, PDO::PARAM_STR),
|
||||||
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateDescriptionToForm(string $description, Form $form): void
|
||||||
|
{
|
||||||
|
$query = "UPDATE Form SET title = :title WHERE description = :description";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':description' => array($description, PDO::PARAM_STR),
|
||||||
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteDescriptionToForm(Form $form): void
|
||||||
|
{
|
||||||
|
$query = "UPDATE Form SET title = :title WHERE description = :descript";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':descript' => array('', PDO::PARAM_STR),
|
||||||
|
':id' => array($form->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table Keyword
|
||||||
|
* afin de gérer les catégories disponibles et associer aux différentes réponses des questions.
|
||||||
|
*/
|
||||||
|
class GatewayKeyword
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'ajouter un Keyword dans la base de donnée.
|
||||||
|
*
|
||||||
|
* @param string $keyword Keyword à ajouter
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function insertKeyword(string $keyword)
|
||||||
|
{
|
||||||
|
$query = "INSERT INTO Keyword(word) VALUES(:word)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':word' => array($keyword, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer un keyword de la base de donnée.
|
||||||
|
*
|
||||||
|
* @param string $keyword Keyword à supprimer
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteKeyword(string $keyword)
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM Keyword WHERE word = :word";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':word' => array($keyword, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer l'ensemble des Keyword disponible.
|
||||||
|
*
|
||||||
|
* @return array Retourne la liste de l'ensemble des keyword sauvé dans la base de donnée
|
||||||
|
*/
|
||||||
|
public function getAllKeyword(): array
|
||||||
|
{
|
||||||
|
$query = "SELECT * FROM Keyword";
|
||||||
|
$this->connection->executeQuery($query);
|
||||||
|
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer tous les Keyword qui font référence à l'id de la réponse possible à une question passée en paramètre.
|
||||||
|
*
|
||||||
|
* @param int $id Id de la possible réponse que l'on veut connaitre ses catégories
|
||||||
|
*
|
||||||
|
* @return array Retourne l'ensemble de tous les Keyword associer à la réponse
|
||||||
|
*/
|
||||||
|
public function getKeywordsContentByReference(int $id): array
|
||||||
|
{
|
||||||
|
$query = "SELECT k.* FROM Keyword k, Reference r
|
||||||
|
WHERE k.word = r.keyword AND r.possibleResponse = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->getKeywordByAssotiation($id , $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer tous les Keyword qui font référence à l'id de la réponse d'un candidat passée en paramètre.
|
||||||
|
*
|
||||||
|
* @param int $id Id de la réponse que l'on veut connaitre ses catégories
|
||||||
|
*
|
||||||
|
* @return array Retourne l'ensemble de tous les Keyword associer à la réponse
|
||||||
|
*/
|
||||||
|
public function getKeywordsContentByCategorieze(int $id): array
|
||||||
|
{
|
||||||
|
$query = "SELECT k.* FROM Keyword k, Categorize c
|
||||||
|
WHERE k.word = c.keyword AND c.response = :id";
|
||||||
|
|
||||||
|
return $this->getKeywordByAssotiation($id , $query);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer une liste de Keyword selon une requête donnée et un id associé.
|
||||||
|
*
|
||||||
|
* @param int $id Id de l'objet dont on veut ses Keyword associé
|
||||||
|
* @param string $query Requête que l'on veut exécuter
|
||||||
|
*
|
||||||
|
* @return array Retourne la liste des différents Keyword associé à l'objet voulu
|
||||||
|
*/
|
||||||
|
private function getKeywordByAssotiation(int $id, string $query): array
|
||||||
|
{
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
$tab = [];
|
||||||
|
foreach ($this->connection->getResults() as $result) {
|
||||||
|
$tab[] = $result["word"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tab;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table PossibleResponse
|
||||||
|
* afin de gérer la liste des réponses et les catégories associer d'un candidat.
|
||||||
|
*/
|
||||||
|
class GatewayListResponseOfCandidate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer la liste détaillée des réponses avec leurs catégories associer
|
||||||
|
* aux différentes questions qu'un candidat cible a répondu
|
||||||
|
*
|
||||||
|
* @param int $idListResponse Id du candidat pour lequel on veut récupérer ses réponses
|
||||||
|
*
|
||||||
|
* @return array Retourne une liste qui pour
|
||||||
|
* l'indice 0 a la liste des infos du candidat
|
||||||
|
* l'indice 1 la liste des réponses
|
||||||
|
* l'indice 2 une liste de liste de catégories, qui pour chaque même indice correspont à la liste des catégories de la réponse
|
||||||
|
*/
|
||||||
|
public function getDetailsListResponsesOfCandidate(int $idListResponse)
|
||||||
|
{
|
||||||
|
$gatewayResponse = new GatewayResponse();
|
||||||
|
$gatewayKeyword = new GatewayKeyword();
|
||||||
|
$tabKeywords = [];
|
||||||
|
|
||||||
|
$query = "SELECT * FROM ListResponsesOfCandidate WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($idListResponse, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$questionList = $this->connection->getResults()[0];
|
||||||
|
|
||||||
|
$responses = $gatewayResponse->getResponsesByIdListCandidate($questionList['id']);
|
||||||
|
|
||||||
|
foreach ($responses as $row) {
|
||||||
|
$tabKeywords[] = $gatewayKeyword->getKeywordsContentByCategorieze($row['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($questionList, $responses, $tabKeywords);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer la liste des personnes ayant répondu aux formulaire
|
||||||
|
*
|
||||||
|
* @return array Retourne la liste brute des informations de tous les candidats ayant répondu au formulaire
|
||||||
|
*/
|
||||||
|
public function getAllListResponsesOfCandidate(): array
|
||||||
|
{
|
||||||
|
$query = "SELECT * FROM ListResponsesOfCandidate";
|
||||||
|
$this->connection->executeQuery($query);
|
||||||
|
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer la liste des réponses d'un candidat de la base de donnée
|
||||||
|
*
|
||||||
|
* @param int $id Id du candidat à supprimer
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteListResponseOfCandidate(int $id): void
|
||||||
|
{
|
||||||
|
$gatewayResponse = new GatewayResponse();
|
||||||
|
|
||||||
|
foreach ($gatewayResponse->getResponsesIdByIdListCandidate($id) as $response) {
|
||||||
|
$gatewayResponse->deleteResponseById($response);
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "DELETE FROM ListResponsesOfCandidate WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
'id' => array($id, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'insérer dans la base de données les réponses aux questions d'un candidat
|
||||||
|
* ainsi que les catégories associées à chaque réponse
|
||||||
|
*
|
||||||
|
* @param array $id Liste des id des questions répondue
|
||||||
|
* @param array $answer Liste des réponses à chaque question
|
||||||
|
* @param array $category Liste des catégories attribuées à chaque réponse
|
||||||
|
* @param string $titleForm Titre du formulaire
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function insertListResponsesOfCandidate(array $id, array $answer, array $category, string $titleForm): void
|
||||||
|
{
|
||||||
|
$gatewayResponse = new GatewayResponse();
|
||||||
|
$gatewayQuestion = new GatewayQuestion();
|
||||||
|
|
||||||
|
$query = "INSERT INTO ListResponsesOfCandidate(date, titleForm) VALUES(:date, :titleForm)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':date' => array(date('Y-m-d H:i:s'), PDO::PARAM_STR),
|
||||||
|
':titleForm' => array($titleForm, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
$idListQuestion = $this->connection->lastInsertId();
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($answer); $i++) {
|
||||||
|
$question = $gatewayQuestion->getQuestionContentById($id[$i]);
|
||||||
|
$idResponse = $gatewayResponse->insertResponse($question, $answer[$i], $category[$i]);
|
||||||
|
|
||||||
|
$query = "INSERT INTO Submit (responsesCandidate, response) VALUES(:responsesCandidate, :response)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':responsesCandidate' => array($idListQuestion, PDO::PARAM_STR),
|
||||||
|
':response' => array($idResponse, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table PossibleResponse.
|
||||||
|
*/
|
||||||
|
class GatewayPossibleResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer les différentes réponses possibles à une question donnée.
|
||||||
|
*
|
||||||
|
* @param string $idQuestion Id de la question pour laquelle on veut récupérer les réponses possibles
|
||||||
|
*
|
||||||
|
* @return array Retourne la liste de possibles réponses
|
||||||
|
*/
|
||||||
|
public function getPossibleResponseByQuestion(string $idQuestion): array
|
||||||
|
{
|
||||||
|
$query = "SELECT pr.* FROM Propose p, PossibleResponse pr
|
||||||
|
WHERE p.question = :questionId AND p.possibleResponse = pr.id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':questionId' => array($idQuestion, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'insérer une possible réponse dans la base de donnée.
|
||||||
|
*
|
||||||
|
* @param string $contentPossibleResponse Contenu de la possible réponse
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function insertPossibleResponse(string $contentPossibleResponse): int
|
||||||
|
{
|
||||||
|
$query = "INSERT INTO PossibleResponse(content) VALUES(:content)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':content' => array($contentPossibleResponse, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->connection->lastInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer une possible réponse de la base de donnée par son id.
|
||||||
|
*
|
||||||
|
* @param int $id Id de la possible réponse à supprimer
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deletePossibleResponse(int $id): void
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM Reference WHERE response = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$query = "DELETE FROM PossibleResponse WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,193 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use BusinessClass\BoxQuestion;
|
||||||
|
use BusinessClass\Question;
|
||||||
|
use BusinessClass\TextQuestion;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table Question
|
||||||
|
* afin de rendre le formulaire modulable.
|
||||||
|
*/
|
||||||
|
class GatewayQuestion
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'ajouter une question dans la base de donnée.
|
||||||
|
*
|
||||||
|
* @param Question $question Information sur la question ajouter
|
||||||
|
* @param int $idForm Id du formulaire associer
|
||||||
|
*
|
||||||
|
* @return int Id de la question ajouté en base
|
||||||
|
*/
|
||||||
|
public function addQuestion(Question $question, int $idForm): int
|
||||||
|
{
|
||||||
|
$query = "INSERT INTO Question(content, type, form) VALUES(:content, :type, :form)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':content' => array($question->getContent(), PDO::PARAM_STR),
|
||||||
|
':type' => array(get_class($question), PDO::PARAM_STR),
|
||||||
|
':form' => array($idForm, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->connection->lastInsertId();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ajoute une possible réponse à une question cible et associe à la possible réponse des catégories.
|
||||||
|
*
|
||||||
|
* @param string $response Contenu de la réponse possible
|
||||||
|
* @param array $categories Liste des catégories attribuées à la possible réponse
|
||||||
|
* @param int $idQuestion Id de la question associée à cette possible réponse
|
||||||
|
*
|
||||||
|
* @return int Retourne l'id de la possible réponse insérée en base
|
||||||
|
*/
|
||||||
|
public function insertResponseInQuestion(string $response, array $categories, int $idQuestion): int
|
||||||
|
{
|
||||||
|
$gatewayPossibleResponse = new GatewayPossibleResponse();
|
||||||
|
$idPossibleResponse = $gatewayPossibleResponse->insertPossibleResponse($response);
|
||||||
|
|
||||||
|
$query = "INSERT INTO Propose(question, possibleResponse) VALUES(:question, :possibleResponse)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':question' => array($idQuestion, PDO::PARAM_INT),
|
||||||
|
':possibleResponse' => array($idPossibleResponse, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($categories as $keyword) {
|
||||||
|
$gatewayForm = new GatewayForm();
|
||||||
|
$gatewayForm->assignKeywordToQuestion($keyword, $response, $idQuestion);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $idQuestion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer une question dans la base ainsi que ses dépendances
|
||||||
|
*
|
||||||
|
* @param Question $question Information de la question à supprimer
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteQuestion(Question $question): void
|
||||||
|
{
|
||||||
|
if (get_class($question) == BoxQuestion::class) {
|
||||||
|
$query = "DELETE FROM Propose WHERE question = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($question->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$listPossibleResponse = $question->getPossibleResponses();
|
||||||
|
for ($i = 0; $i < count($listPossibleResponse); $i++) {
|
||||||
|
$gatewayPossibleResponse = new GatewayPossibleResponse();
|
||||||
|
$gatewayPossibleResponse->deletePossibleResponse($listPossibleResponse[$i]->getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = "DELETE FROM Question WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($question->getId(), PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de modifier dans la base de données les informations de la question.
|
||||||
|
*
|
||||||
|
* @param Question $question Question modifier à changer en base
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function updateQuestion(Question $question): void
|
||||||
|
{
|
||||||
|
$query = "UPDATE Question SET content = :content, type = :type, form = :frm WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':content' => array($question->getContent(), PDO::PARAM_STR),
|
||||||
|
':type' => array(get_class($question), PDO::PARAM_STR),
|
||||||
|
':frm' => array($question->getForm(), PDO::PARAM_STR),
|
||||||
|
':id' => array($question->getId(), PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer toutes les questions, possibles réponses et catégories associées d'un formualire cible.
|
||||||
|
*
|
||||||
|
* @param string $idForm Id du formulaire
|
||||||
|
*
|
||||||
|
* @return array Retourne une liste qui pour
|
||||||
|
* l'indice 0 la liste des questions
|
||||||
|
* l'indice 1 une liste de liste de réponses, qui pour chaque même indice correspond à la liste des réponses possibles de la question
|
||||||
|
* l'indice 2 une liste de liste de liste de catégories qui pour chaque indice de questions,
|
||||||
|
* on a une liste de liste de catégories qui pour chaque indice de réponses est associer une liste de catégories
|
||||||
|
* Ou vide s'il n'y a pas de question dans la base
|
||||||
|
*/
|
||||||
|
public function getAllQuestions(string $idForm): array
|
||||||
|
{
|
||||||
|
$query = "SELECT * FROM Question WHERE form = :fom";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':fom' => array($idForm, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$listQuestions = $this->connection->getResults();
|
||||||
|
$possibleResponsesContent = [];
|
||||||
|
$keywordsResponses = [];
|
||||||
|
$gatewayKeyword = new GatewayKeyword();
|
||||||
|
$gatewayPossibleResponse = new GatewayPossibleResponse();
|
||||||
|
|
||||||
|
if (!empty($listQuestions)) {
|
||||||
|
|
||||||
|
for ($i = 0; $i < count($listQuestions); $i++) {
|
||||||
|
|
||||||
|
if ($listQuestions[$i]["type"] != "BusinessClass/TextQuestion") {
|
||||||
|
$idQuestion = $listQuestions[$i]["id"];
|
||||||
|
$possibleResponses = $gatewayPossibleResponse->getPossibleResponseByQuestion($idQuestion);
|
||||||
|
$tmpTabKeyword = [];
|
||||||
|
$tmpTabPossibleResponse = [];
|
||||||
|
|
||||||
|
foreach ($possibleResponses as $row) {
|
||||||
|
$tmpTabKeyword[] = $gatewayKeyword->getKeywordsContentByReference($row["id"]);
|
||||||
|
$tmpTabPossibleResponse[] = $row["content"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$possibleResponsesContent[] = $tmpTabPossibleResponse;
|
||||||
|
$keywordsResponses[] = $tmpTabKeyword;
|
||||||
|
} else {
|
||||||
|
$possibleResponsesContent[] = null;
|
||||||
|
$keywordsResponses[] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array($listQuestions, $possibleResponsesContent, $keywordsResponses);
|
||||||
|
}
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer le contenu d'une réponse à une question par son id.
|
||||||
|
*
|
||||||
|
* @param string $id Id de la question cible
|
||||||
|
*
|
||||||
|
* @return string Retourne le contenu de la question ciblé
|
||||||
|
*/
|
||||||
|
public function getQuestionContentById(string $id): string
|
||||||
|
{
|
||||||
|
$query = "SELECT content FROM Question WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->connection->getResults()[0][0];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace API\script\Gateway;
|
||||||
|
|
||||||
|
use API\script\Config\Connection;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'accéder, d'écrire ou de modifier les données contenues dans la table Response
|
||||||
|
* afin de récupérer les réponses d'un utilisateur.
|
||||||
|
*/
|
||||||
|
class GatewayResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Connection
|
||||||
|
*/
|
||||||
|
private Connection $connection;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->connection = connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer la liste des réponses d'un candidat ainsi que les Keyword couvert pour chaque réponse.
|
||||||
|
*
|
||||||
|
* @param int $listResponsesOfCandidateId Id du candidat
|
||||||
|
*
|
||||||
|
* @return array Retourne une liste contenant à l'indice 0 la liste de réponse
|
||||||
|
* et à l'indice 1 une liste de liste de Keword,
|
||||||
|
* où chaque indice d'une liste de question est associé au même indice une réponse
|
||||||
|
*/
|
||||||
|
public function getCatgoriezeOfResponsesIdByIdListCandidate(int $listResponsesOfCandidateId): array
|
||||||
|
{
|
||||||
|
$result = $this->getResponsesByIdListCandidate($listResponsesOfCandidateId);
|
||||||
|
$tab = [];
|
||||||
|
foreach ($result as $row) {
|
||||||
|
$tab[] = (new GatewayKeyword())->getKeywordsContentByCategorieze($row['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($result, $tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer la liste des réponses d'un candidat par son id.
|
||||||
|
*
|
||||||
|
* @param int $listResponsesOfCandidateId Id du candidat
|
||||||
|
*
|
||||||
|
* @return array Retourne la list des réponses du candidat
|
||||||
|
*/
|
||||||
|
public function getResponsesByIdListCandidate(int $listResponsesOfCandidateId): array
|
||||||
|
{
|
||||||
|
$query = "SELECT r.* FROM Response r, Submit s WHERE s.responsesCandidate = :id AND r.id = s.response";
|
||||||
|
return $this->getResponsesByQueryAndIdListCandidate($query, $listResponsesOfCandidateId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer la liste des id des réponses d'un candidat par son id.
|
||||||
|
*
|
||||||
|
* @param int $listResponsesOfCandidateId Id du candidat
|
||||||
|
*
|
||||||
|
* @return array Retourne la list des id des réponses du candidat
|
||||||
|
*/
|
||||||
|
public function getResponsesIdByIdListCandidate(int $listResponsesOfCandidateId): array
|
||||||
|
{
|
||||||
|
$query = "SELECT r.id FROM Response r, Submit s WHERE s.responseCandidate = :id AND r.id = s.response";
|
||||||
|
return $this->getResponsesByQueryAndIdListCandidate($query, $listResponsesOfCandidateId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de récupérer une liste de format de réponse définit par la commande sql passé en paramètre,
|
||||||
|
* dont l'id du candidat, ayant formulé ces réponses, est passé en paramètre.
|
||||||
|
*
|
||||||
|
* @param string $query Requête du format de liste de réponse voulu
|
||||||
|
* @param int $id Id du candidat cible
|
||||||
|
*
|
||||||
|
* @return array Retourne la liste des réponses d'un candidat selon le format voulu
|
||||||
|
*/
|
||||||
|
private function getResponsesByQueryAndIdListCandidate(string $query, int $id): array
|
||||||
|
{
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($id, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
return $this->connection->getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet de supprimer la réponse et ses liens avec les différents Keyword
|
||||||
|
* selon l'id de la réponse passée en paramêtre
|
||||||
|
*
|
||||||
|
* @param int $responseId Id de la réponse à supprimer
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function deleteResponseById(int $responseId): void
|
||||||
|
{
|
||||||
|
$query = "DELETE FROM Categorize WHERE response = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($responseId, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$query = "DELETE FROM Submit WHERE response = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($responseId, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
|
||||||
|
$query = "DELETE FROM Response WHERE id = :id";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':id' => array($responseId, PDO::PARAM_INT)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Permet d'insérer une réponse ainsi que de la lier avec les Keywords passés en paramètre.
|
||||||
|
*
|
||||||
|
* @param string $content Contenu de la réponse
|
||||||
|
* @param string $questionContent Contenu de la question, dans le cas où la question viendra à changer dans le futur
|
||||||
|
* @param array $category Liste des Keyword associé à la réponse
|
||||||
|
*
|
||||||
|
* @return int Retourne l'Id de la réponse insérée
|
||||||
|
*/
|
||||||
|
public function insertResponse(string $content, string $questionContent, array $category): int
|
||||||
|
{
|
||||||
|
$query = "INSERT INTO Response(content, questionContent) VALUES (:content, :questionContent)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':content' => array($content, PDO::PARAM_STR),
|
||||||
|
':questionContent' => array($questionContent, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
|
||||||
|
$idResponse = $this->connection->lastInsertId();
|
||||||
|
|
||||||
|
foreach ($category as $keyword) {
|
||||||
|
$query = "INSERT INTO Categorize (response, keyword) VALUES(:response, :keyword)";
|
||||||
|
$this->connection->executeQuery($query, array(
|
||||||
|
':response' => array($idResponse, PDO::PARAM_STR),
|
||||||
|
':keyword' => array($keyword, PDO::PARAM_STR)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $idResponse;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<?php
|
||||||
|
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
|
||||||
|
?>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="Views/CSS/base.css" />
|
||||||
|
<link rel="preconnect" href="<?php echo $googleApis; ?>">
|
||||||
|
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
|
||||||
|
<link href="<?php echo $poppins; ?>" rel="stylesheet">
|
||||||
|
<title>Formulaire de témoignage</title>
|
||||||
|
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
|
||||||
|
<h1>Administration</h1>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<a href="index.php?action=goToCategories">Les catégories</a>
|
||||||
|
<a href="index.php?action=goToQuestions">Les questions</a>
|
||||||
|
<a href="index.php?action=goToResponses">Les réponses</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<h3>Les catégories :</h3>
|
||||||
|
<form method="post">
|
||||||
|
<label for="keyword"></label><input id="keyword" name="keyword" type="text" size="25" placeholder="...">
|
||||||
|
<input type="submit" value="Ajouter">
|
||||||
|
<input type="hidden" name="action" value="addKeyword">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<ul class="form-center">
|
||||||
|
<?php
|
||||||
|
foreach ($categories as $category) {
|
||||||
|
?> <li><?php echo $category; ?></li> <?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,75 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<?php
|
||||||
|
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
|
||||||
|
?>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="Views/CSS/base.css" />
|
||||||
|
<link rel="preconnect" href="<?php echo $googleApis; ?>">
|
||||||
|
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
|
||||||
|
<link href="<?php echo $poppins; ?>" rel="stylesheet">
|
||||||
|
<title>Formulaire de témoignage</title>
|
||||||
|
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
|
||||||
|
<h1>Administration</h1>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<a href="index.php?action=goToCategories">Les catégories</a>
|
||||||
|
<a href="index.php?action=goToQuestions">Les questions</a>
|
||||||
|
<a href="index.php?action=goToResponses">Les réponses</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<h3>Les questions :</h3>
|
||||||
|
<br>
|
||||||
|
<form method="post">
|
||||||
|
<div>
|
||||||
|
<label for="question">Écrivez la question : </label>
|
||||||
|
<br>
|
||||||
|
<input id="question" name="question" type="text" size="70">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<label for="type">Séléctionnez le type de question souhaitée :
|
||||||
|
<br>- Text permet d'écrire la réponse librement.
|
||||||
|
<br>- ListBox permet de choisir une réponse parmi plusieurs possibilités.
|
||||||
|
<br>- CheckBox permet de choisir une ou plusieurs réponses parmi plusieurs possibilités.
|
||||||
|
</label>
|
||||||
|
<br>
|
||||||
|
<select id="type" name="type">
|
||||||
|
<option value="BusinessClass\TextQuestion">Text</option>
|
||||||
|
<option value="BusinessClass\ListBoxQuestion">ListBox</option>
|
||||||
|
<option value="BusinessClass\CheckBoxQuestion">CheckBox</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<input type="submit" value="Ajouter">
|
||||||
|
<input type="hidden" name="action" value="addQuestion">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
<br>
|
||||||
|
<ul class="form-center">
|
||||||
|
<?php
|
||||||
|
foreach ($questions as $question) {
|
||||||
|
?>
|
||||||
|
<?php echo $question->printStrategy() ?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,61 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<?php
|
||||||
|
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
|
||||||
|
?>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="Views/CSS/base.css" />
|
||||||
|
<link rel="preconnect" href="<?php echo $googleApis; ?>">
|
||||||
|
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
|
||||||
|
<link href="<?php echo $poppins; ?>" rel="stylesheet">
|
||||||
|
<title>Formulaire de témoignage</title>
|
||||||
|
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
|
||||||
|
<h1>Administration</h1>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<a href="index.php?action=goToCategories">Les catégories</a>
|
||||||
|
<a href="index.php?action=goToQuestions">Les questions</a>
|
||||||
|
<a href="index.php?action=goToResponses">Les réponses</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div class="form-center">
|
||||||
|
<h3>Les réponses :</h3>
|
||||||
|
<br>
|
||||||
|
<div id="listResponses">
|
||||||
|
<?php
|
||||||
|
foreach ($responsesCandidate as $response) { ?>
|
||||||
|
<i><?php echo $response[0]["date"]; ?></i>
|
||||||
|
<p>Catégories associées :
|
||||||
|
<?php
|
||||||
|
echo " | ";
|
||||||
|
foreach ($response[2] as $category)
|
||||||
|
if(!empty($category)) {
|
||||||
|
echo $category[0] . " | ";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</p>
|
||||||
|
<?php foreach ($response[1] as $questionResponses) { ?>
|
||||||
|
<p><i>Question : </i><?php echo $questionResponses["content"]; ?></p>
|
||||||
|
<p><i>Réponse : </i><?php echo $questionResponses["questionContent"]; ?></p>
|
||||||
|
<?php
|
||||||
|
} ?>
|
||||||
|
|
||||||
|
<hr><br>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,9 +1,9 @@
|
|||||||
let dataIds = [];
|
let dataIds = [];
|
||||||
let elements = document.querySelectorAll('[data-id]');
|
let elements = document.querySelectorAll('[data-id]');
|
||||||
|
|
||||||
elements.forEach(function(element) {
|
elements.forEach(function(element) {
|
||||||
dataIds.push(element.getAttribute('data-id'));
|
dataIds.push(element.getAttribute('data-id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
let dataIdsInput = document.querySelector('input[name="data_ids"]');
|
let dataIdsInput = document.querySelector('input[name="data_ids"]');
|
||||||
dataIdsInput.value = JSON.stringify(dataIds);
|
dataIdsInput.value = JSON.stringify(dataIds);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in new issue