diff --git a/Source/API/script/Gateway/GatewayListResponseOfCandidate.php b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php index 7862ea0..74c19a7 100644 --- a/Source/API/script/Gateway/GatewayListResponseOfCandidate.php +++ b/Source/API/script/Gateway/GatewayListResponseOfCandidate.php @@ -58,7 +58,7 @@ class GatewayListResponseOfCandidate )); } - public function insertListResponsesOfCandidate($id, $answer, $category, $titleForm) + public function insertListResponsesOfCandidate($id, $answer, $category, $titleForm): void { $gatewayResponse = new GatewayResponse(); $gatewayQuestion = new GatewayQuestion(); diff --git a/Source/BusinessClass/BoxQuestion.php b/Source/BusinessClass/BoxQuestion.php index 0919c48..58628ff 100644 --- a/Source/BusinessClass/BoxQuestion.php +++ b/Source/BusinessClass/BoxQuestion.php @@ -33,15 +33,6 @@ abstract class BoxQuestion extends Question } } - - /** - * Permet de définir la manière donc la réponse doit être traitée - * - * @return void - */ - abstract public function responseStrategy(); - - /** * Permet de définir la manière dont la question doit s'afficher en HTML. * diff --git a/Source/BusinessClass/CheckBoxQuestion.php b/Source/BusinessClass/CheckBoxQuestion.php index a0fcf5c..ef132e8 100644 --- a/Source/BusinessClass/CheckBoxQuestion.php +++ b/Source/BusinessClass/CheckBoxQuestion.php @@ -13,17 +13,6 @@ class CheckBoxQuestion extends BoxQuestion } - /** - * Permet de définir la manière donc la réponse doit être traitée - * - * @return void - */ - public function responseStrategy(): void - { - echo "Implement responseStrategy() method."; - } - - /** * Permet de définir la manière dont la question doit s'afficher en HTML. * @@ -36,11 +25,11 @@ class CheckBoxQuestion extends BoxQuestion $possibleResponses = $this->getPossibleResponses(); $categories = $this->getCategories(); - $html = "\t\t\t
+ $html = "\t\t\t
\n"; for ($i = 0; $i < count($possibleResponses); $i++) { - $categoriesSplit = $id."#".$possibleResponses[$i]."||"; + $categoriesSplit = $possibleResponses[$i]."||"; foreach ($categories[$i] as $category) { $categoriesSplit.= $category."_"; } diff --git a/Source/BusinessClass/IResponseProcessingStrategy.php b/Source/BusinessClass/IResponseProcessingStrategy.php deleted file mode 100644 index 51b60a9..0000000 --- a/Source/BusinessClass/IResponseProcessingStrategy.php +++ /dev/null @@ -1,16 +0,0 @@ -word = $word; } + /** * @return string */ diff --git a/Source/BusinessClass/ListBoxQuestion.php b/Source/BusinessClass/ListBoxQuestion.php index f3f460f..f23df5e 100644 --- a/Source/BusinessClass/ListBoxQuestion.php +++ b/Source/BusinessClass/ListBoxQuestion.php @@ -13,17 +13,6 @@ class ListBoxQuestion extends BoxQuestion } - /** - * Permet de définir la manière donc la réponse doit être traitée - * - * @return void - */ - public function responseStrategy(): void - { - echo "Implement responseStrategy() method."; - } - - /** * Permet de définir la manière dont la question doit s'afficher en HTML. * @@ -36,12 +25,12 @@ class ListBoxQuestion extends BoxQuestion $possibleResponses = $this->getPossibleResponses(); $categories = $this->getCategories(); - $html = "\t\t\t
+ $html = "\t\t\t
+
\n"; } } diff --git a/Source/Config/config.php b/Source/Config/config.php index e7d33c3..88f8e4d 100644 --- a/Source/Config/config.php +++ b/Source/Config/config.php @@ -8,6 +8,12 @@ $views['admin'] = 'Views/HTML/admin.php'; $views['possibleResponsesForm'] = 'Views/HTML/possibleResponsesForm.php'; $views['continue'] = 'Views/HTML/continue.php'; +$googleApis = "https://fonts.googleapis.com"; +$googleStatic = "https://fonts.gstatic.com"; +$poppins = "https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap"; +$icon = "https://cdn.uca.fr/images/favicon/favicon.ico"; +$logoUCA = "https://cdn.uca.fr/images/logos/logo_uca_mini_light.png"; + $emailMaxLength=150; $pseudoMaxLength=50; $passwordMaxLength=500; diff --git a/Source/Controller/ControllerAdmin.php b/Source/Controller/ControllerAdmin.php index 106c1e9..dcf4d89 100644 --- a/Source/Controller/ControllerAdmin.php +++ b/Source/Controller/ControllerAdmin.php @@ -20,10 +20,10 @@ class ControllerAdmin public function addQuestion(): void { $type = $_POST['type']; + $idQuestion = (new ModelAdmin())->addQuestion(); if (strcmp($type, "BusinessClass\TextQuestion") == 0) { $this->goToAdminPage(); } else { - $idQuestion = (new ModelAdmin())->addQuestion(); $categories = (new ModelAdmin())->getCategories(); $questionContent = $_POST['question']; global $rep, $views; @@ -106,5 +106,6 @@ class ControllerAdmin public function addKeyword(): void { (new ModelAdmin())->addKeyword(); + $this->goToAdminPage(); } } diff --git a/Source/Model/ModelAdmin.php b/Source/Model/ModelAdmin.php index 5e5ac26..0033431 100644 --- a/Source/Model/ModelAdmin.php +++ b/Source/Model/ModelAdmin.php @@ -45,6 +45,9 @@ class ModelAdmin $idQuestion = $_POST['idQuestion']; $response = $_POST['response']; $categories = $_POST['categories']; + if($categories == null) { + $categories = []; + } (new GatewayQuestion())->insertResponseInQuestion($response, $categories, $idQuestion); } diff --git a/Source/Model/ModelCandidate.php b/Source/Model/ModelCandidate.php index 962e17b..708269b 100644 --- a/Source/Model/ModelCandidate.php +++ b/Source/Model/ModelCandidate.php @@ -20,14 +20,17 @@ class ModelCandidate public function submitForm(): void { $answersAndCategories = $_POST['answers']; + $dataIds = null; + + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'submitForm') { + $dataIdsJson = $_POST['data_ids']; + $dataIds = json_decode($dataIdsJson); + } - $id = []; $answer = []; $category = []; foreach ($answersAndCategories as $answerAndCategory) { - $idAndAnswer = explode("||", $answerAndCategory)[0]; - $id[] = explode("#", $idAndAnswer)[0]; - $answer[] = explode("#", $idAndAnswer)[1]; + $answer[] = explode("||", $answerAndCategory)[0]; $categs = explode("||", $answerAndCategory)[1]; $categs = explode("_", $categs); array_pop($categs); @@ -35,7 +38,7 @@ class ModelCandidate } $titleForm = (new GatewayForm())->getForm()[0]["title"]; - (new GatewayListResponseOfCandidate())->insertListResponsesOfCandidate($id, $answer, $category, $titleForm); + (new GatewayListResponseOfCandidate())->insertListResponsesOfCandidate($dataIds, $answer, $category, $titleForm); } @@ -72,6 +75,7 @@ class ModelCandidate if (count($questions) > 0) { $html.= "\t\t\t\n +\t\t\t \t\t\t \t\t\n \t
\n"; diff --git a/Source/Views/HTML/form.php b/Source/Views/HTML/form.php index 1000746..0c5aa27 100644 --- a/Source/Views/HTML/form.php +++ b/Source/Views/HTML/form.php @@ -23,4 +23,16 @@ + + diff --git a/Source/Views/JS/getData-Ids.js b/Source/Views/JS/getData-Ids.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Source/Views/JS/getData-Ids.js @@ -0,0 +1 @@ +