admin/add: add ?mode=student toggle — hides admin header, keeps auth

This commit is contained in:
Pontoporeia
2026-04-15 13:42:36 +02:00
parent 0eb2e310f4
commit 150b5b1dac
3 changed files with 98 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ if (empty($_SESSION["csrf_token"])) {
}
$pageTitle = "Ajouter un TFE";
$studentMode = isset($_GET['mode']) && $_GET['mode'] === 'student';
require_once __DIR__ . '/../../src/ThesisCreateController.php';
@@ -47,11 +48,27 @@ function wasSelected($key, $value) {
return $formData[$key] == $value;
}
?>
<?php $isAdmin = true; $bodyClass = 'admin-body'; require_once APP_ROOT . '/templates/head.php'; ?>
<?php include APP_ROOT . '/templates/header.php'; ?>
<?php
if ($studentMode) {
$bodyClass = 'student-body';
require_once APP_ROOT . '/templates/head.php';
} else {
$isAdmin = true;
$bodyClass = 'admin-body';
require_once APP_ROOT . '/templates/head.php';
include APP_ROOT . '/templates/header.php';
}
?>
<main id="main-content">
<h1>Ajouter un TFE</h1>
<div class="thesis-add-header">
<h1>Ajouter un TFE</h1>
<?php if (!$studentMode): ?>
<a href="?mode=student" class="mode-toggle" target="_blank" rel="noopener">Mode étudiant ↗</a>
<?php else: ?>
<a href="?mode=admin" class="mode-toggle mode-toggle--back">← Retour admin</a>
<?php endif; ?>
</div>
<?php include APP_ROOT . '/templates/partials/flash-messages.php'; ?>
@@ -135,8 +152,8 @@ function wasSelected($key, $value) {
include APP_ROOT . '/templates/partials/form/select-field.php';
?>
<div class="admin-form-footer">
<button type="submit" name="go" class="admin-btn">Soumettre</button>
<div class="form-footer">
<button type="submit" name="go">Soumettre</button>
</div>
</form>
</main>

View File

@@ -1683,3 +1683,72 @@
flex-direction: column;
gap: var(--space-3xs);
}
/* ── Student mode & toggle ──────────────────────────────────────────────────── */
.student-body header {
display: none;
}
.student-body main {
max-width: 720px;
}
.thesis-add-header {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: var(--space-m);
margin-bottom: var(--space-m);
border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--space-xs);
}
.thesis-add-header h1 {
margin: 0;
font-size: var(--step-1);
font-weight: 600;
letter-spacing: 0.06em;
text-transform: uppercase;
}
.mode-toggle {
font-size: var(--step--1);
color: var(--text-secondary);
text-decoration: none;
white-space: nowrap;
border: 1px solid var(--border-primary);
border-radius: 3px;
padding: var(--space-3xs) var(--space-xs);
transition: color 0.15s, border-color 0.15s;
}
.mode-toggle:hover {
color: var(--accent-primary);
border-color: var(--accent-primary);
}
.mode-toggle--back {
color: var(--accent-blue);
border-color: var(--blue-muted-border, var(--border-primary));
}
.form-footer {
margin-top: var(--space-l);
}
.form-footer button {
padding: var(--space-2xs) var(--space-l);
background: var(--accent-primary);
color: var(--accent-foreground);
border: none;
border-radius: 3px;
font-size: var(--step--1);
font-family: inherit;
cursor: pointer;
letter-spacing: 0.04em;
transition: background 0.15s;
}
.form-footer button:hover {
background: var(--accent-secondary);
}