HummingBirdAnimeClient/app/views/character.php

240 lines
7.2 KiB
PHP
Raw Normal View History

<?php
use function Aviat\AnimeClient\getLocalImg;
use Aviat\AnimeClient\API\Kitsu;
?>
<main class="details fixed">
2017-03-08 13:46:50 -05:00
<section class="flex flex-no-wrap">
2018-10-30 13:05:49 -04:00
<div>
<picture>
<source srcset="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.webp") ?>" type="image/webp">
<source srcset="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.jpg") ?>" type="image/jpeg">
<img src="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.jpg") ?>" alt="" />
</picture>
<?php if ( ! empty($data[0]['attributes']['otherNames'])): ?>
<h3>Nicknames / Other names</h3>
<?php foreach ($data[0]['attributes']['otherNames'] as $name): ?>
<h4><?= $name ?></h4>
<?php endforeach ?>
<?php endif ?>
2018-10-30 13:05:49 -04:00
</div>
<div>
<h2><?= $data['name'] ?></h2>
<?php foreach ($data['names'] as $name): ?>
<h3><?= $name ?></h3>
<?php endforeach ?>
<hr />
2017-03-08 13:46:50 -05:00
2017-04-05 13:02:48 -04:00
<p class="description"><?= $data[0]['attributes']['description'] ?></p>
2018-10-30 13:05:49 -04:00
</div>
2017-03-08 13:46:50 -05:00
</section>
2017-04-05 13:02:48 -04:00
<?php if (array_key_exists('anime', $data['included']) || array_key_exists('manga', $data['included'])): ?>
<h3>Media</h3>
2018-10-30 11:42:32 -04:00
<div class="tabs">
2017-04-05 13:02:48 -04:00
<?php if (array_key_exists('anime', $data['included'])): ?>
2018-10-30 11:42:32 -04:00
<input checked="checked" type="radio" id="media-anime" name="media-tabs" />
<label for="media-anime"><h4> Anime </h4></label>
<section class="align_left media-wrap content">
<?php foreach($data['included']['anime'] as $id => $anime): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $anime['attributes']['slug']]);
$titles = Kitsu::filterTitles($anime['attributes']);
?>
<a href="<?= $link ?>">
<picture>
<source
srcset="<?= $urlGenerator->assetUrl("images/anime/{$id}.webp") ?>"
type="image/webp"
>
<source
srcset="<?= $urlGenerator->assetUrl("images/anime/{$id}.jpg") ?>"
type="image/jpeg"
>
<img
src="<?= $urlGenerator->assetUrl("images/anime/{$id}.jpg") ?>"
alt=""
/>
</picture>
</a>
<div class="name">
2017-04-05 13:02:48 -04:00
<a href="<?= $link ?>">
2018-10-30 11:42:32 -04:00
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
2017-04-05 13:02:48 -04:00
</a>
2018-10-30 11:42:32 -04:00
</div>
</article>
<?php endforeach ?>
</section>
2017-04-05 13:02:48 -04:00
<?php endif ?>
2018-10-30 11:42:32 -04:00
2017-04-05 13:02:48 -04:00
<?php if (array_key_exists('manga', $data['included'])): ?>
2018-10-30 11:42:32 -04:00
<input type="radio" id="media-manga" name="media-tabs" />
<label for="media-manga"><h4>Manga</h4></label>
2017-04-05 13:02:48 -04:00
2018-10-30 11:42:32 -04:00
<section class="align_left media-wrap content">
<?php foreach($data['included']['manga'] as $id => $manga): ?>
<article class="media">
<?php
$link = $url->generate('manga.details', ['id' => $manga['attributes']['slug']]);
$titles = Kitsu::filterTitles($manga['attributes']);
?>
<a href="<?= $link ?>">
<img src="<?= $urlGenerator->assetUrl("images/manga/{$id}.jpg") ?>" width="220" alt="" />
</a>
<div class="name">
2017-04-05 13:02:48 -04:00
<a href="<?= $link ?>">
2018-10-30 11:42:32 -04:00
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
2017-04-05 13:02:48 -04:00
</a>
2018-10-30 11:42:32 -04:00
</div>
</article>
<?php endforeach ?>
</section>
2017-04-05 13:02:48 -04:00
<?php endif ?>
2018-10-30 11:42:32 -04:00
</div>
2017-04-05 13:02:48 -04:00
<?php endif ?>
<section>
<?php if ($castCount > 0): ?>
2017-04-05 13:02:48 -04:00
<h3>Castings</h3>
2018-10-30 11:42:32 -04:00
<?php
$vas = $castings['Voice Actor'];
unset($castings['Voice Actor']);
ksort($vas)
?>
<?php if ( ! empty($vas)): ?>
<h4>Voice Actors</h4>
<div class="tabs">
<?php $i = 0; ?>
<?php foreach($vas as $language => $casting): ?>
<input <?= $i === 0 ? 'checked="checked"' : '' ?> type="radio" id="character-va<?= $i ?>"
name="character-vas"
/>
<label for="character-va<?= $i ?>"><h5><?= $language ?></h5></label>
<section class="content">
<table style='width:100%'>
<tr>
<th>Cast Member</th>
<th>Series</th>
</tr>
<?php foreach($casting as $cid => $c): ?>
<tr>
<td style="width:229px">
<article class="character">
<?php
$link = $url->generate('person', ['id' => $c['person']['id']]);
?>
<a href="<?= $link ?>">
<img
src="<?= $urlGenerator->assetUrl(getLocalImg($c['person']['image'])) ?>"
alt=""
/>
<div class="name">
<?= $c['person']['name'] ?>
</div>
</a>
</article>
</td>
<td>
2018-10-30 13:05:49 -04:00
<section class="align_left media-wrap-flex">
2018-10-30 11:42:32 -04:00
<?php foreach ($c['series'] as $series): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]);
$titles = Kitsu::filterTitles($series['attributes']);
?>
<a href="<?= $link ?>">
<img
src="<?= $urlGenerator->assetUrl(getLocalImg($series['attributes']['posterImage']['small'])) ?>"
width="220" alt=""
/>
</a>
<div class="name">
<a href="<?= $link ?>">
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br />
<small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
</article>
<?php endforeach ?>
</section>
</td>
</tr>
<?php endforeach ?>
</table>
</section>
<?php $i++ ?>
<?php endforeach ?>
</div>
<?php endif ?>
2017-04-05 13:02:48 -04:00
<?php foreach($castings as $role => $entries): ?>
<h4><?= $role ?></h4>
<?php foreach($entries as $language => $casting): ?>
<h5><?= $language ?></h5>
<table class="min-table">
<tr>
<th>Cast Member</th>
<th>Series</th>
</tr>
<?php foreach($casting as $cid => $c):?>
2017-04-05 13:02:48 -04:00
<tr>
<td style="width:229px">
<article class="character">
<?php
$link = $url->generate('person', ['id' => $c['person']['id']]);
?>
<a href="<?= $link ?>">
<img src="<?= $urlGenerator->assetUrl(getLocalImg($c['person']['image'])) ?>" alt="" />
2017-04-05 13:02:48 -04:00
<div class="name">
<?= $c['person']['name'] ?>
</div>
</a>
2017-04-05 13:02:48 -04:00
</article>
</td>
<td>
<section class="align_left media-wrap">
<?php foreach($c['series'] as $series): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]);
$titles = Kitsu::filterTitles($series['attributes']);
?>
<a href="<?= $link ?>">
<img src="<?= $urlGenerator->assetUrl(getLocalImg($series['attributes']['posterImage']['small'])) ?>" width="220" alt="" />
2017-04-05 13:02:48 -04:00
</a>
<div class="name">
<a href="<?= $link ?>">
<?= array_shift($titles) ?>
<?php foreach ($titles as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
</article>
<?php endforeach ?>
</section>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endforeach ?>
<?php endforeach ?>
<?php endif ?>
</section>
2017-03-08 12:55:49 -05:00
</main>