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 { global $rep,$views,$sel; $password = Clean::simpleString($_REQUEST['password']); $identifiant = Clean::simpleString($_REQUEST['login']); $gatewayAdmin = new GatewayAdmin(); if (Validate::login($identifiant) && Validate::password($password)){ $passwordbdd=$gatewayAdmin->getPasswordWithLogin($identifiant); if($passwordbdd==null) throw new InexistantLoginException(); if(password_verify($sel . $password,$passwordbdd)) { $_SESSION['role'] = 'Admin'; } else { $_SESSION['role'] = 'Visitor'; } } else throw new InvalidLoginOrPasswordException(); } }