2017-03-24 14:55:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of Clipboard view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
2021-04-15 13:36:32 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2017-03-24 14:55:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for clipboard view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2002-2005 Markus Westphal,
|
|
|
|
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
|
|
|
|
* 2010-2012 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-15 13:36:32 +00:00
|
|
|
class SeedDMS_View_Session extends SeedDMS_Theme_Style {
|
2017-03-24 14:55:43 +00:00
|
|
|
/**
|
|
|
|
* Returns the html needed for the clipboard list in the menu
|
|
|
|
*
|
|
|
|
* This function renders the clipboard in a way suitable to be
|
|
|
|
* used as a menu
|
|
|
|
*
|
|
|
|
* @param array $clipboard clipboard containing two arrays for both
|
|
|
|
* documents and folders.
|
|
|
|
* @return string html code
|
|
|
|
*/
|
|
|
|
public function menuSessions() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
|
|
|
|
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
|
|
|
|
$sessions = $sessionmgr->getLastAccessedSessions(date('Y-m-d H:i:s', time()-3600));
|
2017-10-27 17:42:56 +00:00
|
|
|
if(!$sessions)
|
2021-04-18 05:08:00 +00:00
|
|
|
return;
|
2017-03-24 14:55:43 +00:00
|
|
|
|
|
|
|
if ($user->isGuest() || count($sessions) == 0) {
|
2021-04-18 05:08:00 +00:00
|
|
|
return;
|
2017-03-24 14:55:43 +00:00
|
|
|
}
|
2020-04-16 13:54:37 +00:00
|
|
|
|
|
|
|
$c = 0;
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['session'] = array('label'=>'', 'children'=>array());
|
2017-03-24 14:55:43 +00:00
|
|
|
foreach($sessions as $session) {
|
|
|
|
if($sesuser = $dms->getUser($session->getUser()))
|
2020-04-16 13:54:37 +00:00
|
|
|
if(!$sesuser->isHidden()) {
|
|
|
|
$c++;
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['session']['children'][] = array('label'=>'<i class="fa fa-user"></i> '.htmlspecialchars($sesuser->getFullName())." ".getReadableDuration(time()-$session->getLastAccess()));
|
2020-04-16 13:54:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if($c) {
|
2021-04-18 05:08:00 +00:00
|
|
|
$menuitems['session']['label'] = getMLText('sessions')." (".$c.")";
|
|
|
|
self::showNavigationBar($menuitems, array('right'=>true));
|
2017-03-24 14:55:43 +00:00
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
}
|