diff --git a/app/views/anime/cover-item.php b/app/views/anime/cover-item.php new file mode 100644 index 00000000..3f8060ae --- /dev/null +++ b/app/views/anime/cover-item.php @@ -0,0 +1,84 @@ +
+ isAuthenticated()): ?> + + + " alt=""/> +
+ + + +
+ + +
+
+
+ +
+ + + + + +
+ + + 0): ?> +
+
Rewatched time(s)
+
+ + + 0): ?> +
+ + + +
+ + + isAuthenticated()): ?> +
+ + Edit + +
+ + +
+
Rating: / 10
+
Episodes: + / + +
+
+
+
html($item['anime']['show_type']) ?>
+
html($item['airing']['status']) ?>
+
html($item['anime']['age_rating']) ?>
+
+
+
\ No newline at end of file diff --git a/app/views/anime/cover.php b/app/views/anime/cover.php index 3607cdf6..60e08632 100644 --- a/app/views/anime/cover.php +++ b/app/views/anime/cover.php @@ -17,80 +17,7 @@
isAuthenticated()) continue; ?> -
- isAuthenticated()): ?> - - - " alt="" /> - -
- -
- - - - - -
- - - 0): ?> -
-
Rewatched time(s)
-
- - - 0): ?> -
- - - -
- - - isAuthenticated()): ?> -
- - Edit - -
- - -
-
Rating: / 10
-
Episodes: - / - -
-
-
-
html($item['anime']['show_type']) ?>
-
html($item['airing']['status']) ?>
-
html($item['anime']['age_rating']) ?>
-
-
-
+
diff --git a/app/views/collection/edit.php b/app/views/collection/edit.php index bf40de8c..33d21282 100644 --- a/app/views/collection/edit.php +++ b/app/views/collection/edit.php @@ -3,24 +3,26 @@

Edit Anime Collection Item

- - - - - - + + + + + + + + + \ No newline at end of file diff --git a/app/views/collection/list.php b/app/views/collection/list.php index a69ae61c..e0a1ab9a 100644 --- a/app/views/collection/list.php +++ b/app/views/collection/list.php @@ -24,6 +24,7 @@ + diff --git a/src/Model/AnimeCollection.php b/src/Model/AnimeCollection.php index ba578f0d..72833968 100644 --- a/src/Model/AnimeCollection.php +++ b/src/Model/AnimeCollection.php @@ -121,9 +121,20 @@ final class AnimeCollection extends Collection { ->join('media', 'media.id=a.media_id', 'inner') ->order_by('media') ->order_by('title') + ->group_by('a.hummingbird_id') ->get(); - return $query->fetchAll(PDO::FETCH_ASSOC); + // Add genres associated with each item + $rows = $query->fetchAll(PDO::FETCH_ASSOC); + $genres = $this->getGenresForList(); + + foreach($rows as &$row) + { + $row['genres'] = $genres[$row['hummingbird_id']]; + sort($row['genres']); + } + + return $rows; } /** @@ -210,6 +221,24 @@ final class AnimeCollection extends Collection { return $query->fetch(PDO::FETCH_ASSOC); } + private function getGenresForList(): array + { + $query = $this->db->select('hummingbird_id, genre') + ->from('genres g') + ->join('genre_anime_set_link gasl', 'gasl.genre_id=g.id') + ->get(); + + $rows = $query->fetchAll(PDO::FETCH_ASSOC); + $output = []; + + foreach($rows as $row) + { + $output[$row['hummingbird_id']][] = $row['genre']; + } + + return $output; + } + /** * Update genre information for selected anime *