Add a menu into Administration View
continuous-integration/drone/push Build is passing Details

interestingProfiles
Alexis 2 years ago
parent af0fe2fe0d
commit 0c9fa8e0ec

@ -7,6 +7,9 @@ $views['form'] = 'Views/HTML/form.php';
$views['admin'] = 'Views/HTML/admin.php'; $views['admin'] = 'Views/HTML/admin.php';
$views['possibleResponsesForm'] = 'Views/HTML/possibleResponsesForm.php'; $views['possibleResponsesForm'] = 'Views/HTML/possibleResponsesForm.php';
$views['continue'] = 'Views/HTML/continue.php'; $views['continue'] = 'Views/HTML/continue.php';
$views['categories'] = 'Views/HTML/categories.php';
$views['questions'] = 'Views/HTML/questions.php';
$views['responses'] = 'Views/HTML/responses.php';
$googleApis = "https://fonts.googleapis.com"; $googleApis = "https://fonts.googleapis.com";
$googleStatic = "https://fonts.gstatic.com"; $googleStatic = "https://fonts.gstatic.com";

@ -22,7 +22,7 @@ class ControllerAdmin
$type = $_POST['type']; $type = $_POST['type'];
$idQuestion = (new ModelAdmin())->addQuestion(); $idQuestion = (new ModelAdmin())->addQuestion();
if (strcmp($type, "BusinessClass\TextQuestion") == 0) { if (strcmp($type, "BusinessClass\TextQuestion") == 0) {
$this->goToAdminPage(); $this->goToQuestions();
} else { } else {
$categories = (new ModelAdmin())->getCategories(); $categories = (new ModelAdmin())->getCategories();
$questionContent = $_POST['question']; $questionContent = $_POST['question'];
@ -67,7 +67,7 @@ class ControllerAdmin
global $rep, $views; global $rep, $views;
require_once($rep.$views['possibleResponsesForm']); require_once($rep.$views['possibleResponsesForm']);
} else { } else {
$this->goToAdminPage(); $this->goToQuestions();
} }
} }
@ -84,32 +84,52 @@ class ControllerAdmin
/** /**
* Permet de naviguer jusqu'à la page d'admninistration principale. On retrouve la gestion * Permet d'ajouter une catégories (mot-clef) à notre application
* des données de notre application
* *
* @return void * @return void
*/ */
public function goToAdminPage(): void public function addKeyword(): void
{
(new ModelAdmin())->addKeyword();
$this->goToCategories();
}
/**
* Permet de naviguer jusqu'à la page de gestion des catégories
*
* @return void
*/
public function goToCategories(): void
{ {
$categories = (new ModelAdmin())->getCategories(); $categories = (new ModelAdmin())->getCategories();
$questions = (new ModelAdmin())->getQuestions(); global $rep, $views;
$responsesCandidate = (new ModelAdmin())->getResponsesCandidate(); require_once($rep.$views['categories']);
}
var_dump($responsesCandidate);
/**
* Permet de naviguer jusqu'à la page de gestion des questions
*
* @return void
*/
public function goToQuestions(): void
{
$questions = (new ModelAdmin())->getQuestions();
global $rep, $views; global $rep, $views;
require_once($rep.$views['admin']); require_once($rep.$views['questions']);
} }
/** /**
* Permet d'ajouter une catégories (mot-clef) à notre application * Permet de naviguer jusqu'à la page de gestion des réponses
* *
* @return void * @return void
*/ */
public function addKeyword(): void public function goToResponses(): void
{ {
(new ModelAdmin())->addKeyword(); $responsesCandidate = (new ModelAdmin())->getResponsesCandidate();
$this->goToAdminPage(); global $rep, $views;
require_once($rep.$views['responses']);
} }
} }

