Merge branch 'master' into api_call

# Conflicts:
#	Source/API/script/Gateway/GatewayAdmin.php
#	Source/API/script/Gateway/GatewayForm.php
#	Source/API/script/Gateway/GatewayKeyword.php
#	Source/API/script/Gateway/GatewayListResponseOfCandidate.php
#	Source/API/script/Gateway/GatewayPossibleResponse.php
#	Source/API/script/Gateway/GatewayQuestion.php
#	Source/API/script/Gateway/GatewayResponse.php
#	Source/Model/ModelAdmin.php
interestingProfiles
dorian.hodin 2 years ago
commit 5872130e9c

@ -0,0 +1,17 @@
RewriteEngine on
RewriteRule ^/$ index.php?page=goToForm [L]
RewriteRule ^goToForm$ index.php?page=goToForm [L]
RewriteRule ^submitForm$ index.php?page=submitForm [L]
RewriteRule ^addQuestion$ index.php?page=addQuestion [L]
RewriteRule ^addResponse$ index.php?page=addResponse [L]
RewriteRule ^continueResponse$ index.php?page=continueResponse [L]
RewriteRule ^createForm$ index.php?page=createForm [L]
RewriteRule ^addKeyword$ index.php?page=addKeyword [L]
RewriteRule "goToAdmin" index.php?page=goToAdmin [L]
RewriteRule ^goToAdminLogin$ index.php?page=goToAdminLogin [L]
RewriteRule ^login$ index.php?page=login [L]
RewriteRule ^goToCategories$ index.php?page=goToCategories [L]
RewriteRule ^goToQuestions$ index.php?page=goToQuestions [L]
RewriteRule ^goToResponses$ index.php?page=goToResponses [L]

@ -0,0 +1,40 @@
<?php
namespace API\script\Gateway;
use 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 de récupérer le mot de passe de l'administrateur en fonction de son login.
* @param String $login Le login de l'administrateur.
* @return String|null Le mot de passe de l'administrateur ou null si l'administrateur n'existe pas.
*/
public function getPasswordWithLogin(String $login)
{
$query = "SELECT password FROM ADMIN WHERE login = :login";
$this->connection->executeQuery($query, array(
':login' => array($login, PDO::PARAM_STR)
));
$result = $this->connection->getResults();
if(empty($result))
return null;
return $result[0]['password'];
}
}

@ -0,0 +1,118 @@
<?php
namespace API\script\Gateway;
use 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)
));
}
public function existsForm(): bool
{
$query = "SELECT * FROM Form";
$this->connection->executeQuery($query);
return !empty($this->connection->getResults());
}
}

@ -0,0 +1,124 @@
<?php
namespace API\script\Gateway;
use 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 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 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 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 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;
}
}

@ -25,18 +25,18 @@ class CheckBoxQuestion extends BoxQuestion
$possibleResponses = $this->getPossibleResponses();
$categories = $this->getCategories();
$html = "\t\t\t<div id='$id' class='question'>
<label><strong>$content</strong></label>\n";
$html = "<div class='tab'>
<h6>$content</h6>";
for ($i = 0; $i < count($possibleResponses); $i++) {
$categoriesSplit = $id."||".$possibleResponses[$i]."||";
foreach ($categories[$i] as $category) {
$categoriesSplit.= $category."_";
}
$html.= "\t\t\t\t<br><li><input type='checkbox' name='answers[]' value='$categoriesSplit' />
<label>$possibleResponses[$i]</label>\n";
$html.= "<p><input style='-webkit-appearance: checkbox;' type='checkbox' name='answers[]' value='$categoriesSplit' />
<label>$possibleResponses[$i]</label></p>";
}
$html.= "\t\t\t</div><br>\n";
$html.= "\t\t\t</div>\n";
return $html;
}

@ -25,19 +25,21 @@ class ListBoxQuestion extends BoxQuestion
$possibleResponses = $this->getPossibleResponses();
$categories = $this->getCategories();
$html = "\t\t\t<div id='$id' class='question'>
<label><strong>$content</strong></label>
<br><select name='answers[]'>\n";
$html = "<div class='tab'>
<h6>$content</h6>
<select name='answers[]'>";
for ($i = 0; $i < count($possibleResponses); $i++) {
$categoriesSplit = $id."||".$possibleResponses[$i]."||";
foreach ($categories[$i] as $category) {
$categoriesSplit.= $category."_";
}
$html.= "\t\t\t\t\t<option value='$categoriesSplit'>$possibleResponses[$i]</option>\n";
$html.= "<p> <option value='$categoriesSplit'>$possibleResponses[$i]</option> </p>";
}
$html.= "\t\t\t\t</select>
</div><br>\n";
</div>\n";
return $html;
}

