Fix issue with anime detail pages

This commit is contained in:
Timothy Warren 2018-01-30 14:02:28 -05:00
parent f06ba6e3cd
commit 83f9d14630
2 changed files with 20 additions and 20 deletions

View File

@ -1,48 +1,48 @@
<main class="details fixed"> <main class="details fixed">
<section class="flex flex-no-wrap"> <section class="flex flex-no-wrap">
<div> <div>
<img class="cover" width="402" height="284" src="<?= $urlGenerator->assetUrl("images/anime/{$data['id']}.jpg") ?>" alt="" /> <img class="cover" width="402" height="284" src="<?= $urlGenerator->assetUrl("images/anime/{$show_data['id']}.jpg") ?>" alt="" />
<br /> <br />
<br /> <br />
<table class="media_details"> <table class="media_details">
<tr> <tr>
<td class="align_right">Airing Status</td> <td class="align_right">Airing Status</td>
<td><?= $data['status'] ?></td> <td><?= $show_data['status'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Show Type</td> <td>Show Type</td>
<td><?= $data['show_type'] ?></td> <td><?= $show_data['show_type'] ?></td>
</tr> </tr>
<tr> <tr>
<td>Episode Count</td> <td>Episode Count</td>
<td><?= $data['episode_count'] ?? '-' ?></td> <td><?= $show_data['episode_count'] ?? '-' ?></td>
</tr> </tr>
<tr> <tr>
<td>Episode Length</td> <td>Episode Length</td>
<td><?= $data['episode_length'] ?> minutes</td> <td><?= $show_data['episode_length'] ?> minutes</td>
</tr> </tr>
<?php if ( ! empty($data['age_rating'])): ?> <?php if ( ! empty($show_data['age_rating'])): ?>
<tr> <tr>
<td>Age Rating</td> <td>Age Rating</td>
<td><abbr title="<?= $data['age_rating_guide'] ?>"><?= $data['age_rating'] ?></abbr></td> <td><abbr title="<?= $show_data['age_rating_guide'] ?>"><?= $show_data['age_rating'] ?></abbr></td>
</tr> </tr>
<?php endif ?> <?php endif ?>
<tr> <tr>
<td>Genres</td> <td>Genres</td>
<td> <td>
<?= implode(', ', $data['genres']) ?> <?= implode(', ', $show_data['genres']) ?>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<div> <div>
<h2><a rel="external" href="<?= $data['url'] ?>"><?= array_shift($data['titles']) ?></a></h2> <h2><a rel="external" href="<?= $show_data['url'] ?>"><?= array_shift($show_data['titles']) ?></a></h2>
<?php foreach ($data['titles'] as $title): ?> <?php foreach ($show_data['titles'] as $title): ?>
<h3><?= $title ?></h3> <h3><?= $title ?></h3>
<?php endforeach ?> <?php endforeach ?>
<br /> <br />
<p><?= nl2br($data['synopsis']) ?></p> <p><?= nl2br($show_data['synopsis']) ?></p>
<?php if (count($data['streaming_links']) > 0): ?> <?php if (count($show_data['streaming_links']) > 0): ?>
<hr /> <hr />
<h4>Streaming on:</h4> <h4>Streaming on:</h4>
<table class="full_width invisible"> <table class="full_width invisible">
@ -54,11 +54,11 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach($data['streaming_links'] as $link): ?> <?php foreach($show_data['streaming_links'] as $link): ?>
<tr> <tr>
<td class="align_left"> <td class="align_left">
<?php if ($link['meta']['link'] !== FALSE): ?> <?php if ($link['meta']['link'] !== FALSE): ?>
<a href="<?= $link['link'] ?>" title="Stream '<?= $data['title'] ?>' on <?= $link['meta']['name'] ?>"> <a href="<?= $link['link'] ?>" title="Stream '<?= $show_data['title'] ?>' on <?= $link['meta']['name'] ?>">
<img class="streaming-logo" width="50" height="50" src="<?= $urlGenerator->assetUrl('images', $link['meta']['image']) ?>" alt="<?= $link['meta']['name'] ?> logo" /> <img class="streaming-logo" width="50" height="50" src="<?= $urlGenerator->assetUrl('images', $link['meta']['image']) ?>" alt="<?= $link['meta']['name'] ?> logo" />
&nbsp;&nbsp;<?= $link['meta']['name'] ?> &nbsp;&nbsp;<?= $link['meta']['name'] ?>
</a> </a>

View File

@ -253,10 +253,10 @@ class Anime extends BaseController {
*/ */
public function details(string $animeId) public function details(string $animeId)
{ {
$data = $this->model->getAnime($animeId); $show_data = $this->model->getAnime($animeId);
$characters = []; $characters = [];
if (empty($data)) if (empty($show_data))
{ {
$this->notFound( $this->notFound(
$this->config->get('whose_list') . $this->config->get('whose_list') .
@ -268,9 +268,9 @@ class Anime extends BaseController {
return; return;
} }
if (array_key_exists('characters', $data['included'])) if (array_key_exists('characters', $show_data['included']))
{ {
foreach($data['included']['characters'] as $id => $character) foreach($show_data['included']['characters'] as $id => $character)
{ {
$characters[$id] = $character['attributes']; $characters[$id] = $character['attributes'];
} }
@ -280,10 +280,10 @@ class Anime extends BaseController {
'title' => $this->formatTitle( 'title' => $this->formatTitle(
$this->config->get('whose_list') . "'s Anime List", $this->config->get('whose_list') . "'s Anime List",
'Anime', 'Anime',
$data['titles'][0] $show_data['titles'][0]
), ),
'characters' => $characters, 'characters' => $characters,
'data' => $data, 'show_data' => $show_data,
]); ]);
} }