From: Matthias Schmidt Date: Sun, 31 Jul 2016 10:52:00 +0000 (+0200) Subject: Add TUserLookupPageHandler X-Git-Tag: 3.0.0_Beta_1~855 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=767c2020d015c76a581460d89f693ad0ade0ddc1;p=GitHub%2FWoltLab%2FWCF.git Add TUserLookupPageHandler --- diff --git a/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php b/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php new file mode 100644 index 0000000000..c82ea8e08c --- /dev/null +++ b/wcfsetup/install/files/lib/system/page/handler/TUserLookupPageHandler.class.php @@ -0,0 +1,35 @@ + + * @package WoltLabSuite\Core\System\Page\Handler + * @since 3.0 + */ +trait TUserLookupPageHandler { + /** + * @see ILookupPageHandler::lookup() + */ + public function lookup($searchString) { + $userList = new UserProfileList(); + $userList->getConditionBuilder()->add('user_table.username LIKE ?', ['%' . $searchString . '%']); + $userList->readObjects(); + + $results = []; + foreach ($userList as $user) { + $results[] = [ + 'image' => $user->getAvatar()->getImageTag(48), + 'link' => $user->getLink(), + 'objectID' => $user->userID, + 'title' => $user->username + ]; + } + + return $results; + } +}