From 333351cbd18d12520fb0eae44e9805cb3b10e038 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 13 Mar 2016 23:56:40 -0400 Subject: Add function User::getAddUsers_orderByAdminByName() Added function to retrive all users in system presorted first by admin status (Admins first), then by username in alpha order --- app/class/user.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app') diff --git a/app/class/user.class.php b/app/class/user.class.php index f1f7ff1..1130396 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -58,6 +58,22 @@ class User extends Object return $users; } + /* + * Get all users -- ordered by admin DESC (admins first), then by name + */ + function getAllUsers_orderByAdminByName() + { + $query = "SELECT o.guid FROM object o JOIN user u ON o.guid = u.guid WHERE o.type = 'user' ORDER BY u.admin DESC, o.name"; + $result = $this->db->query($query); + + $users = array(); + + foreach ($result as $u) + $users[] = new User($u['guid']); + + return $users; + } + /* * Check whether a given username is currently in use */ -- cgit v1.2.3