@ -15,101 +15,14 @@
</head> </head>
<body> <body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA"> <img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<h1>Administration</h1> <h1>Administration</h1>
<div id="container">
<div>
<form method="post">
<label for="keyword"></label><input id="keyword" name="keyword" type="text" size="25" placeholder="...">
<input type="submit" value="Ajouter">
<input type="hidden" name="action" value="addKeyword">
</form>
<button id="printCategory">Les catégories ▼</button>
<ul id="listCategories" class="hidden-content">
<?php
foreach ($categories as $category) {
?> <li><?php echo $category; ?></li> <?php
}
?>
</ul>
</div>
<div>
<button id="printQuestion">Les questions ▼</button>
<ul id="listQuestions" class="hidden-content">
<?php
foreach ($questions as $question) {
?>
<hr>
<li><?php echo $question->printStrategy(); ?></li>
<?php
}
?>
</ul>
</div>
</div>
<div class="form-center"> <div class="form-center">
<button id="addNewQuestion">Ajouter une question ▼</button> <a href="index.php?action=goToCategories">Les catégories</a>
<form id="addQuestionForm" method="post" class="hidden-content"> <a href="index.php?action=goToQuestions">Les questions</a>
<div id="questionText"> <a href="index.php?action=goToResponses">Les réponses</a>
<label for="question">Écrivez la question : </label>
<br>
<input id="question" name="question" type="text" size="100">
</div>
<div>
<br><br>
<label for="type">Séléctionnez le type de question souhaitée :
<br>- Text permet d'écrire la réponse librement.
<br>- ListBox permet de choisir une réponse parmi plusieurs possibilités.
<br>- CheckBox permet de choisir une ou plusieurs réponses parmi plusieurs possibilités.
</label>
<br>
<select id="type" name="type">
<option value="BusinessClass\TextQuestion">Text</option>
<option value="BusinessClass\ListBoxQuestion">ListBox</option>
<option value="BusinessClass\CheckBoxQuestion">CheckBox</option>
</select>
</div> </div>
<br><br>
<input type="submit" value="Confirmer">
<input type="hidden" name="action" value="addQuestion">
</form>
</div>
<div class="form-center">
<button id="printResponses">Les réponses ▼</button>
<div id="listResponses">
<?php
foreach ($responsesCandidate as $response) { ?>
<i><?php echo $response[0]["date"]; ?></i>
<p>Catégories associées :
<?php
echo " | ";
foreach ($response[2] as $category)
if(!empty($category)) {
echo $category[0] . " | ";
}
?>
</p>
<?php foreach ($response[1] as $questionResponses) { ?>
<p><i>Question : </i><?php echo $questionResponses["content"]; ?></p>
<p><i>Réponse : </i><?php echo $questionResponses["questionContent"]; ?></p>
<?php
} ?>
<hr><br>
<?php
}
?>
</div>
</div>
</body> </body>
<script src="Views/JS/form_category.js"></script> <script src="Views/JS/form_category.js"></script>

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<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>
</div>
<br>
<div class="form-center">
<h3>Les catégories :</h3>
<form method="post">
<label for="keyword"></label><input id="keyword" name="keyword" type="text" size="25" placeholder="...">
<input type="submit" value="Ajouter">
<input type="hidden" name="action" value="addKeyword">
</form>
<br>
<ul class="form-center">
<?php
foreach ($categories as $category) {
?> <li><?php echo $category; ?></li> <?php
}
?>
</ul>
</div>
</body>
</html>

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<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>
</div>
<br>
<div class="form-center">
<h3>Les questions :</h3>
<br>
<form method="post">
<div>
<label for="question">Écrivez la question : </label>
<br>
<input id="question" name="question" type="text" size="70">
</div>
<div>
<br>
<label for="type">Séléctionnez le type de question souhaitée :
<br>- Text permet d'écrire la réponse librement.
<br>- ListBox permet de choisir une réponse parmi plusieurs possibilités.
<br>- CheckBox permet de choisir une ou plusieurs réponses parmi plusieurs possibilités.
</label>
<br>
<select id="type" name="type">
<option value="BusinessClass\TextQuestion">Text</option>
<option value="BusinessClass\ListBoxQuestion">ListBox</option>
<option value="BusinessClass\CheckBoxQuestion">CheckBox</option>
</select>
</div>
<br>
<input type="submit" value="Ajouter">
<input type="hidden" name="action" value="addQuestion">
</form>
<br>
<hr>
<br>
<ul class="form-center">
<?php
foreach ($questions as $question) {
?>
<li><?php echo $question->printStrategy(); ?></li>
<?php
}
?>
</ul>
</div>
</body>
</html>

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<?php
global $googleApis, $googleStatic, $poppins, $icon, $logoUCA;
?>
<meta charset="UTF-8">
<link rel="stylesheet" href="Views/CSS/base.css" />
<link rel="preconnect" href="<?php echo $googleApis; ?>">
<link rel="preconnect" href="<?php echo $googleStatic; ?>" crossorigin>
<link href="<?php echo $poppins; ?>" rel="stylesheet">
<title>Formulaire de témoignage</title>
<link rel="shortcut icon" href="<?php echo $icon; ?>" type="image/x-icon">
<link rel="icon" href="<?php echo $icon; ?>" type="image/x-icon">
</head>
<body>
<img id="logoUCA" src="<?php echo $logoUCA; ?>" height="35px" width="auto" alt="logo UCA">
<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>
</div>
<br>
<div class="form-center">
<h3>Les réponses :</h3>
<br>
<div id="listResponses">
<?php
foreach ($responsesCandidate as $response) { ?>
<i><?php echo $response[0]["date"]; ?></i>
<p>Catégories associées :
<?php
echo " | ";
foreach ($response[2] as $category)
if(!empty($category)) {
echo $category[0] . " | ";
}
?>
</p>
<?php foreach ($response[1] as $questionResponses) { ?>
<p><i>Question : </i><?php echo $questionResponses["content"]; ?></p>
<p><i>Réponse : </i><?php echo $questionResponses["questionContent"]; ?></p>
<?php
} ?>
<hr><br>
<?php
}
?>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save