summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-03-13 23:56:40 -0400
committerMalf Furious <m@lfurio.us>2016-03-27 20:16:32 -0400
commit333351cbd18d12520fb0eae44e9805cb3b10e038 (patch)
tree7d94b795e5d94873bbbda87c12285504fa7f32d4 /app
parente18f080a81c34204d7aa66441cdf9734d88cb30d (diff)
downloadscrott-333351cbd18d12520fb0eae44e9805cb3b10e038.tar.gz
scrott-333351cbd18d12520fb0eae44e9805cb3b10e038.zip
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
Diffstat (limited to '')
-rw-r--r--app/class/user.class.php16
1 files changed, 16 insertions, 0 deletions
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
@@ -59,6 +59,22 @@ class User extends Object
}
/*
+ * 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
*/
function usernameInUse($username)