mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
- Contacts: on peut laisser vide le nom OU le rôle (plus besoin des deux) - Sidebar: les liens « site de l'erg » et « code source » sont éditables depuis /admin/contenus-edit.php?slug=about - Admin: les champs Nom/Email/Lien des contacts s'affichent en grille 3 colonnes - Admin: icône corbeille (admin-icon-btn--delete) pour supprimer un contact, avec réindexation automatique - Database::getAproposContent() gère maintenant les valeurs string (URLs) en plus des arrays - Database::saveAproposContent() accepte array|string
97 lines
5.3 KiB
PHP
97 lines
5.3 KiB
PHP
<main id="main-content">
|
|
<h1><a href="/admin/contenus.php" class="admin-back-btn" title="Retour"><svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm48-88a8,8,0,0,1-8,8H107.31l18.35,18.34a8,8,0,0,1-11.32,11.32l-32-32a8,8,0,0,1,0-11.32l32-32a8,8,0,0,1,11.32,11.32L107.31,120H168A8,8,0,0,1,176,128Z"></path></svg></a> Éditer : <?= htmlspecialchars($editTitle) ?></h1>
|
|
|
|
<?php if ($editType === 'about_page'): ?>
|
|
|
|
<!-- ── Markdown content ──────────────────────────────────────────────── -->
|
|
<h2>Contenu de la page</h2>
|
|
<form action="/admin/actions/page.php" method="post" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION["csrf_token"]) ?>">
|
|
<input type="hidden" name="slug" value="about">
|
|
|
|
<label for="editor">Contenu (Markdown) :</label>
|
|
<input type="hidden" id="content" name="content"
|
|
value="<?= htmlspecialchars($initialContent) ?>">
|
|
<div id="editor"></div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
|
<a href="/admin/contenus.php" class="btn btn--secondary admin-cancel-link">Annuler</a>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- ── Contacts ──────────────────────────────────────────────────────── -->
|
|
<h2 style="margin-top:3rem;">Contacts</h2>
|
|
<?php
|
|
$aproposKey = 'contacts';
|
|
$groups = $aboutContacts ?? [];
|
|
include APP_ROOT . '/templates/admin/apropos-groups-form.php';
|
|
?>
|
|
|
|
<!-- ── Sidebar links ─────────────────────────────────────────────────── -->
|
|
<h2 style="margin-top:3rem;">Liens de la barre latérale</h2>
|
|
<form action="/admin/actions/apropos.php" method="post" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
<input type="hidden" name="apropos_key" value="erg_site_url">
|
|
<label for="apropos-erg-site-url">Site de l'erg :</label>
|
|
<input type="url" id="apropos-erg-site-url" name="url"
|
|
value="<?= htmlspecialchars($ergSiteUrl ?? '') ?>"
|
|
placeholder="https://erg.be">
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
|
</div>
|
|
</form>
|
|
|
|
<form action="/admin/actions/apropos.php" method="post" class="admin-form" style="margin-top:var(--space-m)">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
<input type="hidden" name="apropos_key" value="source_code_url">
|
|
<label for="apropos-source-code-url">Code source :</label>
|
|
<input type="url" id="apropos-source-code-url" name="url"
|
|
value="<?= htmlspecialchars($sourceCodeUrl ?? '') ?>"
|
|
placeholder="https://git.erg.school/PostERG/xamxam">
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php elseif ($editType === 'page' && $pageSlug !== 'about'): ?>
|
|
<form action="/admin/actions/page.php" method="post" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION["csrf_token"]) ?>">
|
|
<input type="hidden" name="slug" value="<?= htmlspecialchars($pageSlug) ?>">
|
|
|
|
<label for="editor">Contenu (Markdown) :</label>
|
|
<input type="hidden" id="content" name="content"
|
|
value="<?= htmlspecialchars($initialContent) ?>">
|
|
<div id="editor"></div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
|
<a href="/admin/contenus.php" class="btn btn--secondary admin-cancel-link">Annuler</a>
|
|
</div>
|
|
</form>
|
|
|
|
<?php elseif ($editType === 'form_help'): ?>
|
|
<p class="param-note">Ce texte est affiché dans le formulaire de soumission des étudiant·es (lien de partage). Supporte le Markdown.</p>
|
|
<form action="/admin/actions/form-help.php" method="post" class="admin-form">
|
|
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
|
<input type="hidden" name="form_help_key" value="<?= htmlspecialchars($formHelpKey) ?>">
|
|
|
|
<label for="editor">Contenu (Markdown) :</label>
|
|
<input type="hidden" id="content" name="content"
|
|
value="<?= htmlspecialchars($initialContent) ?>">
|
|
<div id="editor"></div>
|
|
|
|
<div class="admin-form-footer">
|
|
<button type="submit" class="btn btn--primary">Enregistrer</button>
|
|
<a href="/admin/contenus.php#form-help-blocks" class="btn btn--secondary admin-cancel-link">Annuler</a>
|
|
</div>
|
|
</form>
|
|
|
|
<?php else: ?>
|
|
<?php
|
|
$groups = is_array($value) ? $value : [];
|
|
?>
|
|
<?php include APP_ROOT . '/templates/admin/apropos-groups-form.php'; ?>
|
|
<?php endif; ?>
|
|
</main>
|