@ -17,9 +17,11 @@ class TextQuestion extends Question
$content = $this->getContent();
$id = $this->getId();
return "\t\t\t<div class='question'>
<label><strong>$content</strong></label>
<br><input data-id='$id' type='text' name='answers[]' />
</div><br>\n";
return "<div class='tab'>
<h6>$content</h6>
<p>
<input data-id='$id' placeholder='...' oninput='this.className = '''' type='text' name='answers[]'>
</p>
</div>\n";
}
}

@ -0,0 +1,306 @@
<?php
/*
MIT License
Copyright (c) 2012 Danny van Kooten <hi@dannyvankooten.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
namespace Config;
use RuntimeException;
class AltoRouter
{
/**
* @var array Array of all routes (incl. named routes).
*/
protected $routes = [];
/**
* @var array Array of all named routes.
*/
protected $namedRoutes = [];
/**
* @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host)
*/
protected $basePath = '';
/**
* @var array Array of default match types (regex helpers)
*/
protected $matchTypes = [
'i' => '[0-9]++',
'a' => '[0-9A-Za-z]++',
'h' => '[0-9A-Fa-f]++',
'*' => '.+?',
'**' => '.++',
'' => '[^/\.]++'
];
/**
* Create router in one call from config.
*
* @param array $routes
* @param string $basePath
* @param array $matchTypes
* @throws Exception
*/
public function __construct(array $routes = [], $basePath = '', array $matchTypes = [])
{
$this->addRoutes($routes);
$this->setBasePath($basePath);
$this->addMatchTypes($matchTypes);
}
/**
* Retrieves all routes.
* Useful if you want to process or display routes.
* @return array All routes.
*/
public function getRoutes()
{
return $this->routes;
}
/**
* Add multiple routes at once from array in the following format:
*
* $routes = [
* [$method, $route, $target, $name]
* ];
*
* @param array $routes
* @return void
* @author Koen Punt
* @throws Exception
*/
public function addRoutes($routes)
{
if (!is_array($routes) && !$routes instanceof Traversable) {
throw new RuntimeException('Routes should be an array or an instance of Traversable');
}
foreach ($routes as $route) {
call_user_func_array([$this, 'map'], $route);
}
}
/**
* Set the base path.
* Useful if you are running your application from a subdirectory.
* @param string $basePath
*/
public function setBasePath($basePath)
{
$this->basePath = $basePath;
}
/**
* Add named match types. It uses array_merge so keys can be overwritten.
*
* @param array $matchTypes The key is the name and the value is the regex.
*/
public function addMatchTypes(array $matchTypes)
{
$this->matchTypes = array_merge($this->matchTypes, $matchTypes);
}
/**
* Map a route to a target
*
* @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE)
* @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id]
* @param mixed $target The target where this route should point to. Can be anything.
* @param string $name Optional name of this route. Supply if you want to reverse route this url in your application.
* @throws Exception
*/
public function map($method, $route, $target, $name = null)
{
$this->routes[] = [$method, $route, $target, $name];
if ($name) {
if (isset($this->namedRoutes[$name])) {
throw new RuntimeException("Can not redeclare route '{$name}'");
}
$this->namedRoutes[$name] = $route;
}
return;
}
/**
* Reversed routing
*
* Generate the URL for a named route. Replace regexes with supplied parameters
*
* @param string $routeName The name of the route.
* @param array @params Associative array of parameters to replace placeholders with.
* @return string The URL of the route with named parameters in place.
* @throws Exception
*/
public function generate($routeName, array $params = [])
{
// Check if named route exists
if (!isset($this->namedRoutes[$routeName])) {
throw new RuntimeException("Route '{$routeName}' does not exist.");
}
// Replace named parameters
$route = $this->namedRoutes[$routeName];
// prepend base path to route url again
$url = $this->basePath . $route;
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
foreach ($matches as $index => $match) {
list($block, $pre, $type, $param, $optional) = $match;
if ($pre) {
$block = substr($block, 1);
}
if (isset($params[$param])) {
// Part is found, replace for param value
$url = str_replace($block, $params[$param], $url);
} elseif ($optional && $index !== 0) {
// Only strip preceding slash if it's not at the base
$url = str_replace($pre . $block, '', $url);
} else {
// Strip match block
$url = str_replace($block, '', $url);
}
}
}
return $url;
}
/**
* Match a given Request Url against stored routes
* @param string $requestUrl
* @param string $requestMethod
* @return array|boolean Array with route information on success, false on failure (no match).
*/
public function match($requestUrl = null, $requestMethod = null)
{
$params = [];
// set Request Url if it isn't passed as parameter
if ($requestUrl === null) {
$requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/';
}
// strip base path from request url
$requestUrl = substr($requestUrl, strlen($this->basePath));
// Strip query string (?a=b) from Request Url
if (($strpos = strpos($requestUrl, '?')) !== false) {
$requestUrl = substr($requestUrl, 0, $strpos);
}
$lastRequestUrlChar = $requestUrl ? $requestUrl[strlen($requestUrl)-1] : '';
// set Request Method if it isn't passed as a parameter
if ($requestMethod === null) {
$requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
}
foreach ($this->routes as $handler) {
list($methods, $route, $target, $name) = $handler;
$method_match = (stripos($methods, $requestMethod) !== false);
// Method did not match, continue to next route.
if (!$method_match) {
continue;
}
if ($route === '*') {
// * wildcard (matches all)
$match = true;
} elseif (isset($route[0]) && $route[0] === '@') {
// @ regex delimiter
$pattern = '`' . substr($route, 1) . '`u';
$match = preg_match($pattern, $requestUrl, $params) === 1;
} elseif (($position = strpos($route, '[')) === false) {
// No params in url, do string comparison
$match = strcmp($requestUrl, $route) === 0;
} else {
// Compare longest non-param string with url before moving on to regex
// Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241)
if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) {
continue;
}
$regex = $this->compileRoute($route);
$match = preg_match($regex, $requestUrl, $params) === 1;
}
if ($match) {
if ($params) {
foreach ($params as $key => $value) {
if (is_numeric($key)) {
unset($params[$key]);
}
}
}
return [
'target' => $target,
'params' => $params,
'name' => $name
];
}
}
return false;
}
/**
* Compile the regex for a given route (EXPENSIVE)
* @param $route
* @return string
*/
protected function compileRoute($route)
{
if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) {
$matchTypes = $this->matchTypes;
foreach ($matches as $match) {
list($block, $pre, $type, $param, $optional) = $match;
if (isset($matchTypes[$type])) {
$type = $matchTypes[$type];
}
if ($pre === '.') {
$pre = '\.';
}
$optional = $optional !== '' ? '?' : null;
//Older versions of PCRE require the 'P' in (?P<named>)
$pattern = '(?:'
. ($pre !== '' ? $pre : null)
. '('
. ($param !== '' ? "?P<$param>" : null)
. $type
. ')'
. $optional
. ')'
. $optional;
$route = str_replace($block, $pattern, $route);
}
}
return "`^$route$`u";
}
}

@ -1,5 +1,6 @@
<?php
namespace Config;
class Autoload
{
private static $instance = null;
@ -13,7 +14,7 @@ class Autoload
self::$instance = new self();
if (!spl_autoload_register(array(self::$instance, 'autoloader'), false)) {
if (!spl_autoload_register(array(self::$instance, 'autoloader'))) {
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
}
}

@ -1,6 +1,6 @@
<?php
namespace Config\DataManagement;
namespace Config;
class Clean
{

@ -0,0 +1,54 @@
<?php
namespace Config;
use PDO;
use PDOStatement;
/**
* Définit une connection à la base de données.
*/
class Connection extends PDO
{
/**
* @var PDOStatement
*/
private PDOStatement $stmt;
public function __construct(string $dsn, string $username, string $password)
{
parent::__construct($dsn, $username, $password);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
/**
* Éxécute une réquête SQL.
*
* @param string $query
* @param array $parameters
* @return bool Returns `true` on success, `false` otherwise
*/
public function executeQuery(string $query, array $parameters = []): bool
{
$this->stmt = parent::prepare($query);
foreach ($parameters as $name => $value) {
$this->stmt->bindValue($name, $value[0], $value[1]);
}
return $this->stmt->execute();
}
/**
* Permet de récupère le résultat de la dernière réquête éxecuté avec
* la fonction executeQuery().
*
* @return array
*/
public function getResults(): array
{
return $this->stmt->fetchAll();
}
}

@ -1,6 +1,6 @@
<?php
namespace Config\DataManagement;
namespace Config;
class Validate
{
@ -26,10 +26,10 @@ class Validate
* @return bool Vrai si le pseudo est valide, faux sinon.
*/
public static function pseudo(string $pseudo) : bool
public static function login(string $login) : bool
{
global $pseudoMaxLength;
return (strlen($pseudo) >= 3 && preg_match("#[a-zA-Z0-9]+#", $pseudo) && strlen($pseudo) <= $pseudoMaxLength);
global $loginMaxLength;
return (strlen($login) >= 3 && preg_match("#[a-zA-Z0-9]+#", $login) && strlen($login) <= $loginMaxLength);
}
/**
@ -98,4 +98,10 @@ class Validate
global $responseMaxLength;
return (strlen($response) <= $responseMaxLength);
}
public static function username(string $username): bool
{
global $usernameMaxLength;
return (strlen($username) >= 3 && preg_match("#[a-zA-Z0-9]+#", $username) && strlen($username) <= $usernameMaxLength);
}
}

@ -1,15 +1,24 @@
<?php
use Config\Connection;
$rep = __DIR__ . '/../';
$views['form'] = 'Views/HTML/form.php';
$views['admin'] = 'Views/HTML/admin.php';
$views['adminLogin'] = 'Views/HTML/adminLogin.php';
$views['possibleResponsesForm'] = 'Views/HTML/possibleResponsesForm.php';
$views['continue'] = 'Views/HTML/continue.php';
$views['categories'] = 'Views/HTML/categories.php';
$views['questions'] = 'Views/HTML/questions.php';
$views['responses'] = 'Views/HTML/responses.php';
$views['thanks'] = 'Views/HTML/thanks.php';
$_SERVER['BASE_URI'] = '';
$controller['Candidate'] = 'ControllerCandidate';
$controller['Admin'] = 'ControllerAdmin';
$googleApis = "https://fonts.googleapis.com";
$googleStatic = "https://fonts.gstatic.com";
@ -17,6 +26,21 @@ $poppins = "https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=sw
$icon = "https://cdn.uca.fr/images/favicon/favicon.ico";
$logoUCA = "https://cdn.uca.fr/images/logos/logo_uca_mini_light.png";
function connect()
{
$dsn = "mysql:host=localhost;dbname=formulaire;charset=utf8";
$login = "root";
try {
$connection = new Connection($dsn, $login, "root");
} catch (PDOException $e) {
http_response_code(404);
return http_response_code();
}
return $connection;
}
$emailMaxLength=150;
$pseudoMaxLength=50;
$passwordMaxLength=500;

@ -132,4 +132,10 @@ class ControllerAdmin
global $rep, $views;
require_once($rep.$views['responses']);
}
public function goToAdministration(): void
{
global $rep, $views;
require_once($rep.$views['admin']);
}
}

@ -3,6 +3,7 @@
namespace Controller;
use Model\ModelCandidate;
use Exception;
/**
* Permet de controller les réponses à fournir en fonction des actions passer dans l'URL
@ -23,6 +24,12 @@ class ControllerCandidate
require_once($rep.$views['form']);
}
public function goToAdminLogin(): void
{
global $rep, $views;
require_once($rep.$views['adminLogin']);
}
/**
* Permet de finaliser la saisie du formulaire et de le soumettre.
*
@ -31,5 +38,29 @@ class ControllerCandidate
public function submitForm(): void
{
(new ModelCandidate())->submitForm();
$this->goToThanks();
}
public function goToThanks(): void
{
global $rep, $views;
require_once($rep.$views['thanks']);
}
public function login() :void {
global $rep,$views;
try{
$model= new ModelCandidate();
$model->login();
if($_SESSION['role'] == "Admin") {
require_once($rep . $views['admin']);
}
else
{
require_once($rep . $views['adminLogin']);
}
} catch (Exception $e) {
$error = $e->getMessage();
require_once($rep . $views['adminLogin']);
}
}
}

@ -4,37 +4,73 @@ namespace Controller;
use Exception;
use PDOException;
use Config\DataManagement;
use Config\Validate;
use Config\Clean;
use Config\AltoRouter;
/**
* Permet de gérer l'appel des controllers en fonction de l'action et du rôle de l'utilisateur
*/
class FrontController
{
/**
* Définit le comportement de la classe à sa création, on appelle le bon controller en fonction de l'action
* et du rôle de la personne qui souhaite réaliser cette action (utilisateur, administrateur...).
*/
public function __construct()
{
$listControllers = array("\\Controller\\ControllerCandidate", "\\Controller\\ControllerAdmin");
global $rep, $views;
$dVueError = array();
class FrontController {
private $router;
private $rights;
public function __construct() {
$this->router = new AltoRouter();
$this->router->setBasePath($_SERVER['BASE_URI']);
$this->mapRoutes();
$this->rights = array (
'Candidate' => array('ControllerCandidate'),
'Admin' => array('ControllerCandidate','ControllerAdmin')
);
}
try {
$action = $_REQUEST['action'] ? $action = $_REQUEST['action'] : (new ControllerCandidate())->goToForm();
foreach ($listControllers as $controller) {
if (method_exists($controller, $action)) {
(new $controller)->$action(); // Si oui, on appelle cette fonction
public function run() {
global $error,$rep,$views;
$exists=false;
$match = $this->router->match();
if ($match) {
$target = $match['target'];
$params = $match['params'];
if(!isset($_SESSION['role'])) {
$_SESSION['role'] = 'Candidate';
}
$role = Clean::simpleString($_SESSION['role']);
foreach($this->rights[$role] as $controllerName) {
if(strcmp($controllerName,$target[0])===0) {
$controllerClass = '\Controller\\' . $target[0];
$controller = new $controllerClass();
$controller->{$target[1]}($params);
$exists=true;
}
}
} catch (PDOException|Exception $e) {
$dVueError[] = "Erreur innatendue !"; // Ecriture du message d'erreur
echo "ERREUUUUUR";
if(!$exists) {
$error = $error['403'];
require_once($rep . $views['error']);
}
} else {
// no route was matched
$error = $error['404'];
require_once($rep . $views['error']);
}
}
exit(0);
private function mapRoutes() {
global $controller;
$this->router->map('GET', '/', array($controller['Candidate'], 'goToForm'), 'goToForm');
$this->router->map('POST', '/submitForm', array($controller['Candidate'], 'submitForm'), 'submitForm');
$this->router->map('POST', '/addQuestion', array($controller['Admin'], 'addQuestion'), 'addQuestion');
$this->router->map('POST', '/addResponse', array($controller['Admin'], 'addResponse'), 'addResponse');
$this->router->map('POST','/continueResponse',array($controller['Admin'],'continueResponse'),'continueResponse');
$this->router->map('POST','/createForm',array($controller['Admin'],'createForm'),'createForm');
$this->router->map('POST','/addKeyword',array($controller['Admin'],'addKeyword'),'addKeyword');
$this->router->map('GET','/goToAdmin',array($controller['Admin'],'goToAdmin'),'goToAdmin');
$this->router->map('GET','/goToAdminLogin',array($controller['Candidate'],'goToAdminLogin'),'goToLogin');
$this->router->map('POST','/login',array($controller['Candidate'],'login'),'login');
$this->router->map('GET','/logout',array($controller['Admin'],'logout'),'logout');
$this->router->map('GET','/goToCategories',array($controller['Admin'],'goToCategories'),'goToCategories');
$this->router->map('GET','/goToQuestions',array($controller['Admin'],'goToQuestions'),'goToQuestions');
$this->router->map('GET','/goToResponses',array($controller['Admin'],'goToResponses'),'goToResponses');
}
}

@ -0,0 +1,13 @@
<?php
namespace Exceptions;
use Exception;
class InexistantLoginException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant inexistant");
}
}

@ -0,0 +1,12 @@
<?php
namespace Exceptions;
use Exception;
class InvalidLoginOrPasswordException extends Exception
{
public function __construct()
{
parent::__construct("Identifiant ou mot de passe invalide");
}
}

@ -0,0 +1,13 @@
<?php
namespace Exceptions;
use Exception;
class InvalidUsernameOrPasswordException extends Exception
{
public function __construct($message = "nom d'utilisateur ou mot de passe invalide", $code = 0, Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}

@ -19,6 +19,16 @@ class ModelAdmin
$this->client = new Client();
}
public function goToAdmin(): void
{
global $rep, $views;
try{
require_once($rep . $views['admin']);
} catch (PDOException $e) {
$error = $e->getMessage();
require_once($rep . $views['form']);
}
}
/**
* Permet de créer et d'ajouter une question et de retourner son ID afin de la
* reconnaitre facilement dans la suite du code.
@ -147,6 +157,14 @@ class ModelAdmin
*/
public function getQuestions(): array
{
if((new GatewayForm())->existsForm()) {
$idForm = (new GatewayForm())->getForm()[0]["id"];
$questionsArray = (new GatewayQuestion())->getAllQuestions($idForm);
return Factory::getBuiltObjects($questionsArray, "Question");
}
else {
return array();
}
try {
$res = $this->client->request('GET', 'https://codefirst.iut.uca.fr/containers/Temoignages-deploy_api_form/getForm');
$idForm = json_decode($res->getBody())[0]["id"];

@ -5,6 +5,12 @@ namespace Model;
use API\script\Gateway\GatewayForm;
use API\script\Gateway\GatewayListResponseOfCandidate;
use API\script\Gateway\GatewayQuestion;
use API\script\Gateway\GatewayAdmin;
use Config\Clean;
use Config\Validate;
use Exceptions\InvalidUsernameOrPasswordException;
use Exceptions\InvalidLoginOrPasswordException;
use Exceptions\InexistantLoginException;
/**
* Permet de développer les fonctions appelées par le controllerCandidate pour gérer
@ -30,7 +36,6 @@ class ModelCandidate
$answer = [];
$category = [];
$questionsId = [];
var_dump($answersAndCategories);
foreach ($answersAndCategories as $answerAndCategory) {
$exploded = explode("||",$answerAndCategory);
if( count($exploded) == 3 ){
@ -76,25 +81,38 @@ class ModelCandidate
$nbQuestions = count($questions);
$time = round(($nbQuestions * 20)/60);
$html = "
<h1>$title</h1>\n
<br>
<h3>$description</h3>\n
<br>
<h4><i>Temps estimé</i> : $time minutes</h4>
<div id='container_form'>\n
<form method='post'>\n";
$html = "<div class='container mt-5'>
<div class='row d-flex justify-content-center align-items-center'>
<div class='col-md-8'>
<form id='regForm' method='post'>
<h1 id='register'>$title</h1>
<div class='all-steps' id='all-steps'>";
for ($i = 0; $i < sizeof($questions); $i++) {
$html.= "<span class='step'><i class='fa'></i></span>";
}
$html.= "</div>";
foreach ($questions as $question) {
$html.= $question->printStrategy()."\n";
}
if (count($questions) > 0) {
$html.= "\t\t\t<input type='submit' value='Envoyer' id='button' style='margin-left: 45%'>\n
\t\t\t<input type='hidden' name='data_ids' value=''>
\t\t\t<input type='hidden' name='action' value='submitForm'>
\t\t</form>\n
\t</div><br><br><br>\n";
$html.= "<div class='thanks-message text-center' id='text-message'> <img src='https://i.imgur.com/O18mJ1K.png' width='100' class='mb-4'>
<h3>Souhaitez-vous envoyer vos réponses ?</span>
<input type='hidden' name='data_ids' value=''>
<input type='submit' value='Envoyer' id='button'>\n
<input type='hidden' name='action' value='submitForm'>
</div>
<div style='overflow:auto;' id='nextprevious'>
<div style='float:right;'>
<button type='button' id='prevBtn' onclick='nextPrev(-1)'><i class='fa fa-angle-double-left'></i></button>
<button type='button' id='nextBtn' onclick='nextPrev(1)'><i class='fa fa-angle-double-right'></i></button> </div>
</div>
</form>
</div>
</div>
</div>";
} else {
$html.= "\t\t</form>\n
\t</div>\n";
@ -102,4 +120,21 @@ class ModelCandidate
return $html;
}
public function login() :void {
global $rep,$views,$sel;
$password = Clean::simpleString($_REQUEST['password']);
$identifiant = Clean::simpleString($_REQUEST['login']);
$gatewayAdmin = new GatewayAdmin();
if (Validate::login($identifiant) && Validate::password($password)){
$passwordbdd=$gatewayAdmin->getPasswordWithLogin($identifiant);
if($passwordbdd==null) throw new InexistantLoginException();
if(password_verify($sel . $password,$passwordbdd)) {
$_SESSION['role'] = 'Admin';
} else {
$_SESSION['role'] = 'Visitor';
}
}
else throw new InvalidLoginOrPasswordException();
}
}

@ -0,0 +1,75 @@
.acolorba {
background-color: #006D82;
}
.logo {
width: auto;
height: 100px;
padding: 24px 0;
}
.card {
width: 450px;
margin: 0 auto;
background: white;
border-radius: 24px;
padding: 24px;
}
#main-content {
margin-right: 10px;
margin-left: 10px;
}
.content {
box-shadow: none !important;
}
input {
max-width: 350px;
padding: 12px 16px;
height: 48px;
background: #ffffff;
border: 1px solid #CACAC9;
border-radius: 12px;
color: #4A4A49;
}
h3 {
font-size: 24px;
line-height: 150%;
color: #6D6D6C;
text-align: center;
margin: 0 0 24px;
font-weight: bold;
}
body, p, span, div, a, h1, h2, h3, h4, h5, h6{
font-family: 'Barlow', sans-serif;
}
.margin-space {
margin: 12px;
}
button{
padding: 12px 32px;
background: #006D82 !important;
border-radius: 12px;
height: 48px;
border: none;
color: white;
font-weight: 700;
}
a {
text-decoration: none;
background-color: transparent;
color: #018786 !important;
margin: 10px;
font-weight: bold;
}
a:hover {
color: #006D82 !important;
}

@ -43,3 +43,9 @@ h1 {
.hidden-content {
visibility: hidden;
}
.button-continue {
border-radius: 10px;
width: 1rem;
color: red;
}

@ -0,0 +1,124 @@
body {
background: #eee
}
#regForm {
background-color: #ffffff;
margin: 0px auto;
font-family: Poppins;
padding: 40px;
border-radius: 30px;
background-color: rgba(23,143,150,0.7);
}
#register{
color: white;
}
h1 {
text-align: center;
font-family: Poppins;
}
h6 {
font-size: 1.5rem;
}
input {
padding: 10px;
width: 100%;
font-size: 17px;
font-family: Raleway;
border: 1px solid #aaaaaa;
border-radius: 10px;
-webkit-appearance: none;
}
.tab input:focus{
border:1px solid #6a1b9a !important;
outline: none;
}
input.invalid {
border:1px solid #e03a0666;
}
.tab {
display: none
}
button {
background-color: #6A1B9A;
color: #ffffff;
border: none;
border-radius: 50%;
padding: 10px 20px;
font-size: 17px;
font-family: Raleway;
cursor: pointer
}
button:hover {
opacity: 0.8
}
button:focus{
outline: none !important;
}
#prevBtn {
background-color: #bbbbbb
}
.all-steps{
text-align: center;
margin-top: 30px;
margin-bottom: 30px;
width: 100%;
display: inline-flex;
justify-content: center;
}
.step {
height: 10px;
width: 10px;
margin: 0 2px;
background-color: #bbbbbb;
border: none;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 15px;
color: #6a1b9a;
opacity: 0.5;
}
.step.active {
opacity: 1
}
.step.finish {
color: #fff;
background: green;
opacity: 1;
}
.all-steps {
text-align: center;
margin-top: 30px;
margin-bottom: 30px
}
.thanks-message {
display: none
}

File diff suppressed because it is too large Load Diff

@ -2,31 +2,106 @@
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
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>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<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">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</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>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container mt-5">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-md-8">
<form id="regForm" method="post">
<h1 id="register">Ajout d'une question</h1>
<div class="all-steps" id="all-steps">
<span class="step"><i class="fa"></i></span>
<span class="step"><i class="fa"></i></span>
</div>
<div class="tab">
<h6>Écrivez la question : </h6>
<p>
<input placeholder="Question..." oninput="this.className = ''" name="question">
</p>
</div>
<div class="tab">
<h6>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.</h6>
<select name="type">
<p> <option value="BusinessClass\TextQuestion">Text</option> </p>
<p> <option value="BusinessClass\ListBoxQuestion">ListBox</option> </p>
<p> <option value="BusinessClass\CheckBoxQuestion">CheckBox</option> </p>
</select>
</div>
<div class="thanks-message text-center" id="text-message"> <img src="https://i.imgur.com/O18mJ1K.png" width="100" class="mb-4">
<h3>Souhaitez-vous ajouter votre question ?</h3>
<input type='submit' value='Ajouter' id='button'>
<input type='hidden' name='action' value='addQuestion'>
</div>
<div style="overflow:auto;" id="nextprevious">
<div style="float:right;">
<button type="button" id="prevBtn" onclick="nextPrev(-1)"><i class="fa fa-angle-double-left"></i></button>
<button type="button" id="nextBtn" onclick="nextPrev(1)"><i class="fa fa-angle-double-right"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
<br><br>
<script src="Views/JS/form_category.js"></script>
<script src="Views/JS/form_question.js"></script>
<script src="Views/JS/constant.js"></script>
<footer class="py-5 bg-white">
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>
</html>

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.grid-min.css">
<link rel="stylesheet" href="Views\CSS\adminLogin.css">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow&display=swap" rel="stylesheet">
</head>
<body class="acolorba d-flex flex-column align-items-center">
<img src="Views\IMAGES\logoUca.png" class="logo">
<article class="card">
<main id="main-content">
<section id="content">
<form method="post" action="login" class="d-flex flex-column align-items-center">
<h3>Service d'authentification</h3>
<div id="adminRegistrationErrorPanel" class="margin-space">
<?php
if (isset($error)) {
echo $error;
}
?>
</div>
<label class="margin-space" for="login">
<input type="text" name="login" id="login" placeholder="Identifiant" required>
</label>
<label class="margin-space" for="password">
<input type="password" name="password" id="password" placeholder="Mot de passe" required>
</label>
<button class="margin-space" name="submitBtn" type="submit">Se connecter</button>
</form>
</section>
</main>
</article>
</body>
</html>

@ -20,9 +20,9 @@
<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>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

@ -1,36 +1,72 @@
<!DOCTYPE html>
<html lang="en">
<!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>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<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">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<h1>Administration</h1>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="form-center">
<h2>Continuer d'ajouter des possibilités de réponses ?</h2>
<form method="post">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<div class="text-center">
<h2>Continuer d'ajouter des possibilités de réponses ?</h2>
<form method="post">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<br>
<input type="submit" name="choose" value="Oui" style="width: 20%">
<br>
<input type="submit" name="choose" value="Non" style="width: 20%">
<input type="hidden" name="action" value="continueResponse">
</form>
</div>
<input type="submit" name="choose" value="Oui">
<input type="submit" name="choose" value="Non">
<input type="hidden" name="action" value="continueResponse">
</form>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>

@ -0,0 +1,9 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/common.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<body class="d-flex flex-column align-items-center">
<h1><?php echo $error ?></h1>
</body>
</html>

@ -2,27 +2,44 @@
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/form.css" />
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="stylesheet" href="Views/CSS/styles.css" />
<link rel="stylesheet" href="Views/CSS/stylesForm.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" 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>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<?php //echo $html; ?>
<?php echo $html; ?>
<br><br>
<footer class="py-5 bg-white">
</footer>
</body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/JS/scripts.js"></script>
<script src="Views/JS/getData-Ids.js"></script>
<script src="Views/JS/getData-Ids.js"></script>
</body>
</html>

@ -5,52 +5,104 @@
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>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="" />
<meta name="author" content="" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="Views/css/styles.css" rel="stylesheet" />
<link href="Views/css/stylesForm.css" rel="stylesheet" />
<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">
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<title>Formulaire de témoignage</title>
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<h1>Administration</h1>
<div class="form-center">
<form method="post">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<p>Votre question : <?php echo $questionContent; ?></p>
<br><br>
<label for="response">Entrez une réponse : </label>
<input id="response" name="response" type="text" size="50">
<br><br><br>
<label>Séléctionnez les catégories associées à cette réponse : </label>
<br><br>
<?php
foreach ($categories as $category) {
?>
<li><label for="category"><?php echo $category ?></label>
<input id="category" type="checkbox" name="categories[]" value="<?php echo $category ?>">
<?php
}
?>
<br><br>
<input type="submit" value="Ajouter la réponse">
<input type="hidden" name="action" value="addResponse">
</form>
</div>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Administration</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link" href="index.php?action=GoToAddTestimony">Témoignages</a>
</li>
</ul>
</div>
</div>
</nav>
</body>
<div class="container mt-5">
<div class="row d-flex justify-content-center align-items-center">
<div class="col-md-8">
<form id="regForm" method="post">
<input name="idQuestion" type="hidden" value="<?php echo $idQuestion; ?>">
<input name="question" type="hidden" value="<?php echo $questionContent; ?>">
<input name="type" type="hidden" value="<?php echo $type; ?>">
<h1 id="register">Ajout de réponse possible pour votre question : <?php echo $questionContent;?> </h1>
<div class="all-steps" id="all-steps">
<span class="step"><i class="fa"></i></span>
<span class="step"><i class="fa"></i></span>
</div>
<script src="Views/JS/possibleResponses.js"></script>
<div class="tab">
<h6>Entrez une réponse : </h6>
<p>
<input placeholder="Réponse..." oninput="this.className = ''" name="response">
</p>
</div>
<div class="tab">
<h6>Séléctionnez les catégories associées à cette réponse : </h6>
<?php foreach ($categories as $category) { ?>
<p>
<label for="category"><?php echo $category ?></label>
<input style='-webkit-appearance: checkbox;' id="category" type="checkbox" name="categories[]" value="<?php echo $category ?>">
</p>
<?php } ?>
</div>
<div class="thanks-message text-center" id="text-message"> <img src="https://i.imgur.com/O18mJ1K.png" width="100" class="mb-4">
<h3>Souhaitez-vous ajouter votre réponse ?</h3>
<input type='submit' value='Ajouter' id='button'>
<input type='hidden' name='action' value='addResponse'>
</div>
<div style="overflow:auto;" id="nextprevious">
<div style="float:right;">
<button type="button" id="prevBtn" onclick="nextPrev(-1)"><i class="fa fa-angle-double-left"></i></button>
<button type="button" id="nextBtn" onclick="nextPrev(1)"><i class="fa fa-angle-double-right"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
<br><br>
<footer class="py-5 bg-white">
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/js/scripts.js"></script>
</body>
</html>

@ -20,9 +20,9 @@
<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>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

@ -20,9 +20,9 @@
<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>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/styles.css" />
<link rel="stylesheet" href="Views/CSS/stylesForm.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" 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>
<header class="py-1">
<div class="container px-4 px-lg-5 my-5">
<div class="text-center text-white">
<h1 class="display-4 fw-bolder">Les Témoignages</h1>
<p class="lead fw-normal text-white-50 mb-0">IUT Informatique de Clermont-Ferrand</p>
</div>
</div>
</header>
<div class='container mt-5'>
<div class='row d-flex justify-content-center align-items-center'>
<div class='col-md-8'>
<div class="text-center">
<h2>Merci d'avoir participé à ce questionnaire !</h2>
<p>Nous vous recontacterons si votre profil nous intéresse.</p>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="Views/JS/scripts.js"></script>
<script src="Views/JS/getData-Ids.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@ -0,0 +1,68 @@
var currentTab = 0;
document.addEventListener("DOMContentLoaded", function(event) {
showTab(currentTab);
});
function showTab(n) {
var x = document.getElementsByClassName("tab");
x[n].style.display = "block";
if (n == 0) {
document.getElementById("prevBtn").style.display = "none";
} else {
document.getElementById("prevBtn").style.display = "inline";
}
if (n == (x.length - 1)) {
document.getElementById("nextBtn").innerHTML = '<i class="fa fa-angle-double-right"></i>';
} else {
document.getElementById("nextBtn").innerHTML = '<i class="fa fa-angle-double-right"></i>';
}
fixStepIndicator(n)
}
function nextPrev(n) {
var x = document.getElementsByClassName("tab");
if (n == 1 && !validateForm()) return false;
x[currentTab].style.display = "none";
currentTab = currentTab + n;
if (currentTab >= x.length) {
document.getElementById("nextprevious").style.display = "none";
document.getElementById("all-steps").style.display = "none";
document.getElementById("register").style.display = "none";
document.getElementById("text-message").style.display = "block";
}
showTab(currentTab);
}
function validateForm() {
var x, y, i, valid = true;
x = document.getElementsByClassName("tab");
y = x[currentTab].getElementsByTagName("input");
for (i = 0; i < y.length; i++) {
if (y[i].value == "") {
y[i].className += " invalid";
valid = false;
}
}
if (valid) {
document.getElementsByClassName("step")[currentTab].className += " finish";
}
return valid;
}
function fixStepIndicator(n) {
var i, x = document.getElementsByClassName("step");
for (i = 0; i < x.length; i++) {
x[i].className = x[i].className.replace(" active", "");
}
x[n].className += " active";
}

@ -1,8 +1,9 @@
<?php
use Controller\FrontController;
use Config\Autoload;
require_once(__DIR__ . "/API/script/Config/config.php");
require_once(__DIR__.'/Config/Autoload.php');
require_once(__DIR__.'/Config/config.php');
require_once(__DIR__.'/Config/Autoload.php');
Autoload::charger();
@ -10,3 +11,4 @@ Autoload::charger();
session_start();
$frontController = new FrontController();
$frontController->run();

Loading…
Cancel
Save