X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/0d9c3baea2fb27d3956258e6911ac9439d63effa..a6e2e74ced2c2a0aa816b2002c5d7d037b45f436:/login/list.php diff --git a/login/list.php b/login/list.php index 5c551f3..7872bd6 100644 --- a/login/list.php +++ b/login/list.php @@ -8,14 +8,36 @@ foreach ($users as $col => $userdir) { $users[$col] = new User($userdir); } +if (isset($Place['order'])) { + $ordercol = $Place['order']; + $order = array_map(function ($row) use ($ordercol) { + return $row->$ordercol; + }, $users); +# $order = array_column($users, $ordercol); #TODO php7 simplification + if ($ordercol == 'seen') { + array_multisort($order, SORT_DESC, SORT_NUMERIC, $users); + $users = array_intersect_key($users, array_filter($order)); + } + else { + array_multisort($order, SORT_ASC, SORT_NATURAL, $users); + } +} + +if (isset($Place['n'])) { + array_splice($users, $Place['n']); # limit number of results +} + print '