feature/RVRNEXT-22-add-pagination-template #56

Merged
bence merged 4 commits from feature/RVRNEXT-22-add-pagination-template into master 2023-05-28 20:46:23 +02:00
2 changed files with 7 additions and 9 deletions
Showing only changes of commit d1c926541a - Show all commits

View File

@ -68,17 +68,16 @@ class EventController implements IAuthenticationRequired, ISecured
{
$itemsPerPage = 10;
$numberOfEvents = $this->eventRepository->countAllByCommunity($this->community);
$pages = ceil($numberOfEvents / $itemsPerPage);
$currentPage = Container::$request->query('page') ?: 0;
$currentPage = Container::$request->query('page') ?: 1;
$events = $this->eventRepository->getPagedByCommunity(
$this->community,
$currentPage * $itemsPerPage,
$currentPage,
$itemsPerPage
);
return new HtmlContent('events/events', [
'community' => $this->community,
'pages' => $pages,
'pages' => ceil($numberOfEvents / $itemsPerPage),
'currentPage' => $currentPage,
'numberOfEvents' => $numberOfEvents,
'events' => $events

View File

@ -84,19 +84,18 @@ class TransactionController implements IAuthenticationRequired, ISecured
$numberOfTransactions = $event ?
$this->transactionRepository->countAllByEvent($event) :
$this->transactionRepository->countAllByCommunity($this->community);
$pages = ceil($numberOfTransactions / $itemsPerPage);
$currentPage = Container::$request->query('page') ?: 0;
$currentPage = Container::$request->query('page') ?: 1;
$transactions = $event ?
$this->transactionRepository->getPagedByEvent(
$event,
$currentPage * $itemsPerPage,
$currentPage,
$itemsPerPage,
true,
['currency', 'payer_user', 'payee_user']
) :
$this->transactionRepository->getPagedByCommunity(
$this->community,
$currentPage * $itemsPerPage,
$currentPage,
$itemsPerPage,
true,
['event', 'currency', 'payer_user', 'payee_user']
@ -106,7 +105,7 @@ class TransactionController implements IAuthenticationRequired, ISecured
'community' => $this->community,
'event' => $event,
'exchangeRateCalculator' => $exchangeRateCalculator,
'pages' => $pages,
'pages' => ceil($numberOfTransactions / $itemsPerPage),
'currentPage' => $currentPage,
'numberOfTransactions' => $numberOfTransactions,
'transactions' => $transactions