From 4279653ccdd0c293e84cd4937ea82e9edd8259fa Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Tue, 30 Oct 2018 16:41:48 +0100 Subject: [PATCH] Added sort options for TodaysBirthdaysBoxController Closes #2765 --- .../TodaysBirthdaysBoxController.class.php | 53 +++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/box/TodaysBirthdaysBoxController.class.php b/wcfsetup/install/files/lib/system/box/TodaysBirthdaysBoxController.class.php index 89376f7c52..d4ef519eca 100644 --- a/wcfsetup/install/files/lib/system/box/TodaysBirthdaysBoxController.class.php +++ b/wcfsetup/install/files/lib/system/box/TodaysBirthdaysBoxController.class.php @@ -1,5 +1,6 @@ box->limit) break; $birthdayUserOption->setUser($userProfile->getDecoratedObject()); @@ -66,6 +105,14 @@ class TodaysBirthdaysBoxController extends AbstractBoxController { } if (!empty($visibleUserProfiles)) { + // sort users + DatabaseObject::sort($visibleUserProfiles, $this->sortField, $this->sortOrder); + + // apply limit + if (count($visibleUserProfiles) > $this->box->limit) { + $visibleUserProfiles = array_slice($visibleUserProfiles, 0, $this->box->limit); + } + $this->content = WCF::getTPL()->fetch($this->templateName, 'wcf', [ 'birthdayUserProfiles' => $visibleUserProfiles ], true); -- 2.20.1