HummingBirdAnimeClient/app/views/anime/cover.php

90 lines
3.4 KiB
PHP
Raw Normal View History

<main>
<?php if ($auth->is_authenticated()): ?>
<a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
<?php endif ?>
<?php if (empty($sections)): ?>
<h3>There's nothing here!</h3>
<?php else: ?>
<?php foreach ($sections as $name => $items): ?>
<section class="status">
2015-09-17 23:11:18 -04:00
<h2><?= $escape->html($name) ?></h2>
<section class="media-wrap">
<?php foreach($items as $item): ?>
<?php if ($item['private'] && ! $auth->is_authenticated()) continue; ?>
2017-01-13 16:49:46 -05:00
<article class="media" data-kitsu-id="<?= $item['id'] ?>" data-mal-id="<?= $item['mal_id'] ?>">
<?php if ($auth->is_authenticated()): ?>
2016-01-04 10:53:03 -05:00
<button title="Increment episode count" class="plus_one" hidden>+1 Episode</button>
<?php endif ?>
2017-01-12 15:41:20 -05:00
<img src="<?= $item['anime']['image'] ?>" alt="" />
2015-06-17 08:50:01 -04:00
<div class="name">
2016-04-08 11:56:17 -04:00
<a href="<?= $url->generate('anime.details', ['id' => $item['anime']['slug']]); ?>">
<?= array_shift($item['anime']['titles']) ?>
<?php foreach ($item['anime']['titles'] as $title): ?>
<br /><small><?= $title ?></small>
<?php endforeach ?>
</a>
</div>
2015-06-17 08:50:01 -04:00
<div class="table">
<?php if ($auth->is_authenticated()): ?>
2016-01-04 10:53:03 -05:00
<div class="row">
<span class="edit">
<a class="bracketed" title="Edit information about this anime" href="<?= $urlGenerator->url("anime/edit/{$item['id']}/{$item['watching_status']}") ?>">Edit</a>
2016-01-04 10:53:03 -05:00
</span>
</div>
<?php endif ?>
2017-01-13 16:49:46 -05:00
2016-01-04 10:53:03 -05:00
<?php if ($item['private'] || $item['rewatching']): ?>
<div class="row">
2016-01-06 11:08:56 -05:00
<?php foreach(['private', 'rewatching'] as $attr): ?>
2016-01-04 10:53:03 -05:00
<?php if($item[$attr]): ?>
<span class="item-<?= $attr ?>"><?= ucfirst($attr) ?></span>
<?php endif ?>
<?php endforeach ?>
</div>
<?php endif ?>
2017-01-13 16:49:46 -05:00
2016-01-06 11:08:56 -05:00
<?php if ($item['rewatched'] > 0): ?>
<div class="row">
<div>Rewatched <?= $item['rewatched'] ?> time(s)</div>
</div>
<?php endif ?>
2017-01-13 16:49:46 -05:00
<?php if (count($item['anime']['streaming_links']) > 0): ?>
<div class="row">
<?php foreach($item['anime']['streaming_links'] as $link): ?>
<div class="cover_streaming_link">
<?php if($link['meta']['link']): ?>
<a href="<?= $link['link']?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
2017-01-13 16:49:46 -05:00
<?= $link['meta']['logo'] ?>
</a>
<?php else: ?>
<?= $link['meta']['logo'] ?>
<?php endif ?>
</div>
<?php endforeach ?>
</div>
<?php endif ?>
2015-06-17 08:50:01 -04:00
<div class="row">
2015-09-28 14:41:45 -04:00
<div class="user_rating">Rating: <?= $item['user_rating'] ?> / 10</div>
<div class="completion">Episodes:
2015-09-28 14:41:45 -04:00
<span class="completed_number"><?= $item['episodes']['watched'] ?></span> /
<span class="total_number"><?= $item['episodes']['total'] ?></span>
</div>
2015-06-17 08:50:01 -04:00
</div>
<div class="row">
2015-09-28 14:41:45 -04:00
<div class="media_type"><?= $escape->html($item['anime']['type']) ?></div>
<div class="airing_status"><?= $escape->html($item['airing']['status']) ?></div>
2015-09-17 23:11:18 -04:00
<div class="age_rating"><?= $escape->html($item['anime']['age_rating']) ?></div>
2015-06-17 08:50:01 -04:00
</div>
</div>
</article>
<?php endforeach ?>
</section>
</section>
<?php endforeach ?>
<?php endif ?>
</main>
<?php if ($auth->is_authenticated()): ?>
<script src="<?= $urlGenerator->asset_url('js.php/g/edit') ?>"></script>
<?php endif ?>