mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-09-09 19:38:57 +00:00
add list of active session in menu
This commit is contained in:
parent
3cd370cb2e
commit
f61a5f2327
40
out/out.Session.php
Normal file
40
out/out.Session.php
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
// MyDMS. Document Management System
|
||||||
|
// Copyright (C) 2002-2005 Markus Westphal
|
||||||
|
// Copyright (C) 2006-2008 Malcolm Cowe
|
||||||
|
// Copyright (C) 2010 Matteo Lucarelli
|
||||||
|
// Copyright (C) 2010-2016 Uwe Steinmann
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
include("../inc/inc.Settings.php");
|
||||||
|
include("../inc/inc.Utils.php");
|
||||||
|
include("../inc/inc.Language.php");
|
||||||
|
include("../inc/inc.Init.php");
|
||||||
|
include("../inc/inc.Extension.php");
|
||||||
|
include("../inc/inc.DBInit.php");
|
||||||
|
include("../inc/inc.Authentication.php");
|
||||||
|
include("../inc/inc.ClassAccessOperation.php");
|
||||||
|
include("../inc/inc.ClassUI.php");
|
||||||
|
|
||||||
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
|
|
||||||
|
if($view) {
|
||||||
|
$view($_GET);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -304,6 +304,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
||||||
echo " </li>\n";
|
echo " </li>\n";
|
||||||
echo " </ul>\n";
|
echo " </ul>\n";
|
||||||
|
|
||||||
|
echo " <div id=\"menu-session\">";
|
||||||
|
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"Session\" data-action=\"menuSessions\"></div>";
|
||||||
|
echo " </div>";
|
||||||
|
|
||||||
if($this->params['enableclipboard']) {
|
if($this->params['enableclipboard']) {
|
||||||
echo " <div id=\"menu-clipboard\">";
|
echo " <div id=\"menu-clipboard\">";
|
||||||
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"Clipboard\" data-action=\"menuClipboard\"></div>";
|
echo " <div class=\"ajax\" data-no-spinner=\"true\" data-view=\"Clipboard\" data-action=\"menuClipboard\"></div>";
|
||||||
|
|
68
views/bootstrap/class.Session.php
Normal file
68
views/bootstrap/class.Session.php
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
require_once("class.Bootstrap.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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@
|
||||||
|
*/
|
||||||
|
class SeedDMS_View_Session extends SeedDMS_Bootstrap_Style {
|
||||||
|
/**
|
||||||
|
* 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));
|
||||||
|
|
||||||
|
if ($user->isGuest() || count($sessions) == 0) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
$content = '';
|
||||||
|
$content .= " <ul id=\"main-menu-session\" class=\"nav pull-right\">\n";
|
||||||
|
$content .= " <li class=\"dropdown add-session-area\">\n";
|
||||||
|
$content .= " <a href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" class=\"add-session-area\">".getMLText('Sessions')." (".count($sessions).") <i class=\"icon-caret-down\"></i></a>\n";
|
||||||
|
$content .= " <ul class=\"dropdown-menu\" role=\"menu\">\n";
|
||||||
|
foreach($sessions as $session) {
|
||||||
|
if($sesuser = $dms->getUser($session->getUser()))
|
||||||
|
$content .= " <li><a href=\"../out/out.ViewFolder.php?folderid=".$sesuser->getID(). "\"><i class=\"icon-user\"></i> ".htmlspecialchars($sesuser->getFullName())." ".getReadableDuration(time()-$session->getLastAccess())."</a></li>\n";
|
||||||
|
}
|
||||||
|
$content .= " </ul>\n";
|
||||||
|
$content .= " </li>\n";
|
||||||
|
$content .= " </ul>\n";
|
||||||
|
echo $content;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user