mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
snyc...
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Models\TvShow;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Slim\Views\Twig;
|
||||
@@ -30,14 +31,16 @@ class TvShowController extends Controller
|
||||
// Get view mode
|
||||
$viewMode = $queryParams['view'] ?? 'grid'; // grid, list, covers
|
||||
|
||||
// For now, return empty arrays since TV Shows aren't implemented yet
|
||||
$tvshows = [];
|
||||
$totalCount = 0;
|
||||
// Get TV shows with pagination and search
|
||||
$tvshows = TvShow::getAllWithPagination($this->pdo, $page, $perPage, $search);
|
||||
|
||||
// Get total count for pagination
|
||||
$totalCount = TvShow::getTotalCount($this->pdo, $search);
|
||||
|
||||
// Calculate pagination info
|
||||
$totalPages = 0;
|
||||
$hasNextPage = false;
|
||||
$hasPrevPage = false;
|
||||
$totalPages = ceil($totalCount / $perPage);
|
||||
$hasNextPage = $page < $totalPages;
|
||||
$hasPrevPage = $page > 1;
|
||||
|
||||
return $this->view->render($response, 'tvshows/index.twig', [
|
||||
'title' => 'TV Shows',
|
||||
@@ -91,31 +94,9 @@ class TvShowController extends Controller
|
||||
");
|
||||
$stmt->execute(['tv_show_id' => $tvShowId]);
|
||||
$actors = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
/*
|
||||
// Get seasons for this TV show
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT * FROM tv_seasons
|
||||
WHERE tv_show_id = :tv_show_id
|
||||
ORDER BY season_number ASC
|
||||
");
|
||||
$stmt->execute(['tv_show_id' => $tvShowId]);
|
||||
$seasons = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
*//*
|
||||
// Get episodes for each season
|
||||
foreach ($seasons as &$season) {
|
||||
$stmt = $this->pdo->prepare("
|
||||
SELECT * FROM tv_episodes
|
||||
WHERE tv_show_id = :tv_show_id AND season_number = :season_number
|
||||
ORDER BY episode_number ASC
|
||||
");
|
||||
$stmt->execute([
|
||||
'tv_show_id' => $tvShowId,
|
||||
'season_number' => $season['season_number']
|
||||
]);
|
||||
$season['episodes'] = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
unset($season); // Unset reference
|
||||
*/
|
||||
// Get seasons and episodes for this TV show
|
||||
$tvShowModel = new TvShow($this->pdo, $tvShow);
|
||||
$seasons = $tvShowModel->getSeasonsWithEpisodes();
|
||||
return $this->view->render($response, 'tvshows/show.twig', [
|
||||
'title' => $tvShow['title'],
|
||||
'tvshow' => $tvShow,
|
||||
|
||||
Reference in New Issue
Block a user