mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
73 lines
2.2 KiB
PHP
73 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
|
use Slim\Views\Twig;
|
|
|
|
class TvShowController extends Controller
|
|
{
|
|
private \PDO $pdo;
|
|
|
|
public function __construct(\PDO $pdo, Twig $view)
|
|
{
|
|
parent::__construct($view);
|
|
$this->pdo = $pdo;
|
|
}
|
|
|
|
public function index(Request $request, Response $response, $args)
|
|
{
|
|
$queryParams = $request->getQueryParams();
|
|
|
|
// Get pagination parameters
|
|
$page = max(1, (int)($queryParams['page'] ?? 1));
|
|
$perPage = max(12, min(100, (int)($queryParams['per_page'] ?? 24)));
|
|
|
|
// Get search parameters
|
|
$search = trim($queryParams['search'] ?? '');
|
|
|
|
// 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;
|
|
|
|
// Calculate pagination info
|
|
$totalPages = 0;
|
|
$hasNextPage = false;
|
|
$hasPrevPage = false;
|
|
|
|
return $this->view->render($response, 'tvshows/index.twig', [
|
|
'title' => 'TV Shows',
|
|
'tvshows' => $tvshows,
|
|
'pagination' => [
|
|
'current_page' => $page,
|
|
'per_page' => $perPage,
|
|
'total_pages' => $totalPages,
|
|
'total_items' => $totalCount,
|
|
'has_next' => $hasNextPage,
|
|
'has_prev' => $hasPrevPage,
|
|
'next_page' => $page + 1,
|
|
'prev_page' => $page - 1
|
|
],
|
|
'search' => $search,
|
|
'view_mode' => $viewMode,
|
|
'view_modes' => ['grid', 'list', 'covers']
|
|
]);
|
|
}
|
|
|
|
public function show(Request $request, Response $response, $args)
|
|
{
|
|
$tvShowId = (int) $args['id'];
|
|
|
|
// For now, return a placeholder since TV Shows aren't implemented yet
|
|
return $this->view->render($response, 'tvshows/show.twig', [
|
|
'title' => 'TV Show Details',
|
|
'tvshow' => ['id' => $tvShowId, 'title' => 'Coming Soon'],
|
|
'message' => 'TV show details page is not yet implemented.'
|
|
]);
|
|
}
|
|
}
|