2020-08-26 17:26:42 -04:00
|
|
|
<?php use function Aviat\AnimeClient\{colNotEmpty, renderTemplate}; ?>
|
2015-06-16 11:11:35 -04:00
|
|
|
<main>
|
2018-08-10 20:09:28 -04:00
|
|
|
<?php if ($auth->isAuthenticated()): ?>
|
|
|
|
<a class="bracketed" href="<?= $url->generate($collection_type . '.collection.add.get') ?>">Add Item</a>
|
|
|
|
<?php endif ?>
|
|
|
|
<?php if (empty($sections)): ?>
|
|
|
|
<h3>There's nothing here!</h3>
|
|
|
|
<?php else: ?>
|
2019-07-10 13:32:05 -04:00
|
|
|
<br />
|
|
|
|
<label>Filter: <input type='text' class='media-filter' /></label>
|
|
|
|
<br />
|
2020-08-26 17:26:42 -04:00
|
|
|
<?= $component->tabs('collection-tab', $sections, static function ($items, $section) use ($auth, $helper, $url, $collection_type) {
|
|
|
|
$hasNotes = colNotEmpty($items, 'notes');
|
|
|
|
$hasMedia = $section === 'All';
|
|
|
|
$firstTh = ($auth->isAuthenticated()) ? '<td> </td>' : '';
|
|
|
|
$mediaTh = ($hasMedia) ? '<th>Media</th>' : '';
|
|
|
|
$noteTh = ($hasNotes) ? '<th>Notes</th>' : '';
|
|
|
|
|
|
|
|
$rendered = [];
|
|
|
|
foreach ($items as $item)
|
|
|
|
{
|
|
|
|
$rendered[] = renderTemplate(__DIR__ . '/list-item.php', [
|
|
|
|
'auth' => $auth,
|
|
|
|
'collection_type' => $collection_type,
|
|
|
|
'hasMedia' => $hasMedia,
|
|
|
|
'hasNotes' => $hasNotes,
|
|
|
|
'helper' => $helper,
|
|
|
|
'item' => $item,
|
|
|
|
'url' => $url,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
$rows = implode('', array_map('mb_trim', $rendered));
|
|
|
|
|
|
|
|
return <<<HTML
|
|
|
|
<table class="full-width media-wrap">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
{$firstTh}
|
|
|
|
<th>Title</th>
|
|
|
|
{$mediaTh}
|
|
|
|
<th>Episode Count</th>
|
|
|
|
<th>Episode Length</th>
|
|
|
|
<th>Show Type</th>
|
|
|
|
<th>Age Rating</th>
|
|
|
|
{$noteTh}
|
|
|
|
<th>Genres</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>{$rows}</tbody>
|
|
|
|
</table>
|
|
|
|
HTML;
|
|
|
|
|
|
|
|
}) ?>
|
2018-08-10 20:09:28 -04:00
|
|
|
<?php endif ?>
|
2015-06-16 11:11:35 -04:00
|
|
|
</main>
|
2018-08-20 12:58:56 -04:00
|
|
|
<script defer="defer" src="<?= $urlGenerator->assetUrl('js/tables.min.js') ?>"></script>
|