diff --git a/Source/Model/Factory.php b/Source/Model/Factory.php new file mode 100644 index 0000000..1b38731 --- /dev/null +++ b/Source/Model/Factory.php @@ -0,0 +1,16 @@ +create($results); + } +} \ No newline at end of file diff --git a/Source/Model/FactoryQuestion.php b/Source/Model/FactoryQuestion.php new file mode 100644 index 0000000..1192df1 --- /dev/null +++ b/Source/Model/FactoryQuestion.php @@ -0,0 +1,33 @@ +getAllQuestions($form[0]['id']); - $questions = []; - - for($i = 0; $i < count($questionsTab[0]); $i++) - { - if(strcmp($questionsTab[0][$i]['type'], "BusinessClass\TextQuestion") == 0) - { - $questions[] = new TextQuestion($questionsTab[0][$i]['content'], $questionsTab[0][$i]['id']); - } - else - { - $possiblesResponses = $questionsTab[1][$i]; - $content = $questionsTab[0][$i]['content']; - - $categories = $questionsTab[2][$i]; - - $id = $questionsTab[0][$i]['id']; - - $questions[] = new $questionsTab[0][$i]['type']($possiblesResponses, $content, $categories, $id); - } - } + $questions = Factory::getBuiltObjects($questionsTab, "Question"); $html = "

$title

\n