V0.9
This commit is contained in:
+123
-12
@@ -1,13 +1,124 @@
|
||||
<?php if (!$channels): ?>
|
||||
<div class="empty">
|
||||
Keine Sender gefunden. Prüfe <code>/opt/tvguide-docker/epg/guide.xml</code>.
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
require_once __DIR__ . '/../src/Services/LogoService.php';
|
||||
|
||||
<?php foreach ($channels as $channelId => $channel): ?>
|
||||
<?php View::render('channel', [
|
||||
'channelId' => $channelId,
|
||||
'channel' => $channel,
|
||||
'programmes' => $programmes[$channelId] ?? []
|
||||
]); ?>
|
||||
<?php endforeach; ?>
|
||||
$now = new DateTimeImmutable('now', new DateTimeZone('Europe/Vienna'));
|
||||
$upcoming = [];
|
||||
$primetime = [];
|
||||
|
||||
foreach ($programmes as $channelId => $items) {
|
||||
$channel = $channels[$channelId] ?? null;
|
||||
|
||||
if (!$channel) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($items as $p) {
|
||||
$start = $p['start'];
|
||||
$stop = $p['stop'];
|
||||
|
||||
if ($start >= $now && $start <= $now->modify('+30 minutes')) {
|
||||
$upcoming[] = [
|
||||
'channel_id' => $channelId,
|
||||
'channel' => $channel,
|
||||
'programme' => $p,
|
||||
];
|
||||
}
|
||||
|
||||
if ($start->format('Y-m-d') === $now->format('Y-m-d')
|
||||
&& $start->format('H:i') >= '20:00'
|
||||
&& $start->format('H:i') <= '23:00') {
|
||||
$primetime[] = [
|
||||
'channel_id' => $channelId,
|
||||
'channel' => $channel,
|
||||
'programme' => $p,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
usort($upcoming, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
|
||||
usort($primetime, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
|
||||
|
||||
$favoritesNow = array_values(array_filter(
|
||||
$currentProgrammes,
|
||||
fn($item) => !empty($item['favorite'])
|
||||
));
|
||||
?>
|
||||
|
||||
<section class="dashboard-hero">
|
||||
<div>
|
||||
<h2>TVGuide</h2>
|
||||
<p>Dein Überblick für jetzt, gleich und heute Abend.</p>
|
||||
</div>
|
||||
<a class="button-link" href="/?view=day">Tagesansicht öffnen</a>
|
||||
</section>
|
||||
|
||||
<div class="dashboard-grid">
|
||||
<section class="dashboard-panel">
|
||||
<h3>🔥 Jetzt läuft</h3>
|
||||
|
||||
<?php foreach (array_slice($currentProgrammes, 0, 6) as $item): ?>
|
||||
<a class="dashboard-item" href="/?view=now">
|
||||
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($item['title']) ?></strong>
|
||||
<span><?= htmlspecialchars($item['channel_name']) ?> · noch <?= (int)$item['remaining_minutes'] ?> Min.</span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-panel">
|
||||
<h3>⏰ Beginnt gleich</h3>
|
||||
|
||||
<?php foreach (array_slice($upcoming, 0, 6) as $item): ?>
|
||||
<a class="dashboard-item" href="/?view=day">
|
||||
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($item['programme']['title']) ?></strong>
|
||||
<span><?= $item['programme']['start']->format('H:i') ?> · <?= htmlspecialchars($item['channel']['name']) ?></span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (!$upcoming): ?>
|
||||
<div class="empty compact">In den nächsten 30 Minuten beginnt keine Sendung.</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-panel">
|
||||
<h3>⭐ Favoriten jetzt</h3>
|
||||
|
||||
<?php foreach (array_slice($favoritesNow, 0, 6) as $item): ?>
|
||||
<a class="dashboard-item" href="/?view=favorites">
|
||||
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($item['title']) ?></strong>
|
||||
<span><?= htmlspecialchars($item['channel_name']) ?> · <?= (int)$item['percent'] ?>%</span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (!$favoritesNow): ?>
|
||||
<div class="empty compact">Aktuell läuft auf deinen Favoriten nichts.</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<section class="dashboard-panel">
|
||||
<h3>📺 Heute Abend</h3>
|
||||
|
||||
<?php foreach (array_slice($primetime, 0, 8) as $item): ?>
|
||||
<a class="dashboard-item" href="/?view=day">
|
||||
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
|
||||
<div>
|
||||
<strong><?= htmlspecialchars($item['programme']['title']) ?></strong>
|
||||
<span><?= $item['programme']['start']->format('H:i') ?> · <?= htmlspecialchars($item['channel']['name']) ?></span>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if (!$primetime): ?>
|
||||
<div class="empty compact">Für heute Abend wurden keine Sendungen gefunden.</div>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user