diff --git a/Source/BusinessClass/CheckBoxQuestion.php b/Source/BusinessClass/CheckBoxQuestion.php index 389da16..a12ac70 100644 --- a/Source/BusinessClass/CheckBoxQuestion.php +++ b/Source/BusinessClass/CheckBoxQuestion.php @@ -14,7 +14,7 @@ class CheckBoxQuestion extends BoxQuestion parent::__construct($args[0], $args[1], $args[2], $args[3]); break; case 2: - parent::__construct($args[3], $args[1]); + parent::__construct($args[0], $args[1]); break; default: break; diff --git a/Source/BusinessClass/TextQuestion.php b/Source/BusinessClass/TextQuestion.php index 8dab852..da01010 100644 --- a/Source/BusinessClass/TextQuestion.php +++ b/Source/BusinessClass/TextQuestion.php @@ -8,7 +8,7 @@ class TextQuestion extends Question * @param string $content * @param int $id */ - public function __construct(string $content, int $id) + public function __construct(int $id, string $content) { parent::__construct($id, $content); } diff --git a/Source/Controller/ControllerAdmin.php b/Source/Controller/ControllerAdmin.php index e410c3b..2a0697a 100644 --- a/Source/Controller/ControllerAdmin.php +++ b/Source/Controller/ControllerAdmin.php @@ -7,6 +7,7 @@ use Model\ModelAdmin; class ControllerAdmin { public function addQuestion(): void + { global $rep, $views; @@ -15,15 +16,26 @@ class ControllerAdmin $questionContent = $_POST['question']; $type = $_POST['type']; - require_once($rep.$views['possibleResponsesForm']); - } + if(strcmp($type, "BusinessClass\TextQuestion") == 0) + { + $this->goToAdminPage(); + } + else + { + require_once($rep.$views['possibleResponsesForm']); + } + + } public function addResponse(): void { (new ModelAdmin())->addResponse(); global $rep, $views; $idQuestion = $_POST['idQuestion']; + $categories = (new ModelAdmin())->getCategories(); + $questionContent = $_POST['question']; + $type = $_POST['type']; require_once($rep.$views['continue']); } @@ -31,13 +43,16 @@ class ControllerAdmin { global $rep, $views; - $idQuestion = $_POST['idQuestion']; $choose = $_POST['choose']; if($choose == "Oui") { + $idQuestion = $_POST['idQuestion']; + $categories = (new ModelAdmin())->getCategories(); + $questionContent = $_POST['question']; + $type = $_POST['type']; require_once($rep.$views['possibleResponsesForm']); } else { - require_once($rep.$views['']); + $this->goToAdminPage(); } } diff --git a/Source/Model/FactoryQuestion.php b/Source/Model/FactoryQuestion.php index 9723d60..9dda457 100644 --- a/Source/Model/FactoryQuestion.php +++ b/Source/Model/FactoryQuestion.php @@ -13,7 +13,7 @@ class FactoryQuestion extends Factory if ($results[0] != null) { for ($i = 0; $i < count($results[0]); $i++) { if (strcmp($results[0][$i]['type'], "BusinessClass\TextQuestion") == 0) { - $questions[] = new TextQuestion($results[0][$i]['content'], $results[0][$i]['id']); + $questions[] = new TextQuestion($results[0][$i]['id'], $results[0][$i]['content']); } else { $possiblesResponses = $results[1][$i]; $content = $results[0][$i]['content']; diff --git a/Source/Views/HTML/continue.php b/Source/Views/HTML/continue.php index d5f2673..9ac75e0 100644 --- a/Source/Views/HTML/continue.php +++ b/Source/Views/HTML/continue.php @@ -73,6 +73,8 @@

Continuer d'ajouter des possibilités de réponses ?

+ + diff --git a/Source/Views/HTML/possibleResponsesForm.php b/Source/Views/HTML/possibleResponsesForm.php index b1a53e5..4c39346 100644 --- a/Source/Views/HTML/possibleResponsesForm.php +++ b/Source/Views/HTML/possibleResponsesForm.php @@ -72,6 +72,8 @@
+ +

Votre question :