Skip to content
Snippets Groups Projects
Commit 2de3dc95 authored by David Siegfried's avatar David Siegfried Committed by Jan-Hendrik Willms
Browse files

fix sorting, closes #1781

Closes #1781

Merge request studip/studip!1163
parent a6e116ec
No related branches found
No related tags found
No related merge requests found
......@@ -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 = [
......
......@@ -470,31 +470,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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment