seeddms-code/views/bootstrap/class.UserList.php

120 lines
3.9 KiB
PHP
Raw Normal View History

2012-12-14 07:53:13 +00:00
<?php
/**
* Implementation of UserList view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @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 UserList view
*
* @category DMS
* @package SeedDMS
2012-12-14 07:53:13 +00:00
* @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_UserList extends SeedDMS_Bootstrap_Style {
2012-12-14 07:53:13 +00:00
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$allUsers = $this->params['allusers'];
$httproot = $this->params['httproot'];
2014-05-20 04:29:29 +00:00
$quota = $this->params['quota'];
$pwdexpiration = $this->params['pwdexpiration'];
2012-12-14 07:53:13 +00:00
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
$this->contentStart();
$this->pageNavigation("", "admin_tools");
$this->contentHeading(getMLText("user_list"));
$this->contentContainerStart();
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
2012-12-14 07:53:13 +00:00
?>
2013-02-19 08:57:48 +00:00
<table class="table table-condensed">
2016-04-05 07:43:29 +00:00
<thead><tr><th></th><th><?php printMLText('name'); ?></th><th><?php printMLText('groups'); ?></th><th><?php printMLText('discspace'); ?></th><th><?php printMLText('authentication'); ?></th><th></th></tr></thead><tbody>
2012-12-14 07:53:13 +00:00
<?php
2013-02-19 08:57:48 +00:00
foreach ($allUsers as $currUser) {
echo "<tr>";
echo "<td>";
if ($currUser->hasImage())
2016-08-03 06:06:53 +00:00
print "<img width=\"100\" src=\"".$httproot . "out/out.UserImage.php?userid=".$currUser->getId()."\">";
2013-02-19 08:57:48 +00:00
echo "</td>";
echo "<td>";
2016-01-28 12:36:07 +00:00
echo htmlspecialchars($currUser->getFullName())." (".htmlspecialchars($currUser->getLogin()).")<br />";
echo "<a href=\"mailto:".$currUser->getEmail()."\">".htmlspecialchars($currUser->getEmail())."</a><br />";
echo "<small>".htmlspecialchars($currUser->getComment())."</small>";
2013-02-19 08:57:48 +00:00
echo "</td>";
echo "<td>";
$groups = $currUser->getGroups();
if (count($groups) != 0) {
for ($j = 0; $j < count($groups); $j++) {
2016-01-28 12:36:07 +00:00
print htmlspecialchars($groups[$j]->getName());
2013-02-19 08:57:48 +00:00
if ($j +1 < count($groups))
print ", ";
}
}
echo "</td>";
echo "<td>";
2014-05-20 04:29:29 +00:00
echo SeedDMS_Core_File::format_filesize($currUser->getUsedDiskSpace());
if($quota) {
echo " / ";
2015-08-20 13:54:40 +00:00
$qt = $currUser->getQuota() ? $currUser->getQuota() : $quota;
echo SeedDMS_Core_File::format_filesize($qt)."<br />";
echo $this->getProgressBar($currUser->getUsedDiskSpace(), $qt);
2014-05-20 04:29:29 +00:00
}
2013-02-19 08:57:48 +00:00
echo "</td>";
echo "<td>";
if($pwdexpiration) {
$now = new DateTime();
$expdate = new DateTime($currUser->getPwdExpiration());
$diff = $now->diff($expdate);
if($expdate > $now) {
printf(getMLText('password_expires_in_days'), $diff->format('%a'));
echo " (".$expdate->format('Y-m-d H:i:sP').")";
} else {
printMLText("password_expired");
}
}
$sessions = $sessionmgr->getUserSessions($currUser);
if($sessions) {
foreach($sessions as $session) {
echo "<br />".getMLText('lastaccess').": ".getLongReadableDate($session->getLastAccess());
}
}
echo "</td>";
echo "<td>";
2014-05-20 04:29:29 +00:00
echo "<div class=\"list-action\">";
2013-02-19 08:57:48 +00:00
echo "<a href=\"../out/out.UsrMgr.php?userid=".$currUser->getID()."\"><i class=\"icon-edit\"></i></a> ";
echo "<a href=\"../out/out.RemoveUser.php?userid=".$currUser->getID()."\"><i class=\"icon-remove\"></i></a>";
2014-05-20 04:29:29 +00:00
echo "</div>";
2013-02-19 08:57:48 +00:00
echo "</td>";
echo "</tr>";
2012-12-14 07:53:13 +00:00
}
2016-04-05 07:43:29 +00:00
echo "</tbody></table>";
2012-12-14 07:53:13 +00:00
$this->contentContainerEnd();
$this->contentEnd();
2012-12-14 07:53:13 +00:00
$this->htmlEndPage();
} /* }}} */
}
?>