2018-11-01 22:01:09 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use function Aviat\AnimeClient\getLocalImg;
|
|
|
|
use Aviat\AnimeClient\API\Kitsu;
|
|
|
|
|
|
|
|
?>
|
2019-08-10 10:07:28 -04:00
|
|
|
<main class="character-page details fixed">
|
2018-11-01 22:01:09 -04:00
|
|
|
<section class="flex flex-no-wrap">
|
2019-08-10 10:07:28 -04:00
|
|
|
<aside>
|
2018-11-08 11:36:42 -05:00
|
|
|
<?= $helper->picture("images/characters/{$data['id']}-original.webp") ?>
|
2019-08-10 10:07:28 -04:00
|
|
|
</aside>
|
2018-11-01 22:01:09 -04:00
|
|
|
<div>
|
|
|
|
<h2 class="toph"><?= $data['name'] ?></h2>
|
|
|
|
<?php foreach ($data['names'] as $name): ?>
|
|
|
|
<h3><?= $name ?></h3>
|
|
|
|
<?php endforeach ?>
|
|
|
|
|
2019-05-08 16:08:51 -04:00
|
|
|
<?php if ( ! empty($data['otherNames'])): ?>
|
|
|
|
<h4>Also Known As:</h4>
|
|
|
|
<ul>
|
|
|
|
<?php foreach ($data['otherNames'] as $name): ?>
|
|
|
|
<li><h5><?= $name ?></h5></li>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</ul>
|
|
|
|
<?php endif ?>
|
|
|
|
<br />
|
2018-11-01 22:01:09 -04:00
|
|
|
<hr />
|
2019-05-08 16:08:51 -04:00
|
|
|
<div class="description">
|
|
|
|
<p><?= str_replace("\n", '</p><p>', $data['description']) ?></p>
|
|
|
|
</div>
|
2018-11-01 22:01:09 -04:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
2018-12-07 10:22:16 -05:00
|
|
|
<?php if ( ! (empty($data['media']['anime']) || empty($data['media']['manga']))): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<h3>Media</h3>
|
|
|
|
<div class="tabs">
|
2018-12-07 10:22:16 -05:00
|
|
|
<?php if ( ! empty($data['media']['anime'])): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<input checked="checked" type="radio" id="media-anime" name="media-tabs" />
|
|
|
|
<label for="media-anime">Anime</label>
|
|
|
|
|
|
|
|
<section class="media-wrap content">
|
2018-11-08 11:36:42 -05:00
|
|
|
<?php foreach ($data['media']['anime'] as $id => $anime): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<article class="media">
|
|
|
|
<?php
|
2020-08-17 14:01:55 -04:00
|
|
|
$link = $url->generate('anime.details', ['id' => $anime['slug']]);
|
2018-11-01 22:01:09 -04:00
|
|
|
?>
|
|
|
|
<a href="<?= $link ?>">
|
2020-08-17 14:01:55 -04:00
|
|
|
<?= $helper->picture("images/anime/{$anime['id']}.webp") ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
</a>
|
|
|
|
<div class="name">
|
|
|
|
<a href="<?= $link ?>">
|
2020-08-17 16:36:55 -04:00
|
|
|
<?= $anime['title'] ?>
|
|
|
|
<?php foreach ($anime['titles'] as $title): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<br />
|
|
|
|
<small><?= $title ?></small>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</section>
|
|
|
|
<?php endif ?>
|
|
|
|
|
2018-12-07 10:22:16 -05:00
|
|
|
<?php if ( ! empty($data['media']['manga'])): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<input type="radio" id="media-manga" name="media-tabs" />
|
|
|
|
<label for="media-manga">Manga</label>
|
|
|
|
|
|
|
|
<section class="media-wrap content">
|
2018-11-08 11:36:42 -05:00
|
|
|
<?php foreach ($data['media']['manga'] as $id => $manga): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<article class="media">
|
|
|
|
<?php
|
2020-08-17 14:01:55 -04:00
|
|
|
$link = $url->generate('manga.details', ['id' => $manga['slug']]);
|
2018-11-01 22:01:09 -04:00
|
|
|
?>
|
|
|
|
<a href="<?= $link ?>">
|
2020-08-17 14:01:55 -04:00
|
|
|
<?= $helper->picture("images/manga/{$manga['id']}.webp") ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
</a>
|
|
|
|
<div class="name">
|
|
|
|
<a href="<?= $link ?>">
|
2020-08-17 16:36:55 -04:00
|
|
|
<?= $manga['title'] ?>
|
|
|
|
<?php foreach ($manga['titles'] as $title): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<br />
|
|
|
|
<small><?= $title ?></small>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
<?php endforeach ?>
|
|
|
|
</section>
|
|
|
|
<?php endif ?>
|
|
|
|
</div>
|
|
|
|
<?php endif ?>
|
|
|
|
|
|
|
|
<section>
|
2018-11-08 11:36:42 -05:00
|
|
|
<?php if (count($data['castings']) > 0): ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<h3>Castings</h3>
|
|
|
|
<?php
|
2018-11-08 11:36:42 -05:00
|
|
|
$vas = $data['castings']['Voice Actor'];
|
|
|
|
unset($data['castings']['Voice Actor']);
|
|
|
|
ksort($vas)
|
2018-11-01 22:01:09 -04:00
|
|
|
?>
|
|
|
|
|
2018-11-08 11:36:42 -05:00
|
|
|
<?php foreach ($data['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): ?>
|
|
|
|
<tr>
|
2018-11-08 14:18:24 -05:00
|
|
|
<td>
|
2018-11-08 11:36:42 -05:00
|
|
|
<article class="character">
|
|
|
|
<?php
|
|
|
|
$link = $url->generate('person', ['id' => $c['person']['id']]);
|
|
|
|
?>
|
|
|
|
<a href="<?= $link ?>">
|
|
|
|
<?= $helper->picture(getLocalImg($c['person']['image'], TRUE)) ?>
|
|
|
|
<div class="name">
|
|
|
|
<?= $c['person']['name'] ?>
|
|
|
|
</div>
|
|
|
|
</a>
|
|
|
|
</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 ?>">
|
|
|
|
<?= $helper->picture(getLocalImg($series['attributes']['posterImage']['small'], TRUE)) ?>
|
|
|
|
</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 ?>
|
|
|
|
|
2018-11-01 22:01:09 -04:00
|
|
|
<?php if ( ! empty($vas)): ?>
|
|
|
|
<h4>Voice Actors</h4>
|
|
|
|
|
2020-08-21 12:30:01 -04:00
|
|
|
<?= $component->tabs('character-vas', $vas, static function ($casting) use ($url, $component, $helper) {
|
|
|
|
$castings = [];
|
|
|
|
foreach ($casting as $id => $c):
|
|
|
|
$person = $component->character(
|
|
|
|
$c['person']['name'],
|
|
|
|
$url->generate('person', [
|
|
|
|
'id' => $c['person']['id'],
|
|
|
|
'slug' => $c['person']['slug']
|
|
|
|
]),
|
|
|
|
$helper->picture(getLocalImg($c['person']['image']))
|
|
|
|
);
|
|
|
|
$medias = array_map(fn ($series) => $component->media(
|
|
|
|
array_merge([$series['title']], $series['titles']),
|
|
|
|
$url->generate('anime.details', ['id' => $series['slug']]),
|
|
|
|
$helper->picture(getLocalImg($series['posterImage'], TRUE))
|
|
|
|
), $c['series']);
|
|
|
|
$media = implode('', array_map('mb_trim', $medias));
|
2018-11-01 22:01:09 -04:00
|
|
|
|
2020-08-21 12:30:01 -04:00
|
|
|
$castings[] = <<<HTML
|
|
|
|
<tr>
|
|
|
|
<td>{$person}</td>
|
|
|
|
<td width="75%">
|
|
|
|
<section class="align-left media-wrap-flex">
|
|
|
|
{$media}
|
|
|
|
</section>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
HTML;
|
|
|
|
endforeach;
|
|
|
|
|
|
|
|
$languages = implode('', array_map('mb_trim', $castings));
|
|
|
|
|
|
|
|
return <<<HTML
|
|
|
|
<table class="borderless max-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Cast Member</th>
|
|
|
|
<th>Series</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>{$languages}</tbody>
|
|
|
|
</table>
|
|
|
|
HTML;
|
|
|
|
}, 'content') ?>
|
2018-11-01 22:01:09 -04:00
|
|
|
<?php endif ?>
|
|
|
|
<?php endif ?>
|
|
|
|
</section>
|
|
|
|
</main>
|