mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
Refactor admin panel and add migration documentation
- Add comprehensive migration guides (DEPLOYMENT_MIGRATION.md, DIRECTORY_STRUCTURE.md, MIGRATION_CHECKLIST.md) - Refactor admin panel: split add.php, create reusable header/footer - Update styles: admin.css, common.css, main.css - Improve public pages: index.php, memoire.php - Reorganize database documentation into database/docs/ - Update .gitignore and justfile This prepares for migration to public/ directory structure
This commit is contained in:
523
admin/index.php
523
admin/index.php
@@ -1,300 +1,285 @@
|
||||
<?php
|
||||
// Start session and generate CSRF token
|
||||
// List all theses in the database
|
||||
session_start();
|
||||
if (empty($_SESSION["csrf_token"])) {
|
||||
$_SESSION["csrf_token"] = bin2hex(random_bytes(32));
|
||||
|
||||
// Generate CSRF token
|
||||
if (empty($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
|
||||
// Load database helper
|
||||
$pageTitle = "Liste des TFE";
|
||||
$pageMenu
|
||||
|
||||
require_once __DIR__ . '/../lib/Database.php';
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$pdo = $db->getPDO();
|
||||
|
||||
// Get filter parameters
|
||||
$searchQuery = isset($_GET['search']) ? trim($_GET['search']) : '';
|
||||
$yearFilter = isset($_GET['year']) ? intval($_GET['year']) : null;
|
||||
$orientationFilter = isset($_GET['orientation']) ? intval($_GET['orientation']) : null;
|
||||
|
||||
// Build query
|
||||
$sql = "SELECT
|
||||
t.id, t.identifier, t.title, t.subtitle, t.year,
|
||||
o.name as orientation,
|
||||
ap.name as ap_program,
|
||||
GROUP_CONCAT(DISTINCT a.name) as authors,
|
||||
t.submitted_at,
|
||||
t.is_published
|
||||
FROM theses t
|
||||
LEFT JOIN orientations o ON t.orientation_id = o.id
|
||||
LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id
|
||||
LEFT JOIN thesis_authors ta ON t.id = ta.thesis_id
|
||||
LEFT JOIN authors a ON ta.author_id = a.id
|
||||
WHERE 1=1";
|
||||
|
||||
$params = [];
|
||||
|
||||
if ($searchQuery) {
|
||||
$sql .= " AND (t.title LIKE ? OR t.subtitle LIKE ? OR a.name LIKE ?)";
|
||||
$searchParam = "%$searchQuery%";
|
||||
$params[] = $searchParam;
|
||||
$params[] = $searchParam;
|
||||
$params[] = $searchParam;
|
||||
}
|
||||
|
||||
if ($yearFilter) {
|
||||
$sql .= " AND t.year = ?";
|
||||
$params[] = $yearFilter;
|
||||
}
|
||||
|
||||
if ($orientationFilter) {
|
||||
$sql .= " AND t.orientation_id = ?";
|
||||
$params[] = $orientationFilter;
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY t.id ORDER BY t.year DESC, t.submitted_at DESC";
|
||||
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$theses = $stmt->fetchAll();
|
||||
|
||||
// Get unique years for filter
|
||||
$yearsStmt = $pdo->query("SELECT DISTINCT year FROM theses ORDER BY year DESC");
|
||||
$years = $yearsStmt->fetchAll(PDO::FETCH_COLUMN);
|
||||
|
||||
// Get orientations for filter
|
||||
$orientations = $db->getAllOrientations();
|
||||
$apPrograms = $db->getAllAPPrograms();
|
||||
$finalityTypes = $db->getAllFinalityTypes();
|
||||
$languages = $db->getAllLanguages();
|
||||
$formatTypes = $db->getAllFormatTypes();
|
||||
} catch (Exception $e) {
|
||||
error_log("Failed to load form data: " . $e->getMessage());
|
||||
die("Erreur lors du chargement du formulaire. Veuillez réessayer plus tard.");
|
||||
}
|
||||
|
||||
// Get error message and preserved form data from session (if redirected back from error)
|
||||
$error = isset($_SESSION["form_error"]) ? $_SESSION["form_error"] : null;
|
||||
$formData = isset($_SESSION["form_data"]) ? $_SESSION["form_data"] : [];
|
||||
|
||||
// Clear session data after retrieving
|
||||
unset($_SESSION["form_error"]);
|
||||
unset($_SESSION["form_data"]);
|
||||
|
||||
// Helper function to get old form value
|
||||
function old($key, $default = "")
|
||||
{
|
||||
global $formData;
|
||||
return isset($formData[$key])
|
||||
? htmlspecialchars($formData[$key])
|
||||
: $default;
|
||||
}
|
||||
|
||||
// Helper function to check if value was previously selected
|
||||
function wasSelected($key, $value)
|
||||
{
|
||||
global $formData;
|
||||
if (!isset($formData[$key])) {
|
||||
return false;
|
||||
}
|
||||
if (is_array($formData[$key])) {
|
||||
return in_array($value, $formData[$key]);
|
||||
}
|
||||
return $formData[$key] == $value;
|
||||
error_log("Error loading theses list: " . $e->getMessage());
|
||||
die("Erreur lors du chargement de la liste.");
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Formulaire</title>
|
||||
<link rel="stylesheet" href="/assets/modern-normalize.css">
|
||||
<link rel="stylesheet" href="https://raw.githack.com/waldyrious/downstyler/master/downstyler.css" />
|
||||
<link rel="shortcut icon" href="assets/icon.svg" type="image/svg">
|
||||
</head>
|
||||
<? include "inc/head.php" ?>
|
||||
<script>
|
||||
function toggleAll(source) {
|
||||
const checkboxes = document.querySelectorAll('input[name="selected_theses[]"]');
|
||||
checkboxes.forEach(checkbox => {
|
||||
checkbox.checked = source.checked;
|
||||
});
|
||||
updateBulkActionsVisibility();
|
||||
}
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<h1>Formulaire Posterg</h1>
|
||||
<nav style="margin-top: 1rem;">
|
||||
<a href="list.php" style="font-size: 0.9em;">📋 Liste des TFE</a> |
|
||||
<a href="import.php" style="font-size: 0.9em;">📥 Importer CSV</a>
|
||||
</nav>
|
||||
</header>
|
||||
function updateBulkActionsVisibility() {
|
||||
const checkboxes = document.querySelectorAll('input[name="selected_theses[]"]:checked');
|
||||
const bulkActions = document.getElementById('bulk-actions');
|
||||
const selectedCount = document.getElementById('selected-count');
|
||||
|
||||
<main>
|
||||
<?php if ($error): ?>
|
||||
<div class="error-message" style="background: #fee; border: 2px solid #c00; padding: 1rem; margin-bottom: 1rem; border-radius: 4px; color: #c00;">
|
||||
<strong>⚠️ Erreur:</strong> <?php echo htmlspecialchars($error); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
if (checkboxes.length > 0) {
|
||||
bulkActions.style.display = 'flex';
|
||||
selectedCount.textContent = checkboxes.length;
|
||||
} else {
|
||||
bulkActions.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
<form action="formulaire.php" method="post" enctype="multipart/form-data">
|
||||
<!-- CSRF Protection -->
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars(
|
||||
$_SESSION["csrf_token"],
|
||||
); ?>">
|
||||
function bulkAction(action) {
|
||||
const checkboxes = document.querySelectorAll('input[name="selected_theses[]"]:checked');
|
||||
if (checkboxes.length === 0) {
|
||||
alert('Veuillez sélectionner au moins un TFE.');
|
||||
return false;
|
||||
}
|
||||
|
||||
<h2>Informations de base</h2>
|
||||
const actionText = action === 'publish' ? 'publier' : 'dépublier';
|
||||
if (!confirm(`Voulez-vous vraiment ${actionText} ${checkboxes.length} TFE(s) ?`)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set action
|
||||
document.getElementById('bulk-action-input').value = action;
|
||||
|
||||
// Copy selected thesis IDs to hidden form
|
||||
const bulkCheckboxesContainer = document.getElementById('bulk-checkboxes');
|
||||
bulkCheckboxesContainer.innerHTML = '';
|
||||
checkboxes.forEach(checkbox => {
|
||||
const input = document.createElement('input');
|
||||
input.type = 'hidden';
|
||||
input.name = 'selected_theses[]';
|
||||
input.value = checkbox.value;
|
||||
bulkCheckboxesContainer.appendChild(input);
|
||||
});
|
||||
|
||||
// Submit the form
|
||||
document.getElementById('bulk-form').submit();
|
||||
return false;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Add change listeners to all checkboxes
|
||||
document.querySelectorAll('input[name="selected_theses[]"]').forEach(checkbox => {
|
||||
checkbox.addEventListener('change', updateBulkActionsVisibility);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<?php if (isset($_SESSION['error'])): ?>
|
||||
<div style="background: #fee; border: 2px solid #c00; padding: 1rem; margin-bottom: 1rem; border-radius: 4px; color: #c00;">
|
||||
<strong>⚠️ Erreur:</strong> <?php echo htmlspecialchars($_SESSION['error']);
|
||||
unset($_SESSION['error']); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION['success'])): ?>
|
||||
<div style="background: #efe; border: 2px solid #0a0; padding: 1rem; margin-bottom: 1rem; border-radius: 4px; color: #0a0;">
|
||||
<strong>✓ <?php echo htmlspecialchars($_SESSION['success']);
|
||||
unset($_SESSION['success']); ?></strong>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="bulk-actions" class="bulk-actions" style="display: none;">
|
||||
<strong><span id="selected-count">0</span> TFE(s) sélectionné(s)</strong>
|
||||
<div class="bulk-actions-buttons">
|
||||
<button type="button" class="btn-bulk-publish" onclick="bulkAction('publish')">Publier la sélection</button>
|
||||
<button type="button" class="btn-bulk-unpublish" onclick="bulkAction('unpublish')">Dépublier la sélection</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="bulk-form" method="post" action="publish.php" style="display: none;">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
|
||||
<input type="hidden" id="bulk-action-input" name="action" value="">
|
||||
<input type="hidden" name="bulk" value="1">
|
||||
<div id="bulk-checkboxes"></div>
|
||||
</form>
|
||||
|
||||
<div class="stats">
|
||||
<div class="stat-card">
|
||||
<div class="stat-number"><?php echo count($theses); ?></div>
|
||||
<div class="stat-label">TFE total</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-number"><?php echo count(array_filter($theses, fn($t) => $t['is_published'])); ?></div>
|
||||
<div class="stat-label">Publiés</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-number"><?php echo count(array_filter($theses, fn($t) => !$t['is_published'])); ?></div>
|
||||
<div class="stat-label">En attente</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filters">
|
||||
<form method="get" action="list.php">
|
||||
<fieldset>
|
||||
<label for="auteurice">Nom/Prénom/Pseudo *</label>
|
||||
<input type="text" id="auteurice" name="auteurice" placeholder="Nom de l'auteur·ice" value="<?php echo old(
|
||||
"auteurice",
|
||||
); ?>" required>
|
||||
<label for="search">Rechercher</label>
|
||||
<input type="text" id="search" name="search" placeholder="Titre, auteur..." value="<?php echo htmlspecialchars($searchQuery); ?>">
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="mail">Contact (email, site web, insta, ...)</label>
|
||||
<input type="text" id="mail" name="mail" placeholder="votre.email@example.com ou @instagram" value="<?php echo old(
|
||||
"mail",
|
||||
); ?>">
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="année">Année diplômante *</label>
|
||||
<input type="number" id="année" name="année" min="2000" max="<?php echo date(
|
||||
"Y",
|
||||
) + 1; ?>" placeholder="<?php echo date(
|
||||
"Y",
|
||||
); ?>" value="<?php echo old("année"); ?>" required>
|
||||
</fieldset>
|
||||
|
||||
<h2>Informations académiques</h2>
|
||||
|
||||
|
||||
<fieldset>
|
||||
<label for="orientation">Orientation principale *</label>
|
||||
<select id="orientation" name="orientation" required>
|
||||
<option value="">-- Sélectionner une orientation --</option>
|
||||
<?php foreach ($orientations as $orientation): ?>
|
||||
<option value="<?php echo htmlspecialchars(
|
||||
$orientation["id"],
|
||||
); ?>" <?php echo wasSelected(
|
||||
"orientation",
|
||||
$orientation["id"],
|
||||
)
|
||||
? "selected"
|
||||
: ""; ?>>
|
||||
<?php echo htmlspecialchars(
|
||||
$orientation["name"],
|
||||
); ?>
|
||||
<label for="year">Année</label>
|
||||
<select id="year" name="year">
|
||||
<option value="">Toutes</option>
|
||||
<?php foreach ($years as $year): ?>
|
||||
<option value="<?php echo $year; ?>" <?php echo $yearFilter == $year ? 'selected' : ''; ?>>
|
||||
<?php echo $year; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="ap">Atelier Pratique (AP) *</label>
|
||||
<select id="ap" name="ap" required>
|
||||
<option value="">-- Sélectionner un AP --</option>
|
||||
<?php foreach ($apPrograms as $ap): ?>
|
||||
<option value="<?php echo htmlspecialchars(
|
||||
$ap["id"],
|
||||
); ?>" <?php echo wasSelected("ap", $ap["id"])
|
||||
? "selected"
|
||||
: ""; ?>>
|
||||
<?php echo htmlspecialchars($ap["name"]); ?>
|
||||
<?php if (
|
||||
$ap["code"]
|
||||
): ?> (<?php echo htmlspecialchars(
|
||||
$ap["code"],
|
||||
); ?>)<?php endif; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="finality">Finalité du master *</label>
|
||||
<select id="finality" name="finality" required>
|
||||
<option value="">-- Sélectionner une finalité --</option>
|
||||
<?php foreach ($finalityTypes as $finality): ?>
|
||||
<option value="<?php echo htmlspecialchars(
|
||||
$finality["id"],
|
||||
); ?>" <?php echo wasSelected(
|
||||
"finality",
|
||||
$finality["id"],
|
||||
)
|
||||
? "selected"
|
||||
: ""; ?>>
|
||||
<?php echo htmlspecialchars($finality["name"]); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="promoteurice">Promoteur·ice(s)</label>
|
||||
<input type="text" id="promoteurice" name="promoteurice" placeholder="Nom du/de la promoteur·ice (si plusieurs, séparer par des virgules)" value="<?php echo old(
|
||||
"promoteurice",
|
||||
); ?>">
|
||||
|
||||
</fieldset>
|
||||
|
||||
<h2>À propos du TFE</h2>
|
||||
|
||||
|
||||
<fieldset>
|
||||
<label for="titre">Titre du mémoire *</label>
|
||||
<input type="text" id="titre" name="titre" placeholder="Titre de votre TFE" value="<?php echo old(
|
||||
"titre",
|
||||
); ?>" required>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="subtitle">Sous-titre (si applicable)</label>
|
||||
<input type="text" id="subtitle" name="subtitle" placeholder="Sous-titre de votre TFE" value="<?php echo old(
|
||||
"subtitle",
|
||||
); ?>">
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="synopsis">Synopsis (environ 200 mots) *</label>
|
||||
<textarea id="synopsis" name="synopsis" rows="8" placeholder="Décrivez votre TFE en quelques paragraphes..." required><?php echo old(
|
||||
"synopsis",
|
||||
); ?></textarea>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="problématique">Problématique</label>
|
||||
<textarea id="problématique" name="problématique" rows="4" placeholder="La problématique principale de votre mémoire..."><?php echo old(
|
||||
"problématique",
|
||||
); ?></textarea>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label>Langue(s) du TFE * (sélection multiple possible)</label>
|
||||
<?php foreach ($languages as $language): ?>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="languages[]" value="<?php echo htmlspecialchars(
|
||||
$language["id"],
|
||||
); ?>" <?php echo wasSelected(
|
||||
"languages",
|
||||
$language["id"],
|
||||
)
|
||||
? "checked"
|
||||
: ""; ?>>
|
||||
<?php echo htmlspecialchars($language["name"]); ?>
|
||||
</label>
|
||||
<fieldset>
|
||||
<label for="orientation">Orientation</label>
|
||||
<select id="orientation" name="orientation">
|
||||
<option value="">Toutes</option>
|
||||
<?php foreach ($orientations as $orientation): ?>
|
||||
<option value="<?php echo $orientation['id']; ?>" <?php echo $orientationFilter == $orientation['id'] ? 'selected' : ''; ?>>
|
||||
<?php echo htmlspecialchars($orientation['name']); ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
</select>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label>Format(s) (sélection multiple possible)</label>
|
||||
<?php foreach ($formatTypes as $format): ?>
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" name="formats[]" value="<?php echo htmlspecialchars(
|
||||
$format["id"],
|
||||
); ?>" <?php echo wasSelected(
|
||||
"formats",
|
||||
$format["id"],
|
||||
)
|
||||
? "checked"
|
||||
: ""; ?>>
|
||||
<?php echo htmlspecialchars($format["name"]); ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="tag">Mots-clés (max 10, séparés par des virgules)</label>
|
||||
<input type="text" id="tag" name="tag" placeholder="typographie, photographie, outils libre, post-colonial..." value="<?php echo old(
|
||||
"tag",
|
||||
); ?>">
|
||||
<small>Séparez les mots-clés par des virgules. Maximum 10 mots-clés.</small>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="duration_info">Durée/Taille (si applicable)</label>
|
||||
<input type="text" id="duration_info" name="duration_info" placeholder="Ex: 68 minutes, 128 pages, 78 pages + 15 minutes" value="<?php echo old(
|
||||
"duration_info",
|
||||
); ?>">
|
||||
<small>Indiquez la durée (en minutes) ou le nombre de pages de votre TFE.</small>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="lien">Lien vers un site web ou ressource en ligne</label>
|
||||
<input type="url" id="lien" name="lien" placeholder="https://monmemoire.erg.be/..." value="<?php echo old(
|
||||
"lien",
|
||||
); ?>">
|
||||
</fieldset>
|
||||
|
||||
<h2>Fichiers</h2>
|
||||
|
||||
<fieldset>
|
||||
<label for="couverture">Importer une image de couverture</label>
|
||||
<small>Formats acceptés : JPG, PNG. Taille max : 10MB.</small>
|
||||
<input type="file" id="couverture" name="couverture" accept="image/jpeg,image/png">
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="files">Importer le TFE et les fichiers annexes</label>
|
||||
<small>Formats acceptés : PDF, JPG, PNG, MP4, ZIP. Taille max par fichier : 50MB.</small>
|
||||
<small>Si vous voulez importer un dossier, créez une archive ZIP.</small>
|
||||
<input type="file" id="files" name="files[]" multiple accept=".pdf,.jpg,.jpeg,.png,.mp4,.zip">
|
||||
</fieldset>
|
||||
|
||||
<br>
|
||||
<input type="submit" name="go" value="Soumettre mon TFE">
|
||||
<button type="submit">Filtrer</button>
|
||||
<?php if ($searchQuery || $yearFilter || $orientationFilter): ?>
|
||||
<a href="list.php">Réinitialiser</a>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>Formulaire fait avec ❤ en PHP et <a href="https://github.com/kevquirk/simple.css">SimpleCSS</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
<?php if (empty($theses)): ?>
|
||||
<p>Aucun TFE trouvé.</p>
|
||||
<?php else: ?>
|
||||
<table class="thesis-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox" class="select-all-checkbox" onchange="toggleAll(this)" title="Tout sélectionner"></th>
|
||||
<th>ID</th>
|
||||
<th>Titre</th>
|
||||
<th>Auteur(s)</th>
|
||||
<th>Année</th>
|
||||
<th>Orientation</th>
|
||||
<th>AP</th>
|
||||
<th>Statut</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($theses as $thesis): ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="select-checkbox" name="selected_theses[]" value="<?php echo $thesis['id']; ?>"></td>
|
||||
<td><?php echo htmlspecialchars($thesis['identifier'] ?? $thesis['id']); ?></td>
|
||||
<td>
|
||||
<div class="thesis-title"><?php echo htmlspecialchars($thesis['title']); ?></div>
|
||||
<?php if ($thesis['subtitle']): ?>
|
||||
<div class="thesis-subtitle"><?php echo htmlspecialchars($thesis['subtitle']); ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($thesis['authors'] ?? 'N/A'); ?></td>
|
||||
<td><?php echo $thesis['year']; ?></td>
|
||||
<td><?php echo htmlspecialchars($thesis['orientation'] ?? 'N/A'); ?></td>
|
||||
<td><?php echo htmlspecialchars($thesis['ap_program'] ?? 'N/A'); ?></td>
|
||||
<td>
|
||||
<?php if ($thesis['is_published']): ?>
|
||||
<span class="status-badge status-published">Publié</span>
|
||||
<?php else: ?>
|
||||
<span class="status-badge status-pending">En attente</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<a href="thanks.php?id=<?php echo $thesis['id']; ?>" class="btn btn-view">Voir</a>
|
||||
<a href="edit.php?id=<?php echo $thesis['id']; ?>" class="btn btn-edit">Éditer</a>
|
||||
<form method="post" action="publish.php" class="publish-form">
|
||||
<input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>">
|
||||
<input type="hidden" name="thesis_id" value="<?php echo $thesis['id']; ?>">
|
||||
<?php if ($thesis['is_published']): ?>
|
||||
<input type="hidden" name="action" value="unpublish">
|
||||
<button type="submit" class="btn btn-unpublish" onclick="return confirm('Retirer ce TFE de la publication ?');">Dépublier</button>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="action" value="publish">
|
||||
<button type="submit" class="btn btn-publish">Publier</button>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
</html>
|
||||
<? include "inc/footer.php" ?>
|
||||
|
||||
Reference in New Issue
Block a user