AzuraCast/templates/frontend/public/podcast-episode.phtml

96 lines
3.2 KiB
PHTML

<?php
/**
* @var \App\Http\RouterInterface $router
* @var \App\View\GlobalSections $sections
*/
use Carbon\CarbonImmutable;
$this->layout('minimal', [
'page_class' => 'podcasts station-' . $station->getShortName(),
'title' => 'Podcasts - ' . $station->getName(),
'hide_footer' => true,
]);
$this->fetch('frontend/public/partials/station-custom', ['station' => $station]);
$episodeAudioSrc = $router->named(
'api:stations:podcast:episode:download',
[
'station_id' => $station->getId(),
'podcast_id' => $episode->getPodcast()->getId(),
'episode_id' => $episode->getId(),
],
[],
true
);
$publishedAt = CarbonImmutable::createFromTimestamp($episode->getCreatedAt());
if ($episode->getPublishAt() !== null) {
$publishedAt = CarbonImmutable::createFromTimestamp($episode->getPublishAt());
}
$sections->append(
'head',
<<<HTML
<link rel="alternate" type="application/rss+xml" title="{$this->e($podcast->getTitle())}" href="{$feedLink}">
HTML
);
?>
<div class="public-page">
<section class="card" role="region">
<div class="card-body">
<div class="d-flex mb-3">
<div class="flex-fill">
<h1 class="card-title mb-1">
<?= $this->e($podcast->getTitle()) ?>
</h1>
<h2 class="card-subtitle mb-3">
<?= $this->e($episode->getTitle()) ?>
</h2>
<div class="mb-3">
<span class="badge text-bg-dark">
<?= $publishedAt->format('d. M. Y') ?>
</span>
<?php
if ($episode->getExplicit()) : ?>
<span class="badge text-bg-danger"><?= __('Explicit') ?></span>
<?php
endif; ?>
</div>
<p class="card-text"><?= $this->e($episode->getDescription()) ?></p>
</div>
<div class="flex-shrink-0 ps-2" style="max-width: 128px;">
<img src="<?= $router->named(
'api:stations:podcast:episode:art',
[
'station_id' => $station->getId(),
'podcast_id' => $podcast->getId(),
'episode_id' => $episode->getId() . '|' . $episode->getArtUpdatedAt(),
]
); ?>" class="card-img img-fluid"
alt="<?= $this->e($podcast->getTitle()) ?>">
</div>
</div>
<div class="mb-3">
<audio src="<?= $episodeAudioSrc ?>" controls style="width: 100%;"></audio>
</div>
<div class="buttons">
<a href="<?= $podcastEpisodesLink ?>" class="btn btn-sm btn-primary">
<span><?= __('Back') ?></span>
</a>
<a href="<?= $feedLink ?>" class="btn btn-sm btn-warning" target="_blank">
<?= $this->fetch('icons/rss') ?>
<span><?= __('RSS Feed') ?></span>
</a>
</div>
</div>
</section>
</div>