Updated the proostekrant to work properly again.

This commit is contained in:
douwe
2026-10-09 10:33:21 +02:00
parent 56d143b74b
commit 256a81a770
133 changed files with 10491 additions and 837 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
$page_title = 'Artikelen';
ob_start();
?>
<div class="articles-list">
<div class="header-actions">
<h2>Alle Artikelen</h2>
<a href="/articles/new" class="btn">Nieuw Artikel</a>
</div>
<?php if (!empty($articles)): ?>
<table class="articles-table">
<thead>
<tr>
<th>Titel</th>
<th>Auteur</th>
<th>Datum</th>
<th>Seizoen</th>
<th>Status</th>
<th>Acties</th>
</tr>
</thead>
<tbody>
<?php foreach ($articles as $article): ?>
<tr>
<td><?= htmlspecialchars($article['title']) ?></td>
<td><?= htmlspecialchars($article['author_name'] ?? 'Onbekend') ?></td>
<td><?= date('d-m-Y', strtotime($article['event_date'])) ?></td>
<td><?= htmlspecialchars($article['season_name'] ?? 'N/A') ?></td>
<td>
<span class="status-badge <?= strtolower($article['status']) ?>">
<?= htmlspecialchars($article['status']) ?>
</span>
</td>
<td>
<a href="/articles/<?= $article['id'] ?>" class="btn-small">Bekijken</a>
<a href="/articles/<?= $article['id'] ?>/verify-writer" class="edit-icon" title="Bewerken">✏️</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<p>Er zijn nog geen artikelen.</p>
<?php endif; ?>
</div>
<?php
$content = ob_get_clean();
require __DIR__ . '/../layouts/main.php';
?>
+128
View File
@@ -0,0 +1,128 @@
<?php
$page_title = 'Nieuw Artikel';
ob_start();
// Get old input if validation failed
$oldInput = $_SESSION['old_input'] ?? [];
unset($_SESSION['old_input']);
$errors = $_SESSION['errors'] ?? [];
unset($_SESSION['errors']);
$users = \App\Models\User::all();
$seasons = \App\Models\Season::all();
$currentSeason = \App\Models\Season::getCurrent();
?>
<div class="article-form">
<h2>Nieuw Artikel Toevoegen</h2>
<form action="/articles" method="post" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group">
<label for="title">Titel *</label>
<input type="text" name="title" id="title"
value="<?= htmlspecialchars($oldInput['title'] ?? '') ?>"
required class="form-control <?= isset($errors['title']) ? 'error' : '' ?>">
<?php if (isset($errors['title'])): ?>
<span class="error-message"><?= htmlspecialchars($errors['title']) ?></span>
<?php endif; ?>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="content">Inhoud *</label>
<textarea name="content" id="content" rows="10"
required class="form-control <?= isset($errors['content']) ? 'error' : '' ?>"><?= htmlspecialchars($oldInput['content'] ?? '') ?></textarea>
<?php if (isset($errors['content'])): ?>
<span class="error-message"><?= htmlspecialchars($errors['content']) ?></span>
<?php endif; ?>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="event_date">Datum van het evenement *</label>
<input type="date" name="event_date" id="event_date"
value="<?= htmlspecialchars($oldInput['event_date'] ?? date('Y-m-d')) ?>"
required class="form-control <?= isset($errors['event_date']) ? 'error' : '' ?>">
<?php if (isset($errors['event_date'])): ?>
<span class="error-message"><?= htmlspecialchars($errors['event_date']) ?></span>
<?php endif; ?>
</div>
<div class="form-group">
<label for="author_id">Auteur *</label>
<select name="author_id" id="author_id" required
class="form-control <?= isset($errors['author_id']) ? 'error' : '' ?>">
<option value="">-- Selecteer auteur --</option>
<?php foreach ($users as $user): ?>
<option value="<?= $user['id'] ?>"
<?= (($oldInput['author_id'] ?? '') == $user['id'] || (isset($_SESSION['user_id']) && $_SESSION['user_id'] == $user['id'])) ? 'selected' : '' ?>>
<?= htmlspecialchars($user['display_name']) ?>
</option>
<?php endforeach; ?>
</select>
<?php if (isset($errors['author_id'])): ?>
<span class="error-message"><?= htmlspecialchars($errors['author_id']) ?></span>
<?php endif; ?>
</div>
</div>
<div class="form-row">
<div class="form-group full-width">
<label>Deelnemers</label>
<div class="checkbox-group">
<?php foreach ($users as $user): ?>
<label class="checkbox-label">
<input type="checkbox" name="participants[]"
value="<?= $user['id'] ?>"
<?= (isset($oldInput['participants']) && in_array($user['id'], $oldInput['participants'])) ? 'checked' : '' ?>>
<?= htmlspecialchars($user['display_name']) ?>
</label>
<?php endforeach; ?>
</div>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="season_id">Seizoen *</label>
<select name="season_id" id="season_id" required
class="form-control <?= isset($errors['season_id']) ? 'error' : '' ?>">
<option value="">-- Selecteer seizoen --</option>
<?php foreach ($seasons as $season): ?>
<option value="<?= $season['id'] ?>"
<?= (($oldInput['season_id'] ?? '') == $season['id'] || ($currentSeason && $currentSeason['id'] == $season['id'])) ? 'selected' : '' ?>>
<?= htmlspecialchars($season['name']) ?>
(<?= date('d-m-Y', strtotime($season['start_date'])) ?> -
<?= date('d-m-Y', strtotime($season['end_date'])) ?>)
</option>
<?php endforeach; ?>
</select>
<?php if (isset($errors['season_id'])): ?>
<span class="error-message"><?= htmlspecialchars($errors['season_id']) ?></span>
<?php endif; ?>
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="article_image">Afbeelding (optioneel)</label>
<input type="file" name="article_image" id="article_image"
accept="image/*" class="form-control">
<p class="help-text">Upload een foto bij het artikel. tantoon landscape als portret foto's worden ondersteund.</p>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Artikel Opslaan</button>
<a href="/articles" class="btn btn-secondary">Annuleren</a>
</div>
</form>
</div>
<?php
$content = ob_get_clean();
require __DIR__ . '/../layouts/main.php';
?>
+57
View File
@@ -0,0 +1,57 @@
<?php
$page_title = htmlspecialchars($article['title'] ?? 'Artikel');
ob_start();
$participantNames = [];
foreach ($participants as $participant) {
$participantNames[] = htmlspecialchars($participant['display_name']);
}
$participantsString = implode(', ', $participantNames);
?>
<div class="article-detail">
<h2><?= htmlspecialchars($article['title']) ?></h2>
<div class="article-meta">
<span class="meta-item">
<strong>Auteur:</strong> <?= htmlspecialchars($article['author_name'] ?? 'Onbekend') ?>
</span>
<span class="meta-item">
<strong>Datum:</strong> <?= date('d-m-Y', strtotime($article['event_date'])) ?>
</span>
<span class="meta-item">
<strong>Seizoen:</strong> <?= htmlspecialchars($article['season_name'] ?? 'N/A') ?>
</span>
<span class="meta-item">
<strong>Deelnemers:</strong> <?= $participantsString ?>
</span>
<span class="meta-item">
<strong>Status:</strong>
<span class="status-badge <?= strtolower($article['status']) ?>">
<?= htmlspecialchars($article['status']) ?>
</span>
</span>
</div>
<?php if ($article['article_image']): ?>
<div class="article-image-container">
<img src="/<?= htmlspecialchars($article['article_image']) ?>"
alt="<?= htmlspecialchars($article['title']) ?>"
class="article-image">
</div>
<?php endif; ?>
<div class="article-content">
<?= nl2br(htmlspecialchars($article['content'])) ?>
</div>
<div class="article-actions">
<a href="/articles" class="btn btn-secondary">Terug naar Overzicht</a>
<a href="/articles/<?= $article['id'] ?>/edit" class="btn">Bewerken</a>
</div>
</div>
<?php
$content = ob_get_clean();
require __DIR__ . '/../layouts/main.php';
?>
@@ -0,0 +1,50 @@
<?php
$page_title = 'Beveiligingscontrole - Artikel Bewerken';
ob_start();
?>
<div class="passphrase-container">
<h2>Beveiligingscontrole</h2>
<?php if ($article): ?>
<div class="card mb-30">
<h4><?= htmlspecialchars($article['title']) ?></h4>
<p class="text-muted">
Voer het algemene passphrase in om dit artikel te bewerken.
</p>
</div>
<?php endif; ?>
<?php if (isset($_SESSION['error'])): ?>
<div class="alert alert-error">
<?= htmlspecialchars($_SESSION['error']) ?>
<?php unset($_SESSION['error']); ?>
</div>
<?php endif; ?>
<form action="/articles/verify-passphrase" method="post">
<div class="form-group">
<label for="passphrase">Algemeen Passphrase</label>
<input type="password"
name="passphrase"
id="passphrase"
class="form-control"
required
autocomplete="off"
placeholder="Voer het passphrase in">
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
Verifieer en Bewerk Artikel
</button>
<a href="/articles" class="btn btn-secondary">Annuleren</a>
</div>
</form>
</div>
<?php
$content = ob_get_clean();
require __DIR__ . '/../layouts/main.php';
?>
+58
View File
@@ -0,0 +1,58 @@
<?php
$page_title = 'Verifieer Schrijver';
ob_start();
?>
<div class="writer-verification">
<h2>Verifieer Schrijver</h2>
<?php if ($article): ?>
<div class="card mb-30">
<h4><?= htmlspecialchars($article['title']) ?></h4>
<p class="text-muted">
Om dit artikel te bewerken, bevestig aub wie de schrijver is.
</p>
</div>
<?php endif; ?>
<?php if (isset($_SESSION['error'])): ?>
<div class="alert alert-error">
<?= htmlspecialchars($_SESSION['error']) ?>
<?php unset($_SESSION['error']); ?>
</div>
<?php endif; ?>
<form action="/articles/verify-writer" method="post">
<input type="hidden" name="article_id" value="<?= htmlspecialchars($article['id'] ?? '') ?>">
<div class="form-group">
<label for="writer_id">Selecteer de Schrijver *</label>
<select name="writer_id"
id="writer_id"
required
class="form-control">
<option value="">-- Selecteer de schrijver --</option>
<?php foreach ($users as $user): ?>
<option value="<?= $user['id'] ?>"
<?= ($article && $article['author_id'] == $user['id']) ? 'selected' : '' ?>>
<?= htmlspecialchars($user['display_name']) ?>
</option>
<?php endforeach; ?>
</select>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">
Verifieer en Ga Verder
</button>
<a href="/articles" class="btn btn-secondary">
Terug naar Artikelen
</a>
</div>
</form>
</div>
<?php
$content = ob_get_clean();
require __DIR__ . '/../layouts/main.php';
?>