Do you wish to register an account?
API client for Kitsu.io, with optional Anime collection, and optional Anilist syncing.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
4.3KB

  1. <?php
  2. use function Aviat\AnimeClient\getLocalImg;
  3. use Aviat\AnimeClient\API\Kitsu;
  4. ?>
  5. <main class="details fixed">
  6. <section class="flex flex-no-wrap">
  7. <div>
  8. <picture class="cover">
  9. <source srcset="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.webp") ?>" type="image/webp">
  10. <source srcset="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.jpg") ?>" type="image/jpeg">
  11. <img src="<?= $urlGenerator->assetUrl("images/characters/{$data[0]['id']}-original.jpg") ?>" alt="" />
  12. </picture>
  13. </div>
  14. <div>
  15. <h2><?= $data[0]['attributes']['name'] ?></h2>
  16. <p class="description"><?= $data[0]['attributes']['description'] ?></p>
  17. </div>
  18. </section>
  19. <?php if (array_key_exists('anime', $data['included']) || array_key_exists('manga', $data['included'])): ?>
  20. <h3>Media</h3>
  21. <section class="flex flex-no-wrap">
  22. <?php if (array_key_exists('anime', $data['included'])): ?>
  23. <div>
  24. <h4>Anime</h4>
  25. <section class="align_left media-wrap">
  26. <?php foreach($data['included']['anime'] as $id => $anime): ?>
  27. <article class="media">
  28. <?php
  29. $link = $url->generate('anime.details', ['id' => $anime['attributes']['slug']]);
  30. $titles = Kitsu::filterTitles($anime['attributes']);
  31. ?>
  32. <a href="<?= $link ?>">
  33. <img src="<?= $urlGenerator->assetUrl("images/anime/{$id}.jpg") ?>" width="220" alt="" />
  34. </a>
  35. <div class="name">
  36. <a href="<?= $link ?>">
  37. <?= array_shift($titles) ?>
  38. <?php foreach ($titles as $title): ?>
  39. <br /><small><?= $title ?></small>
  40. <?php endforeach ?>
  41. </a>
  42. </div>
  43. </article>
  44. <?php endforeach ?>
  45. </section>
  46. </div>
  47. <?php endif ?>
  48. </section>
  49. <section class="flex flex-no-wrap">
  50. <?php if (array_key_exists('manga', $data['included'])): ?>
  51. <div>
  52. <h4>Manga</h4>
  53. <section class="align_left media-wrap">
  54. <?php foreach($data['included']['manga'] as $id => $manga): ?>
  55. <article class="media">
  56. <?php
  57. $link = $url->generate('manga.details', ['id' => $manga['attributes']['slug']]);
  58. $titles = Kitsu::filterTitles($manga['attributes']);
  59. ?>
  60. <a href="<?= $link ?>">
  61. <img src="<?= $urlGenerator->assetUrl("images/manga/{$id}.jpg") ?>" width="220" alt="" />
  62. </a>
  63. <div class="name">
  64. <a href="<?= $link ?>">
  65. <?= array_shift($titles) ?>
  66. <?php foreach ($titles as $title): ?>
  67. <br /><small><?= $title ?></small>
  68. <?php endforeach ?>
  69. </a>
  70. </div>
  71. </article>
  72. <?php endforeach ?>
  73. </section>
  74. </div>
  75. <?php endif ?>
  76. </section>
  77. <?php endif ?>
  78. <section>
  79. <?php if ($castCount > 0): ?>
  80. <h3>Castings</h3>
  81. <?php foreach($castings as $role => $entries): ?>
  82. <h4><?= $role ?></h4>
  83. <?php foreach($entries as $language => $casting): ?>
  84. <h5><?= $language ?></h5>
  85. <table class="min-table">
  86. <tr>
  87. <th>Cast Member</th>
  88. <th>Series</th>
  89. </tr>
  90. <?php foreach($casting as $cid => $c):?>
  91. <tr>
  92. <td style="width:229px">
  93. <article class="character">
  94. <?php
  95. $link = $url->generate('person', ['id' => $c['person']['id']]);
  96. ?>
  97. <a href="<?= $link ?>">
  98. <img src="<?= $urlGenerator->assetUrl(getLocalImg($c['person']['image'])) ?>" alt="" />
  99. <div class="name">
  100. <?= $c['person']['name'] ?>
  101. </div>
  102. </a>
  103. </article>
  104. </td>
  105. <td>
  106. <section class="align_left media-wrap">
  107. <?php foreach($c['series'] as $series): ?>
  108. <article class="media">
  109. <?php
  110. $link = $url->generate('anime.details', ['id' => $series['attributes']['slug']]);
  111. $titles = Kitsu::filterTitles($series['attributes']);
  112. ?>
  113. <a href="<?= $link ?>">
  114. <img src="<?= $urlGenerator->assetUrl(getLocalImg($series['attributes']['posterImage']['small'])) ?>" width="220" alt="" />
  115. </a>
  116. <div class="name">
  117. <a href="<?= $link ?>">
  118. <?= array_shift($titles) ?>
  119. <?php foreach ($titles as $title): ?>
  120. <br /><small><?= $title ?></small>
  121. <?php endforeach ?>
  122. </a>
  123. </div>
  124. </article>
  125. <?php endforeach ?>
  126. </section>
  127. </td>
  128. </tr>
  129. <?php endforeach; ?>
  130. </table>
  131. <?php endforeach ?>
  132. <?php endforeach ?>
  133. <?php endif ?>
  134. </section>
  135. </main>