show last access in online users only to admins

This commit is contained in:
Uwe Steinmann 2017-07-27 21:17:31 +02:00
parent dd94898b19
commit ab141b84df

View File

@ -45,6 +45,7 @@ class SeedDMS_View_Session extends SeedDMS_Bootstrap_Style {
$user = $this->params['user'];
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
/* Get only sessions which has been active in the last 3600 sec. */
$sessions = $sessionmgr->getLastAccessedSessions(date('Y-m-d H:i:s', time()-3600));
if ($user->isGuest() || count($sessions) == 0) {
@ -58,7 +59,7 @@ class SeedDMS_View_Session extends SeedDMS_Bootstrap_Style {
foreach($sessions as $session) {
if($sesuser = $dms->getUser($session->getUser()))
if(!$sesuser->isHidden())
$content .= " <li><a _href=\"\"><i class=\"icon-user\"></i> ".htmlspecialchars($sesuser->getFullName())." ".getReadableDuration(time()-$session->getLastAccess())."</a></li>\n";
$content .= " <li><a _href=\"\"><i class=\"icon-user\"></i> ".htmlspecialchars($sesuser->getFullName()).($user->isAdmin() ? " ".getReadableDuration(time()-$session->getLastAccess()) : "")."</a></li>\n";
}
$content .= " </ul>\n";
$content .= " </li>\n";