feat: add DWZ-Liste template with data fetching, sorting, and rendering functionality
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
// Daten abrufen und deserialisieren
|
||||
$url = 'https://www.schachbund.de/php/dewis/verein.php?zps=25318&format=array';
|
||||
$data = @file_get_contents($url);
|
||||
$players = $data ? @unserialize($data) : [];
|
||||
|
||||
function safe($val) {
|
||||
return $val === null || $val === false || $val === '' || $val === 'N' ? '-' : htmlspecialchars($val);
|
||||
}
|
||||
|
||||
// Nach DWZ absteigend sortieren
|
||||
if ($players && is_array($players)) {
|
||||
usort($players, function($a, $b) {
|
||||
$dwzA = isset($a['dwz']) && is_numeric($a['dwz']) ? (int)$a['dwz'] : 0;
|
||||
$dwzB = isset($b['dwz']) && is_numeric($b['dwz']) ? (int)$b['dwz'] : 0;
|
||||
return $dwzB <=> $dwzA;
|
||||
});
|
||||
}
|
||||
?>
|
||||
<section class="py-24 bg-sf_grau-50">
|
||||
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
||||
<table class="min-w-full border border-sf_blau-200 rounded-xl overflow-hidden">
|
||||
<thead class="bg-sf_blau-600 text-white font-bold">
|
||||
<tr>
|
||||
<th class="px-3 py-2">Platz</th>
|
||||
<th class="px-3 py-2">Mitgl.</th>
|
||||
<th class="px-3 py-2">Titel</th>
|
||||
<th class="px-3 py-2">Name</th>
|
||||
<th class="px-3 py-2">DWZ</th>
|
||||
<th class="px-3 py-2">ELO</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if ($players && is_array($players)): ?>
|
||||
<?php $platz = 1; foreach ($players as $p): ?>
|
||||
<tr class="even:bg-sf_grau-100 odd:bg-white">
|
||||
<td class="px-3 py-2 text-center"><?php echo $platz++; ?></td>
|
||||
<td class="px-3 py-2 text-center"><?php echo safe($p['mglnr']); ?></td>
|
||||
<td class="px-3 py-2 text-center"><?php echo safe($p['titel']); ?></td>
|
||||
<td class="px-3 py-2 font-semibold text-xl text-sf_blau-500 hover:text-sf_gelb-300">
|
||||
<a href="http://www.schachbund.de/spieler.html?pkz=<?php echo safe($p['id']); ?>" target="_blank">
|
||||
<?php echo safe($p['nachname'] . ', ' . $p['vorname']); ?></td>
|
||||
</a>
|
||||
<td class="px-3 py-2 text-right text-xl"><?php echo safe($p['dwz']); ?>-<?php echo safe($p['dwzindex']); ?></td>
|
||||
<td class="px-3 py-2 text-right text-xl"><?php echo safe($p['fideelo']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<tr><td colspan="6" class="px-3 py-4 text-center text-red-500">Keine Daten verfügbar.</td></tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,14 @@
|
||||
<section class="bg-sf_blau-500 py-24" id="titel">
|
||||
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-1 lg:gap-12 lg:grid lg:grid-cols-2 text-red-50">
|
||||
<div class="w-full max-w-lg">
|
||||
<h1 class="text-6xl font-bold"><?= $page->title() ?></h1>
|
||||
</div>
|
||||
<div class="w-full max-w-lg">
|
||||
<p class="lg:pt-0 pt-6 text-xl"><?= $page->heroText() ?></p>
|
||||
<div class="mt-6 flex flex-wrap gap-4 md:mt-8"> <a href="<?= $page->buttonLink() ?>" class="hover:cursor-pointer hover:text-sf_gelb-500" target="_blank"><button class="rounded-button inline-flex gap-3 items-center justify-center whitespace-nowrap transition-all duration-200 ease-in-out disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none border border-border-primary text-text-primary bg-background-primary px-6 py-3" title="Kontakt" type="button"><?= $page->heroButton() ?></button></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user