| Server IP : 202.61.199.114 / Your IP : 216.73.217.139 Web Server : nginx/1.22.1 System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web20 ( 1018) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/arni-solutions.de/web/test/ |
Upload File : |
<?php
declare(strict_types=1);
require __DIR__ . '/includes/bootstrap.php';
$user = require_user();
$tests = load_tests(true);
render_header('Dashboard');
?>
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<h1 class="h2 mb-1">Verfügbare Tests</h1>
<p class="text-muted mb-0">Du kannst jeden Test starten, erneut öffnen und deine Antworten bearbeiten.</p>
</div>
</div>
<?php if ($tests === []): ?>
<div class="alert alert-warning">Es sind aktuell noch keine aktiven Tests importiert.</div>
<?php else: ?>
<div class="row g-4">
<?php foreach ($tests as $test): ?>
<?php
$slug = (string)$test['meta']['slug'];
$submission = load_submission($slug, $user['email']);
$hasSubmission = !empty($submission);
$completed = $hasSubmission && (($submission['status'] ?? '') === 'completed');
?>
<div class="col-lg-6">
<div class="card card-soft h-100">
<div class="card-body p-4">
<h2 class="h4 mb-2"><?= e((string)$test['meta']['title']) ?></h2>
<p class="text-muted"><?= e((string)($test['meta']['description'] ?? '')) ?></p>
<div class="small text-muted mb-3">
<?= count($test['questions']) ?> Fragen ·
<?php if ($completed): ?>
bereits ausgefüllt
<?php elseif ($hasSubmission): ?>
in Bearbeitung
<?php else: ?>
noch nicht gestartet
<?php endif; ?>
</div>
<?php if ($completed && !empty($submission['result']['winner']['title'])): ?>
<div class="alert alert-success py-2">
Letztes Ergebnis: <strong><?= e((string)$submission['result']['winner']['title']) ?></strong>
</div>
<?php endif; ?>
<div class="d-flex gap-2">
<a class="btn btn-primary" href="test.php?slug=<?= urlencode($slug) ?>">
<?= $hasSubmission ? 'Bearbeiten / Öffnen' : 'Test starten' ?>
</a>
<?php if ($completed): ?>
<a class="btn btn-outline-secondary" href="result.php?slug=<?= urlencode($slug) ?>">Ergebnis ansehen</a>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php render_footer(); ?>