getForm()[0]["title"]; (new GatewayListResponseOfCandidate())->insertListResponsesOfCandidate($questionsId, $answer, $category, $title); } /** * Permet de récupérer le code html à afficher dans la page du formulaire, * on récupère donc le formulaire et toutes les questions qu'il contient. * On les traduits en code HTML puis on le retourne. On utilise une Factory * pour récupèrer les questions. * * @return string */ public function getForm(): string { $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 = Factory::getBuiltObjects($questionsTab, "Question"); $nbQuestions = count($questions); $time = round(($nbQuestions * 20)/60); $html = "

$title

"; for ($i = 0; $i < sizeof($questions); $i++) { $html.= ""; } $html.= "
"; foreach ($questions as $question) { $html.= $question->printStrategy()."\n"; } if (count($questions) > 0) { $html.= "

Souhaitez-vous envoyer vos réponses ? \n

"; } else { $html.= "\t\t\n \t\n"; } return $html; } public function login() :void { $password = $_REQUEST['password']; $identifiant = $_REQUEST['login']; $passwordbdd = (new GatewayAdmin())->getPasswordWithLogin($identifiant); if (strcmp($password, $passwordbdd) == 0) { $_SESSION['role'] = 'Admin'; } else { $_SESSION['role'] = 'Visitor'; } } }