rinkplanner/hub/views/routine.php

94 lines
4.5 KiB
PHP
Raw Normal View History

<?php /** @var array $routine */ ?>
<?php /** @var bool $can_edit */ ?>
<?php /** @var bool $is_admin */ ?>
<?php $audioName = $routine['audio_original_name'] ?? ''; ?>
<article class="detail">
<div class="page-head">
<div>
<p class="eyebrow"><a href="<?= e(url('/')) ?>">Küren</a> / Kür</p>
<h1><?= e($routine['title']) ?></h1>
<p class="muted">
<?= e($routine['owner_display_name'] ?: $routine['owner_username']) ?>
· Revision <?= (int) ($routine['revision'] ?? 0) ?>
· <?= e(fmt_dt($routine['updated_at'])) ?>
<?php if ($routine['status'] !== 'published'): ?>
· <span class="badge">versteckt</span>
<?php endif; ?>
</p>
</div>
<div class="actions">
<?php if (!empty($routine['routine_path'])): ?>
<a class="button primary" href="<?= e(url('/routines/' . (int) $routine['id'] . '/download')) ?>">Kür herunterladen</a>
<?php endif; ?>
<?php if ($audioName !== ''): ?>
<a class="button" href="<?= e(url('/routines/' . (int) $routine['id'] . '/audio')) ?>">Musik herunterladen</a>
<?php endif; ?>
</div>
</div>
<?php if ($can_edit): ?>
<div class="owner-bar">
<span class="muted">Du kannst diese Kür verwalten.</span>
<a class="button small" href="<?= e(url('/routines/' . (int) $routine['id'] . '/revise')) ?>">Neue Revision hochladen</a>
<?php if ($routine['status'] === 'published'): ?>
<form class="inline" method="post" action="<?= e(url('/routines/' . (int) $routine['id'] . '/hide')) ?>">
<?= csrf_field() ?>
<button class="button small danger-ghost" type="submit">Aus dem Hub nehmen</button>
</form>
<?php else: ?>
<form class="inline" method="post" action="<?= e(url('/routines/' . (int) $routine['id'] . '/publish')) ?>">
<?= csrf_field() ?>
<button class="button small" type="submit">Wieder veröffentlichen</button>
</form>
<?php endif; ?>
<?php if ($is_admin): ?>
<a class="button small danger-ghost" href="<?= e(url('/admin/routines?q=' . rawurlencode($routine['title']))) ?>">In der Verwaltung öffnen</a>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if (!empty($routine['description'])): ?>
<section class="panel">
<h2>Beschreibung</h2>
<p class="preline"><?= e($routine['description']) ?></p>
</section>
<?php endif; ?>
<?php if ($audioName !== ''): ?>
<section class="panel">
<h2>Musik</h2>
<audio controls preload="none" src="<?= e(url('/routines/' . (int) $routine['id'] . '/audio')) ?>"></audio>
<p class="muted small"><?= e($audioName) ?> · <?= e(human_bytes((int) ($routine['audio_bytes'] ?? 0))) ?></p>
</section>
<?php endif; ?>
<section class="panel">
<h2>Details</h2>
<dl class="facts">
<div><dt>Skater</dt><dd><?= e($routine['skater_name'] ?: '–') ?></dd></div>
<div><dt>Kategorie</dt><dd><?= e($routine['category'] ?: '–') ?></dd></div>
<div><dt>Musiktitel</dt><dd><?= e($routine['music_title'] ?: '–') ?></dd></div>
<div><dt>Musik</dt><dd><?= e($routine['music_artist'] ?: '–') ?></dd></div>
<div><dt>Kür-Datei</dt><dd><?= e($routine['routine_original_name'] ?? '–') ?> · <?= e(human_bytes((int) ($routine['routine_bytes'] ?? 0))) ?></dd></div>
<div><dt>Audio-Datei</dt><dd><?= e($audioName !== '' ? $audioName . ' · ' . human_bytes((int) ($routine['audio_bytes'] ?? 0)) : '–') ?></dd></div>
<div><dt>Downloads</dt><dd><?= (int) $routine['download_count'] ?></dd></div>
<div><dt>Eingestellt</dt><dd><?= e(fmt_dt($routine['created_at'])) ?></dd></div>
</dl>
</section>
<section class="panel">
<h2>Prüfsummen</h2>
<div class="hash">
<span>Kür</span>
<code><?= e($routine['routine_sha256'] ?? '–') ?></code>
</div>
<?php if ($audioName !== ''): ?>
<div class="hash">
<span>Musik</span>
<code><?= e($routine['audio_sha256'] ?? '–') ?></code>
</div>
<?php endif; ?>
<p class="muted small">Beim Download prüfen, ob die SHA-256-Summe zur Kür passt.</p>
</section>
</article>