X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/ae6f8a065aa433337311d74bc81cb05526246f88..c3518f67a1134e20a497dbfc3161353b650e279d:/login/list.php diff --git a/login/list.php b/login/list.php index d3b1f17..698b805 100644 --- a/login/list.php +++ b/login/list.php @@ -8,21 +8,37 @@ foreach ($users as $col => $userdir) { $users[$col] = new User($userdir); } -if (@$Place['order'] == 'seen') { - $order = array_map(function ($col) { return $col->seen; }, $users); -# $order = array_column($users, 'seen'); #TODO php7 simplification - array_multisort($order, SORT_DESC, SORT_NUMERIC, $users); +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 ' 5) { + print ' class="cols"'; +} print ">\n"; foreach ($users as $user) { - $name = $user->name ?: ucfirst($user->login); - if (!empty($GLOBALS['User']['admin'])) { + $name = $user->name ?: $user->login; + if ($GLOBALS['User'] and $GLOBALS['User']->admin) { $link = '/login/edit/'.$user->login; $name = sprintf('%s', $link, $name); } @@ -42,13 +58,19 @@ foreach ($users as $user) { $avatar, $name ); break; + case 'visit': + if ($user->seen) { + $name .= sprintf(' %s', strftime('%F %H:%M', $user->seen)); + } + # continue to default default: if ($user->admin) { - $name .= ' (beheerder)'; + $name .= ' 🔧'; } + $name = "
$name
"; } - print '
  • '.$name; + print "
  • $name
  • \n"; } -print ''; +print "\n\n";