Ajout des écoles + changement CSS
This commit is contained in:
+124
-3
@@ -10,6 +10,9 @@ require_once '../functions/databaseConnection.php';
|
||||
require_once("../functions/listUser.php");
|
||||
require_once('../functions/listProject.php');
|
||||
require_once('../functions/listXP.php');
|
||||
require_once('../functions/listSchool.php');
|
||||
require_once('../functions/listSkills.php');
|
||||
require_once('../functions/listSettings.php');
|
||||
|
||||
|
||||
// L'utilisateur doit être administrateur
|
||||
@@ -21,15 +24,28 @@ if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
|
||||
// On met les variables à null ici pour éviter qu'il garde les options en premier chargement
|
||||
$projetAModifier = null;
|
||||
$xpAModifier = null;
|
||||
$ecoleAModifier = null;
|
||||
$skillAModifier = null;
|
||||
|
||||
|
||||
// Si on modifie XP ou Projets
|
||||
// Si on modifie XP, Projets, École ou Compétence
|
||||
if (isset($_GET['edit_project']) && is_numeric($_GET['edit_project'])) {
|
||||
$projetAModifier = recupererProjetParId((int) $_GET['edit_project']);
|
||||
}
|
||||
if (isset($_GET['edit_xp']) && is_numeric($_GET['edit_xp'])) {
|
||||
$xpAModifier = recupererXPParId((int) $_GET['edit_xp']);
|
||||
}
|
||||
if (isset($_GET['edit_school']) && is_numeric($_GET['edit_school'])) {
|
||||
$ecoleAModifier = recupererEcoleParId((int) $_GET['edit_school']);
|
||||
}
|
||||
if (isset($_GET['edit_skill']) && is_numeric($_GET['edit_skill'])) {
|
||||
$skillAModifier = recupererSkillParId((int) $_GET['edit_skill']);
|
||||
}
|
||||
|
||||
// Valeurs actuelles de la notification de la page d'accueil
|
||||
$noticeTitle = recupererSetting('site_notice_title') ?? '';
|
||||
$noticeText = recupererSetting('site_notice_text') ?? '';
|
||||
$noticeEnabled = recupererSetting('site_notice_enabled') ?? '1';
|
||||
|
||||
// Page du panneau d'administration
|
||||
?>
|
||||
@@ -103,7 +119,105 @@ if (isset($_GET['edit_xp']) && is_numeric($_GET['edit_xp'])) {
|
||||
<input type="url" name="imageurl" placeholder="https://..." required value="<?php echo $xpAModifier ? htmlspecialchars($xpAModifier['image_url']) : ''; ?>">
|
||||
|
||||
<input type="submit" name="submitxp" value="<?php echo $xpAModifier ? 'Modifier l\'experience' : '+ Ajouter l\'experience'; ?>" class="btn-submit">
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de création d'école / formation -->
|
||||
<div class="project-container">
|
||||
<div class="project-form-card">
|
||||
|
||||
<div class="project-header">
|
||||
<h2><?php echo $ecoleAModifier ? 'Modifier l\'école' : 'Nouvelle école'; ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- on envoie les données à addSchool.php -->
|
||||
<form method="POST" action="<?php echo $ecoleAModifier ? '../scripts/updateSchool.php' : '../scripts/addSchool.php'; ?>">
|
||||
|
||||
<?php if ($ecoleAModifier): ?>
|
||||
<input type="hidden" name="id" value="<?php echo (int) $ecoleAModifier['id']; ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<label>Nom de l'école *</label>
|
||||
<input type="text" name="title" required value="<?php echo $ecoleAModifier ? htmlspecialchars($ecoleAModifier['title']) : ''; ?>">
|
||||
|
||||
<label>Tags (virgules)</label>
|
||||
<input type="text" name="tags" value="<?php echo $ecoleAModifier ? htmlspecialchars($ecoleAModifier['tags']) : ''; ?>">
|
||||
|
||||
<label>Description (diplôme, spécialité...) *</label>
|
||||
<textarea name="description" required><?php echo $ecoleAModifier ? htmlspecialchars($ecoleAModifier['description']) : ''; ?></textarea>
|
||||
|
||||
<label>Période (ex : 2023 - 2025) *</label>
|
||||
<input type="text" name="duration" required value="<?php echo $ecoleAModifier ? htmlspecialchars($ecoleAModifier['duration']) : ''; ?>">
|
||||
|
||||
<label>Lien de l'image *</label>
|
||||
<input type="url" name="imageurl" placeholder="https://..." required value="<?php echo $ecoleAModifier ? htmlspecialchars($ecoleAModifier['image_url']) : ''; ?>">
|
||||
|
||||
<input type="submit" name="submitschool" value="<?php echo $ecoleAModifier ? 'Modifier l\'école' : '+ Ajouter l\'école'; ?>" class="btn-submit">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de création de catégorie de compétences -->
|
||||
<div class="project-container">
|
||||
<div class="project-form-card">
|
||||
|
||||
<div class="project-header">
|
||||
<h2><?php echo $skillAModifier ? 'Modifier la compétence' : 'Nouvelle compétence'; ?></h2>
|
||||
</div>
|
||||
|
||||
<!-- on envoie les données à addSkill.php -->
|
||||
<form method="POST" action="<?php echo $skillAModifier ? '../scripts/updateSkill.php' : '../scripts/addSkill.php'; ?>">
|
||||
|
||||
<?php if ($skillAModifier): ?>
|
||||
<input type="hidden" name="id" value="<?php echo (int) $skillAModifier['id']; ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<label>Titre de la catégorie *</label>
|
||||
<input type="text" name="title" required value="<?php echo $skillAModifier ? htmlspecialchars($skillAModifier['title']) : ''; ?>">
|
||||
|
||||
<label>Icône de la catégorie (classes Font Awesome, ex : fa-solid fa-terminal)</label>
|
||||
<input type="text" name="icon" placeholder="fa-solid fa-star" value="<?php echo $skillAModifier ? htmlspecialchars($skillAModifier['icon']) : ''; ?>">
|
||||
|
||||
<label>Compétences (une par ligne, format : "icone|texte" ou juste "texte") *</label>
|
||||
<textarea name="items" placeholder="fa-brands fa-python|Python fa-solid fa-terminal|Bash Ansible" required><?php echo $skillAModifier ? htmlspecialchars($skillAModifier['items']) : ''; ?></textarea>
|
||||
|
||||
<label>Position (ordre d'affichage, du plus petit au plus grand)</label>
|
||||
<input type="text" name="position" value="<?php echo $skillAModifier ? (int) $skillAModifier['position'] : '0'; ?>">
|
||||
|
||||
<input type="submit" name="submitskill" value="<?php echo $skillAModifier ? 'Modifier la compétence' : '+ Ajouter la compétence'; ?>" class="btn-submit">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Formulaire de la notification de la page d'accueil -->
|
||||
<div class="project-container">
|
||||
<div class="project-form-card">
|
||||
|
||||
<div class="project-header">
|
||||
<h2>Notification de la page d'accueil</h2>
|
||||
</div>
|
||||
|
||||
<!-- on envoie les données à updateSettings.php -->
|
||||
<form method="POST" action="../scripts/updateSettings.php">
|
||||
|
||||
<label>Titre (affiché en gras)</label>
|
||||
<input type="text" name="notice_title" value="<?php echo htmlspecialchars($noticeTitle); ?>">
|
||||
|
||||
<label>Texte</label>
|
||||
<textarea name="notice_text"><?php echo htmlspecialchars($noticeText); ?></textarea>
|
||||
|
||||
<!-- Checkbox pour activer / désactiver la notification sans la supprimer -->
|
||||
<label class="checkbox-row">
|
||||
<input type="checkbox" name="notice_enabled" value="1" <?php echo $noticeEnabled === '1' ? 'checked' : ''; ?>>
|
||||
Afficher la notification sur la page d'accueil
|
||||
</label>
|
||||
|
||||
<input type="submit" name="submitsettings" value="Enregistrer la notification" class="btn-submit">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -116,7 +230,14 @@ if (isset($_GET['edit_xp']) && is_numeric($_GET['edit_xp'])) {
|
||||
<h2 class="projects-title">Gérer les projets</h2>
|
||||
<?php afficherProjetsAdmin(); ?>
|
||||
<h2 class="projects-title">Gérer les experiences</h2>
|
||||
<?php afficherXPAdmin();
|
||||
<?php afficherXPAdmin(); ?>
|
||||
<h2 class="projects-title">Gérer les écoles</h2>
|
||||
<?php afficherEcolesAdmin(); ?>
|
||||
<h2 class="projects-title">Gérer les compétences</h2>
|
||||
<section class="skills-section skills-section-admin">
|
||||
<?php afficherSkillsAdmin(); ?>
|
||||
</section>
|
||||
<?php
|
||||
|
||||
// Création de compte
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user