feature/RVRNEXT-22-add-pagination-template #56
@ -68,17 +68,16 @@ class EventController implements IAuthenticationRequired, ISecured
|
|||||||
{
|
{
|
||||||
$itemsPerPage = 10;
|
$itemsPerPage = 10;
|
||||||
$numberOfEvents = $this->eventRepository->countAllByCommunity($this->community);
|
$numberOfEvents = $this->eventRepository->countAllByCommunity($this->community);
|
||||||
$pages = ceil($numberOfEvents / $itemsPerPage);
|
$currentPage = Container::$request->query('page') ?: 1;
|
||||||
$currentPage = Container::$request->query('page') ?: 0;
|
|
||||||
$events = $this->eventRepository->getPagedByCommunity(
|
$events = $this->eventRepository->getPagedByCommunity(
|
||||||
$this->community,
|
$this->community,
|
||||||
$currentPage * $itemsPerPage,
|
$currentPage,
|
||||||
$itemsPerPage
|
$itemsPerPage
|
||||||
);
|
);
|
||||||
|
|
||||||
return new HtmlContent('events/events', [
|
return new HtmlContent('events/events', [
|
||||||
'community' => $this->community,
|
'community' => $this->community,
|
||||||
'pages' => $pages,
|
'pages' => ceil($numberOfEvents / $itemsPerPage),
|
||||||
'currentPage' => $currentPage,
|
'currentPage' => $currentPage,
|
||||||
'numberOfEvents' => $numberOfEvents,
|
'numberOfEvents' => $numberOfEvents,
|
||||||
'events' => $events
|
'events' => $events
|
||||||
|
@ -84,19 +84,18 @@ class TransactionController implements IAuthenticationRequired, ISecured
|
|||||||
$numberOfTransactions = $event ?
|
$numberOfTransactions = $event ?
|
||||||
$this->transactionRepository->countAllByEvent($event) :
|
$this->transactionRepository->countAllByEvent($event) :
|
||||||
$this->transactionRepository->countAllByCommunity($this->community);
|
$this->transactionRepository->countAllByCommunity($this->community);
|
||||||
$pages = ceil($numberOfTransactions / $itemsPerPage);
|
$currentPage = Container::$request->query('page') ?: 1;
|
||||||
$currentPage = Container::$request->query('page') ?: 0;
|
|
||||||
$transactions = $event ?
|
$transactions = $event ?
|
||||||
$this->transactionRepository->getPagedByEvent(
|
$this->transactionRepository->getPagedByEvent(
|
||||||
$event,
|
$event,
|
||||||
$currentPage * $itemsPerPage,
|
$currentPage,
|
||||||
$itemsPerPage,
|
$itemsPerPage,
|
||||||
true,
|
true,
|
||||||
['currency', 'payer_user', 'payee_user']
|
['currency', 'payer_user', 'payee_user']
|
||||||
) :
|
) :
|
||||||
$this->transactionRepository->getPagedByCommunity(
|
$this->transactionRepository->getPagedByCommunity(
|
||||||
$this->community,
|
$this->community,
|
||||||
$currentPage * $itemsPerPage,
|
$currentPage,
|
||||||
$itemsPerPage,
|
$itemsPerPage,
|
||||||
true,
|
true,
|
||||||
['event', 'currency', 'payer_user', 'payee_user']
|
['event', 'currency', 'payer_user', 'payee_user']
|
||||||
@ -106,7 +105,7 @@ class TransactionController implements IAuthenticationRequired, ISecured
|
|||||||
'community' => $this->community,
|
'community' => $this->community,
|
||||||
'event' => $event,
|
'event' => $event,
|
||||||
'exchangeRateCalculator' => $exchangeRateCalculator,
|
'exchangeRateCalculator' => $exchangeRateCalculator,
|
||||||
'pages' => $pages,
|
'pages' => ceil($numberOfTransactions / $itemsPerPage),
|
||||||
'currentPage' => $currentPage,
|
'currentPage' => $currentPage,
|
||||||
'numberOfTransactions' => $numberOfTransactions,
|
'numberOfTransactions' => $numberOfTransactions,
|
||||||
'transactions' => $transactions
|
'transactions' => $transactions
|
||||||
|
Loading…
Reference in New Issue
Block a user