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

117 lines
4.6 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]);
$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">
<h1 class="card-title mb-1">
<?= $this->e($podcast->getTitle()) ?>
</h1>
<h2 class="card-subtitle mb-3">
<?= __('Episodes') ?>
</h2>
<div class="buttons mb-3">
<a href="<?= $podcastsLink ?>" 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>
<?php
/** @var App\Entity\PodcastEpisode $episode */
foreach ($episodes as $episode) : ?>
<?php
$episodePageLink = $router->named(
'public:podcast:episode',
[
'station_id' => $station->getId(),
'podcast_id' => $podcast->getId(),
'episode_id' => $episode->getId(),
]
) ?>
<div class="d-flex align-items-center mb-3">
<div class="flex-shrink-0 pe-2" style="max-width: 128px">
<a href="<?= $this->e($episodePageLink) ?>" title="<?= __('View Details') ?>">
<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()) ?>">
</a>
</div>
<div class="flex-fill">
<h5 class="card-title"><?= $this->e($episode->getTitle()) ?></h5>
<p class="card-text"><?= $this->e($episode->getDescription()) ?></p>
<?php
if ($episode->getExplicit()) : ?>
<p class="card-text">
<small class="text-warning-emphasis"><?= __('Contains explicit content') ?></small>
</p>
<?php
endif; ?>
<p class="card-text">
<?php
$publishedAt = CarbonImmutable::createFromTimestamp(
$episode->getCreatedAt()
); ?>
<?php
if ($episode->getPublishAt() !== null) : ?>
<?php
$publishedAt = CarbonImmutable::createFromTimestamp(
$episode->getPublishAt()
); ?>
<?php
endif; ?>
<span class="badge badge-pill badge-dark" data-toggle="tooltip"
data-placement="right" data-html="true"
title="<?= $publishedAt->format(
'H:i'
) ?>"><?= $publishedAt->format('d. M. Y') ?></span>
</p>
<div class="block-buttons">
<a href="<?= $this->e($episodePageLink) ?>" class="btn btn-primary">
<?= __('View Details') ?>
</a>
</div>
</div>
</div>
<?php
endforeach; ?>
</div>
</section>
</div>