HummingBirdAnimeClient/app/views/user/details.php

160 lines
4.8 KiB
PHP
Raw Normal View History

2018-10-30 11:42:32 -04:00
<?php
use function Aviat\AnimeClient\getLocalImg;
use Aviat\AnimeClient\API\Kitsu;
?>
<main class="user-page details">
2018-11-05 09:56:38 -05:00
<h2 class="toph">
<?= $helper->a(
"https://kitsu.io/users/{$attributes['slug']}",
$attributes['name'], [
'title' => 'View profile on Kitsu'
])
?>
</h2>
<p><?= $escape->html($attributes['about']) ?></p>
2017-03-08 13:46:50 -05:00
<section class="flex flex-no-wrap">
2018-11-05 09:56:38 -05:00
<aside class="info">
2017-03-31 17:01:53 -04:00
<center>
<?php
2018-11-01 22:01:09 -04:00
$avatar = $urlGenerator->assetUrl(
getLocalImg($attributes['avatar']['original'], FALSE)
);
echo $helper->img($avatar, ['alt' => '']);
?>
2017-03-31 17:01:53 -04:00
</center>
2017-03-08 13:46:50 -05:00
<br />
<table class="media-details">
2017-03-08 13:46:50 -05:00
<tr>
<td>Location</td>
<td><?= $attributes['location'] ?></td>
</tr>
2017-03-08 16:21:01 -05:00
<tr>
<td>Website</td>
<td><?= $helper->a($attributes['website'], $attributes['website']) ?></td>
</tr>
<?php if (array_key_exists('waifu', $relationships)): ?>
<tr>
<td><?= $escape->html($attributes['waifuOrHusbando']) ?></td>
<td>
<?php
2017-03-10 12:50:48 -05:00
$character = $relationships['waifu']['attributes'];
2017-03-08 16:21:01 -05:00
echo $helper->a(
$url->generate('character', ['slug' => $character['slug']]),
2018-10-30 11:42:32 -04:00
$character['canonicalName']
2017-03-08 16:21:01 -05:00
);
?>
</td>
</tr>
<?php endif ?>
2018-11-05 09:56:38 -05:00
</table>
<h3>User Stats</h3><br />
<table class="media-details">
2018-10-30 11:42:32 -04:00
<tr>
<td>Time spent watching anime:</td>
<td><?= $timeOnAnime ?></td>
</tr>
2018-11-01 22:01:09 -04:00
<tr>
<td># of Anime episodes watched</td>
2018-11-05 09:56:38 -05:00
<td><?= number_format($stats['anime-amount-consumed']['units']) ?></td>
2018-11-01 22:01:09 -04:00
</tr>
<tr>
<td># of Manga chapters read</td>
2018-11-05 09:56:38 -05:00
<td><?= number_format($stats['manga-amount-consumed']['units']) ?></td>
2018-11-01 22:01:09 -04:00
</tr>
<tr>
<td># of Posts</td>
2018-11-05 09:56:38 -05:00
<td><?= number_format($attributes['postsCount']) ?></td>
</tr>
<tr>
<td># of Comments</td>
2018-11-05 09:56:38 -05:00
<td><?= number_format($attributes['commentsCount']) ?></td>
</tr>
<tr>
<td># of Media Rated</td>
2018-11-05 09:56:38 -05:00
<td><?= number_format($attributes['ratingsCount']) ?></td>
</tr>
2017-03-08 13:46:50 -05:00
</table>
2018-11-05 09:56:38 -05:00
</aside>
<article>
<?php if ( ! empty($favorites)): ?>
2018-10-30 11:42:32 -04:00
<h3>Favorites</h3>
2018-11-05 09:56:38 -05:00
<div class="tabs">
<?php $i = 0 ?>
<?php if ( ! empty($favorites['characters'])): ?>
2018-11-05 09:56:38 -05:00
<input type="radio" name="user-favorites" id="user-fav-chars" <?= $i === 0 ? 'checked' : '' ?> />
<label for="user-fav-chars">Characters</label>
<section class="content full-width media-wrap">
<?php foreach($favorites['characters'] as $id => $char): ?>
<?php if ( ! empty($char['image']['original'])): ?>
2018-11-05 09:56:38 -05:00
<article class="character">
<?php $link = $url->generate('character', ['slug' => $char['slug']]) ?>
2018-10-30 11:42:32 -04:00
<div class="name"><?= $helper->a($link, $char['canonicalName']); ?></div>
<a href="<?= $link ?>">
2018-11-01 22:01:09 -04:00
<?= $helper->picture("images/characters/{$char['id']}.webp") ?>
</a>
</article>
<?php endif ?>
<?php endforeach ?>
</section>
2018-11-05 09:56:38 -05:00
<?php $i++; ?>
<?php endif ?>
<?php if ( ! empty($favorites['anime'])): ?>
2018-11-05 09:56:38 -05:00
<input type="radio" name="user-favorites" id="user-fav-anime" <?= $i === 0 ? 'checked' : '' ?> />
<label for="user-fav-anime">Anime</label>
<section class="content full-width media-wrap">
<?php foreach($favorites['anime'] as $anime): ?>
<article class="media">
<?php
$link = $url->generate('anime.details', ['id' => $anime['slug']]);
$titles = Kitsu::filterTitles($anime);
?>
<a href="<?= $link ?>">
2018-11-01 22:01:09 -04:00
<?= $helper->picture("images/anime/{$anime['id']}.webp") ?>
</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>
2018-11-05 09:56:38 -05:00
<?php $i++; ?>
<?php endif ?>
<?php if ( ! empty($favorites['manga'])): ?>
2018-11-05 09:56:38 -05:00
<input type="radio" name="user-favorites" id="user-fav-manga" <?= $i === 0 ? 'checked' : '' ?> />
<label for="user-fav-manga">Manga</label>
<section class="content full-width media-wrap">
<?php foreach($favorites['manga'] as $manga): ?>
<article class="media">
<?php
$link = $url->generate('manga.details', ['id' => $manga['slug']]);
$titles = Kitsu::filterTitles($manga);
?>
<a href="<?= $link ?>">
2018-11-01 22:01:09 -04:00
<?= $helper->picture("images/manga/{$manga['id']}.webp") ?>
</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>
2018-11-05 09:56:38 -05:00
<?php $i++; ?>
<?php endif ?>
2018-11-05 09:56:38 -05:00
</div>
<?php endif ?>
2018-11-05 09:56:38 -05:00
</article>
2017-03-08 13:46:50 -05:00
</section>
</main>