HummingBirdAnimeClient/app/views/person/details.php

105 lines
3.1 KiB
PHP
Raw Permalink Normal View History

2018-11-01 22:01:09 -04:00
<main class="details fixed">
<section class="flex flex-no-wrap">
<div>
<?= $_->h->img($data['image'], ['class' => 'cover' ]) ?>
2018-11-01 22:01:09 -04:00
</div>
<div>
<h2 class="toph"><?= $data['name'] ?></h2>
<?php foreach ($data['names'] as $name): ?>
<h3><?= $name ?></h3>
<?php endforeach ?>
<?php if ( ! empty($data['birthday'])): ?>
<h4><?= $data['birthday'] ?></h4>
<?php endif ?>
<br />
<hr />
<div class="description">
<p><?= str_replace("\n", '</p><p>', $data['description']) ?></p>
</div>
2018-11-01 22:01:09 -04:00
</div>
</section>
<?php if ( ! empty($data['staff'])): ?>
2018-11-01 22:01:09 -04:00
<section>
<h3>Castings</h3>
2018-11-01 22:01:09 -04:00
<div class="vertical-tabs">
<?php $i = 0 ?>
<?php foreach ($data['staff'] as $role => $entries): ?>
2018-11-01 22:01:09 -04:00
<div class="tab">
<input
type="radio" name="staff-roles" id="staff-role<?= $i ?>" <?= $i === 0 ? 'checked' : '' ?> />
<label for="staff-role<?= $i ?>"><?= $role ?></label>
<?php foreach ($entries as $type => $casting): ?>
<?php if (isset($entries['manga'], $entries['anime'])): ?>
2018-11-01 22:01:09 -04:00
<h4><?= ucfirst($type) ?></h4>
<?php endif ?>
<section class="content media-wrap flex flex-wrap flex-justify-start">
2018-11-01 22:01:09 -04:00
<?php foreach ($casting as $sid => $series): ?>
<?php $mediaType = in_array($type, ['anime', 'manga'], TRUE) ? $type : 'anime'; ?>
<?= $_->component->media(
$series['titles'],
$_->urlFromRoute("{$mediaType}.details", ['id' => $series['slug']]),
$_->h->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
) ?>
2018-11-01 22:01:09 -04:00
<?php endforeach; ?>
</section>
<?php endforeach ?>
</div>
<?php $i++ ?>
<?php endforeach ?>
</div>
</section>
<?php endif ?>
<?php if ( ! empty($data['characters'])): ?>
2018-11-01 22:01:09 -04:00
<section>
<h3>Voice Acting Roles</h3>
<?= $component->tabs('voice-acting-roles', $data['characters'], static function ($characterList) use ($component, $helper, $_) {
$voiceRoles = [];
foreach ($characterList as $cid => $item):
$character = $component->character(
$item['character']['canonicalName'],
$_->urlFromRoute('character', ['slug' => $item['character']['slug']]),
$_->h->img($item['character']['image'], ['loading' => 'lazy']),
);
$medias = [];
foreach ($item['media'] as $sid => $series)
{
$medias[] = $component->media(
$series['titles'],
$_->urlFromRoute('anime.details', ['id' => $series['slug']]),
$_->h->img($series['image'], ['width' => 220, 'loading' => 'lazy'])
);
}
$media = implode('', array_map('mb_trim', $medias));
$voiceRoles[] = <<<HTML
<tr>
<td>{$character}</td>
<td>
<section class="align-left media-wrap">{$media}</section>
</td>
</tr>
HTML;
endforeach;
$roles = implode('', array_map('mb_trim', $voiceRoles));
return <<<HTML
<table class="borderless max-table">
<thead>
<tr>
<th>Character</th>
<th>Series</th>
</tr>
</thead>
<tbody>{$roles}</tbody>
</table>
HTML;
}) ?>
2018-11-01 22:01:09 -04:00
</section>
<?php endif ?>
</main>