API client for Kitsu.io, with optional Anime collection, and optional Anilist syncing.
anime
manga
kitsu
anilist
single-user

cover.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <main>
  2. <?php if ($auth->isAuthenticated()): ?>
  3. <a class="bracketed" href="<?= $url->generate('anime.add.get') ?>">Add Item</a>
  4. <?php endif ?>
  5. <?php if (empty($sections)): ?>
  6. <h3>There's nothing here!</h3>
  7. <?php else: ?>
  8. <?php foreach ($sections as $name => $items): ?>
  9. <?php if (empty($items)): ?>
  10. <section class="status">
  11. <h2><?= $escape->html($name) ?></h2>
  12. <h3>There's nothing here!</h3>
  13. </section>
  14. <?php else: ?>
  15. <section class="status">
  16. <h2><?= $escape->html($name) ?></h2>
  17. <section class="media-wrap">
  18. <?php foreach($items as $item): ?>
  19. <?php if ($item['private'] && ! $auth->isAuthenticated()) continue; ?>
  20. <article class="media" data-kitsu-id="<?= $item['id'] ?>" data-mal-id="<?= $item['mal_id'] ?>">
  21. <?php if ($auth->isAuthenticated()): ?>
  22. <button title="Increment episode count" class="plus_one" hidden>+1 Episode</button>
  23. <?php endif ?>
  24. <img src="<?= $urlGenerator->assetUrl("images/anime/{$item['anime']['id']}.jpg") ?>" alt="" />
  25. <div class="name">
  26. <a href="<?= $url->generate('anime.details', ['id' => $item['anime']['slug']]); ?>">
  27. <?= $item['anime']['title'] ?>
  28. <?php foreach ($item['anime']['titles'] as $title): ?>
  29. <br /><small><?= $title ?></small>
  30. <?php endforeach ?>
  31. </a>
  32. </div>
  33. <div class="table">
  34. <?php if ($auth->isAuthenticated()): ?>
  35. <div class="row">
  36. <span class="edit">
  37. <a class="bracketed" title="Edit information about this anime" href="<?=
  38. $url->generate('edit', [
  39. 'controller' => 'anime',
  40. 'id' => $item['id'],
  41. 'status' => $item['watching_status']
  42. ]);
  43. ?>">Edit</a>
  44. </span>
  45. </div>
  46. <?php endif ?>
  47. <?php if ($item['private'] || $item['rewatching']): ?>
  48. <div class="row">
  49. <?php foreach(['private', 'rewatching'] as $attr): ?>
  50. <?php if($item[$attr]): ?>
  51. <span class="item-<?= $attr ?>"><?= ucfirst($attr) ?></span>
  52. <?php endif ?>
  53. <?php endforeach ?>
  54. </div>
  55. <?php endif ?>
  56. <?php if ($item['rewatched'] > 0): ?>
  57. <div class="row">
  58. <div>Rewatched <?= $item['rewatched'] ?> time(s)</div>
  59. </div>
  60. <?php endif ?>
  61. <?php if (count($item['anime']['streaming_links']) > 0): ?>
  62. <div class="row">
  63. <?php foreach($item['anime']['streaming_links'] as $link): ?>
  64. <div class="cover_streaming_link">
  65. <?php if($link['meta']['link']): ?>
  66. <a href="<?= $link['link']?>" title="Stream '<?= $item['anime']['title'] ?>' on <?= $link['meta']['name'] ?>">
  67. <img class="streaming-logo" width="20" height="20" src="<?= $urlGenerator->assetUrl('images', $link['meta']['image']) ?>" alt="<?= $link['meta']['name'] ?> logo" />
  68. </a>
  69. <?php else: ?>
  70. <img class="streaming-logo" width="20" height="20" src="<?= $urlGenerator->assetUrl('images', $link['meta']['image']) ?>" alt="<?= $link['meta']['name'] ?> logo" />
  71. <?php endif ?>
  72. </div>
  73. <?php endforeach ?>
  74. </div>
  75. <?php endif ?>
  76. <div class="row">
  77. <div class="user_rating">Rating: <?= $item['user_rating'] ?> / 10</div>
  78. <div class="completion">Episodes:
  79. <span class="completed_number"><?= $item['episodes']['watched'] ?></span> /
  80. <span class="total_number"><?= $item['episodes']['total'] ?></span>
  81. </div>
  82. </div>
  83. <div class="row">
  84. <div class="media_type"><?= $escape->html($item['anime']['show_type']) ?></div>
  85. <div class="airing_status"><?= $escape->html($item['airing']['status']) ?></div>
  86. <div class="age_rating"><?= $escape->html($item['anime']['age_rating']) ?></div>
  87. </div>
  88. </div>
  89. </article>
  90. <?php endforeach ?>
  91. </section>
  92. </section>
  93. <?php endif ?>
  94. <?php endforeach ?>
  95. <?php endif ?>
  96. </main>
  97. <?php if ($auth->isAuthenticated()): ?>
  98. <script defer="defer" src="<?= $urlGenerator->assetUrl('js.php/g/edit') ?>"></script>
  99. <?php endif ?>