You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.5 KiB
79 lines
2.5 KiB
<?php
|
|
|
|
namespace Model;
|
|
|
|
use API\script\Gateway\GatewayForm;
|
|
use API\script\Gateway\GatewayQuestion;
|
|
use BusinessClass\TextQuestion;
|
|
|
|
class ModelCandidate
|
|
{
|
|
public function submitForm(): void
|
|
{
|
|
// TODO: Implement submitForm() method.
|
|
}
|
|
|
|
public function getForm(): string
|
|
{
|
|
/*
|
|
$title = "Candidature à un témoignage";
|
|
$description = "Ce formulaire vous permet de candidater à un potentiel témoignage vidéo.";
|
|
$questions = array(
|
|
new TextQuestion("Décrivez-nous votre parcours en quelques lignes :"),
|
|
new ListBoxQuestion(array("Oui", "Non"), "Êtes-vous originaire de Clermont et ses alentours ? (- de 2 heures de trajet)", array(array("Clermont"), array("OrigineLointaine"))),
|
|
new ListBoxQuestion(array("BAC Général", "BAC Pro", "Étude supérieure"), "Quel étude avez-vous réalisé avant l'IUT?", array(array("Général"), array("Pro"), array("EtudSupp"))),
|
|
new CheckBoxQuestion(array("Mathématiques", "Web", "Mobile", "Gestion"), "Quels matières appréciez-vous ?", array(array("Maths", "Maths2", "Maths3"), array("Web"), array(""), array("Gestion", "Gestion2"))),
|
|
);
|
|
$form = new Form($title, $description, $questions);
|
|
*/
|
|
|
|
|
|
$form = (new GatewayForm())->getForm();
|
|
if(empty($form))
|
|
{
|
|
return "PAS DE FORMULAIRE\n";
|
|
}
|
|
|
|
|
|
$title = $form[0]['title'];
|
|
$description = $form[0]['description'];
|
|
$questionsTab = (new GatewayQuestion())->getAllQuestions($form[0]['id']);
|
|
|
|
$questions = [];
|
|
|
|
for($i = 0; $i < count($questionsTab[0]); $i++)
|
|
{
|
|
if(strcmp($questionsTab[0][$i]['type'], "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);
|
|
}
|
|
}
|
|
|
|
$html = "
|
|
<h1>$title</h1>\n
|
|
<h3>$description</h3>\n
|
|
<div id='container_form'>\n
|
|
<form>\n";
|
|
|
|
|
|
foreach ($questions as $question)
|
|
{
|
|
$html.= $question->printStrategy()."\n";
|
|
}
|
|
|
|
$html.= "\t\t</form>\n
|
|
\t</div>\n";
|
|
|
|
return $html;
|
|
}
|
|
} |