diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php index 1a831247639ef1fca8ae29b7ed8d59ec0f8847e5..86993497b547175509fe00d9f1c730287b0ad968 100644 --- a/app/controllers/consultation/admin.php +++ b/app/controllers/consultation/admin.php @@ -69,10 +69,10 @@ class Consultation_AdminController extends ConsultationController public function index_action($page = 0) { - $this->count = ConsultationSlot::countByRange($this->range); - $this->limit = Config::get()->ENTRIES_PER_PAGE; + $count = ConsultationSlot::countByRange($this->range); + $limit = Config::get()->ENTRIES_PER_PAGE; - if ($page >= ceil($this->count / $this->limit)) { + if ($page >= ceil($count / $limit)) { $page = 0; } @@ -81,7 +81,7 @@ class Consultation_AdminController extends ConsultationController if ($GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED) { $this->blocks = $this->groupSlots(ConsultationSlot::findByRange( $this->range, - "ORDER BY start ASC LIMIT " . ($this->page * $this->limit) . ", {$this->limit}" + "ORDER BY start ASC LIMIT " . ($this->page * $limit) . ", {$limit}" )); } else { $this->blocks = ConsultationBlock::findByRange( @@ -90,20 +90,22 @@ class Consultation_AdminController extends ConsultationController ); $this->slots = ConsultationSlot::findByRange( $this->range, - "ORDER BY start ASC LIMIT " . ($this->page * $this->limit) . ", {$this->limit}" + "ORDER BY start ASC LIMIT " . ($this->page * $limit) . ", {$limit}" ); } + $this->pagination = Pagination::create($count, $this->page, $limit); + $action = $GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED ? 'index' : 'ungrouped'; $this->render_action($action); } public function expired_action($page = 0) { - $this->count = ConsultationSlot::countByRange($this->range, true); - $this->limit = Config::get()->ENTRIES_PER_PAGE; + $count = ConsultationSlot::countByRange($this->range, true); + $limit = Config::get()->ENTRIES_PER_PAGE; - if ($page >= ceil($this->count / $this->limit)) { + if ($page >= ceil($count / $limit)) { $page = 0; } @@ -112,7 +114,7 @@ class Consultation_AdminController extends ConsultationController if ($GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED) { $this->blocks = $this->groupSlots(ConsultationSlot::findByRange( $this->range, - "ORDER BY start DESC LIMIT " . ($this->page * $this->limit) . ", {$this->limit}", + "ORDER BY start DESC LIMIT " . ($this->page * $limit) . ", {$limit}", true )); } else { @@ -123,11 +125,13 @@ class Consultation_AdminController extends ConsultationController ); $this->slots = ConsultationSlot::findByRange( $this->range, - "ORDER BY start DESC LIMIT " . ($this->page * $this->limit) . ", {$this->limit}", + "ORDER BY start DESC LIMIT " . ($this->page * $limit) . ", {$limit}", true ); } + $this->pagination = Pagination::create($count, $this->page, $limit); + $action = $GLOBALS['user']->cfg->CONSULTATION_SHOW_GROUPED ? 'index' : 'ungrouped'; $this->render_action($action); } diff --git a/app/views/consultation/admin/index.php b/app/views/consultation/admin/index.php index 43cd5bf94ec52c369ce377bb55e47bfe268a24ef..e0099807f43dc5a8302f01eef7b51f9e3658e540 100644 --- a/app/views/consultation/admin/index.php +++ b/app/views/consultation/admin/index.php @@ -2,10 +2,9 @@ /** * @var Consultation_AdminController $controller * @var int $page - * @var int $count - * @var int $limit * @var string $current_action * @var array<int, array{block: ConsultationBlock, slots: ConsultationSlot[]> $blocks + * @var Pagination $pagination */ ?> <? if (count($blocks) === 0): ?> @@ -40,8 +39,16 @@ </th> <th><?= _('Uhrzeit') ?></th> <th><?= _('Status') ?></th> - <th><?= _('Informationen') ?></th> - <th></th> + <th colspan="2"> + <div style="display: flex; justify-content: space-between"> + <span><?= _('Informationen') ?></span> + <span> + <?= $pagination->asLinks(function ($page) use ($controller, $current_action) { + return $controller->action_link($current_action, $page); + }) ?> + </span> + </div> + </th> </tr> </thead> <? foreach ($blocks as $block): ?> @@ -186,7 +193,7 @@ ]) ?> <div class="actions"> - <?= Pagination::create($count, $page, $limit)->asLinks(function ($page) use ($controller, $current_action) { + <?= $pagination->asLinks(function ($page) use ($controller, $current_action) { return $controller->action_link($current_action, $page); }) ?> </div> diff --git a/app/views/consultation/admin/ungrouped.php b/app/views/consultation/admin/ungrouped.php index 1796e31331d34a1f09ca552b2593176635ad8ec1..92972063d4a04225526653ce9c2a3d711d64b1e3 100644 --- a/app/views/consultation/admin/ungrouped.php +++ b/app/views/consultation/admin/ungrouped.php @@ -2,11 +2,10 @@ /** * @var Consultation_AdminController $controller * @var int $page - * @var int $count - * @var int $limit * @var string $current_action * @var ConsultationBlock[] $blocks * @var ConsultationSlot[] $slots + * @var Pagination $pagination */ ?> <? if (count($blocks) === 0): ?> @@ -132,7 +131,16 @@ </table> <table class="default consultation-overview slot-overview"> - <caption><?= _('Termine') ?></caption> + <caption> + <div class="caption-container"> + <div class="caption-content"><?= _('Termine') ?></div> + <div class="caption-actions"> + <?= $pagination->asLinks(function ($page) use ($controller, $current_action) { + return $controller->action_link($current_action, $page); + }) ?> + </div> + </div> + </caption> <colgroup> <col width="24px"> <col width="15%"> @@ -272,7 +280,7 @@ ]) ?> <div class="actions"> - <?= Pagination::create($count, $page, $limit)->asLinks(function ($page) use ($controller, $current_action) { + <?= $pagination->asLinks(function ($page) use ($controller, $current_action) { return $controller->action_link($current_action, $page); }) ?> </div>