diff --git a/app/controllers/admin/user.php b/app/controllers/admin/user.php index 043673b71d856f51c46a7b4889c7368dc11947a8..26563cf8f531ef5af667637ffb2f3ea1d0f2beaa 100644 --- a/app/controllers/admin/user.php +++ b/app/controllers/admin/user.php @@ -122,6 +122,9 @@ class Admin_UserController extends AuthenticatedController $this->order = $this->order == 'desc' ? 'asc' : 'desc'; } + $request['sortby'] = $this->sortby; + $request['order'] = $this->order; + $empty_search = $request['perm'] === 'alle'; $values = [ diff --git a/lib/models/User.class.php b/lib/models/User.class.php index b48db772cf606db83d74e18e27b2214a00bc604c..7c63cf3b40354f48f60959e82e60ceebbe1a1121 100644 --- a/lib/models/User.class.php +++ b/lib/models/User.class.php @@ -474,31 +474,33 @@ class User extends AuthUserMd5 implements Range, PrivacyObject $query .= implode(' AND ', $where); $query .= " GROUP BY au.`user_id` "; - //sortieren - switch ($attributes['sort']) { - case "perms": - $query .= "ORDER BY au.`perms` {$attributes['order']}, au.`username`"; - break; - case "Vorname": - $query .= "ORDER BY au.`Vorname` {$attributes['order']}, au.`Nachname`"; - break; - case "Nachname": - $query .= "ORDER BY au.`Nachname` {$attributes['order']}, au.`Vorname`"; - break; - case "Email": - $query .= "ORDER BY au.`Email` {$attributes['order']}, au.`username`"; - break; - case "changed": - $query .= "ORDER BY uo.`last_lifesign` {$attributes['order']}, au.`username`"; - break; - case "mkdate": - $query .= "ORDER BY ui.`mkdate` {$attributes['order']}, au.`username`"; - break; - case "auth_plugin": - $query .= "ORDER BY `auth_plugin` {$attributes['order']}, au.`username`"; - break; - default: - $query .= " ORDER BY au.`username` {$attributes['order']}"; + if (!empty($attributes['sortby'])) { + //sortieren + switch ($attributes['sortby']) { + case "perms": + $query .= "ORDER BY au.`perms` {$attributes['order']}, au.`username`"; + break; + case "Vorname": + $query .= "ORDER BY au.`Vorname` {$attributes['order']}, au.`Nachname`"; + break; + case "Nachname": + $query .= "ORDER BY au.`Nachname` {$attributes['order']}, au.`Vorname`"; + break; + case "Email": + $query .= "ORDER BY au.`Email` {$attributes['order']}, au.`username`"; + break; + case "changed": + $query .= "ORDER BY uo.`last_lifesign` {$attributes['order']}, au.`username`"; + break; + case "mkdate": + $query .= "ORDER BY ui.`mkdate` {$attributes['order']}, au.`username`"; + break; + case "auth_plugin": + $query .= "ORDER BY `auth_plugin` {$attributes['order']}, au.`username`"; + break; + default: + $query .= " ORDER BY au.`username` {$attributes['order']}"; + } } return DBManager::get()->fetchAll($query, $params, __CLASS__ . '::buildExisting');