aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/consultation/admin.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-07-15 15:50:25 +0000
committerDavid Siegfried <david.siegfried@uni-vechta.de>2024-07-15 15:50:25 +0000
commitf84b61239fb1815d3830b7d0d3c64fa5f6fc08e3 (patch)
tree87f948d66ef817540a985a022bd5cbdf262512a2 /app/controllers/consultation/admin.php
parentf004dc9a79f67f901b7b89f66f2965bccf7a10fb (diff)
duplicate pagination on consultation pages, fixes #3774
Closes #3774 Merge request studip/studip!2648
Diffstat (limited to 'app/controllers/consultation/admin.php')
-rw-r--r--app/controllers/consultation/admin.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/app/controllers/consultation/admin.php b/app/controllers/consultation/admin.php
index 1a83124..8699349 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);
}