Correction du get des
continuous-integration/drone/push Build is passing Details

questions si le formulaire est vide
interestingProfiles
Johan LACHENAL 2 years ago
parent 0cbe16a3c1
commit 5a460e70da

@ -11,4 +11,7 @@ RewriteRule ^createForm$ index.php?page=createForm [L]
RewriteRule ^addKeyword$ index.php?page=addKeyword [L]
RewriteRule "goToAdmin" index.php?page=goToAdmin [L]
RewriteRule ^goToAdminLogin$ index.php?page=goToAdminLogin [L]
RewriteRule ^login$ index.php?page=login [L]
RewriteRule ^login$ index.php?page=login [L]
RewriteRule ^goToCategories$ index.php?page=goToCategories [L]
RewriteRule ^goToQuestions$ index.php?page=goToQuestions [L]
RewriteRule ^goToResponses$ index.php?page=goToResponses [L]

@ -108,4 +108,11 @@ class GatewayForm
':id' => array($form->getId(), PDO::PARAM_INT)
));
}
public function existsForm(): bool
{
$query = "SELECT * FROM Form";
$this->connection->executeQuery($query);
return !empty($this->connection->getResults());
}
}

@ -68,5 +68,9 @@ class FrontController {
$this->router->map('GET','/goToAdmin',array($controller['Admin'],'goToAdmin'),'goToAdmin');
$this->router->map('GET','/goToAdminLogin',array($controller['Candidate'],'goToAdminLogin'),'goToLogin');
$this->router->map('POST','/login',array($controller['Candidate'],'login'),'login');
$this->router->map('GET','/logout',array($controller['Admin'],'logout'),'logout');
$this->router->map('GET','/goToCategories',array($controller['Admin'],'goToCategories'),'goToCategories');
$this->router->map('GET','/goToQuestions',array($controller['Admin'],'goToQuestions'),'goToQuestions');
$this->router->map('GET','/goToResponses',array($controller['Admin'],'goToResponses'),'goToResponses');
}
}

@ -113,9 +113,14 @@ class ModelAdmin
*/
public function getQuestions(): array
{
$idForm = (new GatewayForm())->getForm()[0]["id"];
$questionsArray = (new GatewayQuestion())->getAllQuestions($idForm);
return Factory::getBuiltObjects($questionsArray, "Question");
if((new GatewayForm())->existsForm()) {
$idForm = (new GatewayForm())->getForm()[0]["id"];
$questionsArray = (new GatewayQuestion())->getAllQuestions($idForm);
return Factory::getBuiltObjects($questionsArray, "Question");
}
else {
return array();
}
}

@ -19,9 +19,9 @@
<h1>Administration</h1>
<div class="form-center">
<a href="index.php?action=goToCategories">Les catégories</a>
<a href="index.php?action=goToQuestions">Les questions</a>
<a href="index.php?action=goToResponses">Les réponses</a>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
</body>

@ -20,9 +20,9 @@
<h1>Administration</h1>
<div class="form-center">
<a href="index.php?action=goToCategories">Les catégories</a>
<a href="index.php?action=goToQuestions">Les questions</a>
<a href="index.php?action=goToResponses">Les réponses</a>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

@ -20,9 +20,9 @@
<h1>Administration</h1>
<div class="form-center">
<a href="index.php?action=goToCategories">Les catégories</a>
<a href="index.php?action=goToQuestions">Les questions</a>
<a href="index.php?action=goToResponses">Les réponses</a>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

@ -20,9 +20,9 @@
<h1>Administration</h1>
<div class="form-center">
<a href="index.php?action=goToCategories">Les catégories</a>
<a href="index.php?action=goToQuestions">Les questions</a>
<a href="index.php?action=goToResponses">Les réponses</a>
<a href="goToCategories">Les catégories</a>
<a href="goToQuestions">Les questions</a>
<a href="goToResponses">Les réponses</a>
</div>
<br>

Loading…
Cancel
Save