Letzte Aktiviät stat Letzter Login in Benutzer bearbeiten

This commit is contained in:
aschwarz 2023-05-22 17:10:59 +02:00
parent 5059eff5fe
commit e5eac2a40f
3 changed files with 146 additions and 138 deletions

View File

@ -15,6 +15,11 @@ if(!isset($_SESSION['userid'])) {
} }
$sql_activity = $db->query("UPDATE jumi_admin
SET last_activity = NOW()
WHERE uid = '$uid'
");
$template = "modern"; $template = "modern";
function rechte($curpage, $uid){ function rechte($curpage, $uid){

View File

@ -81,11 +81,14 @@ if($action == ''){
WHEN max(Datum) > DATE_SUB(now(), INTERVAL 6 MONTH) THEN '1' WHEN max(Datum) > DATE_SUB(now(), INTERVAL 6 MONTH) THEN '1'
ELSE '5' ELSE '5'
END status END status
FROM jumi_adminlog WHERE uid='$row[uid]'"); ,Date_format(last_activity, '%d.%m.%Y - %H:%i') last_activity
FROM jumi_adminlog a, jumi_admin b
WHERE a.uid =b.uid
AND a.uid='$row[uid]'");
$row1 = $result1->fetch_array(); $row1 = $result1->fetch_array();
$row['status'] = $row1['status']; $row['status'] = $row1['status'];
$row['last_login'] = $row1['last_login']; $row['last_activity'] = $row1['last_activity'];
$value[] = $row; $value[] = $row;
} }
$smarty->assign('table_data', $value); $smarty->assign('table_data', $value);

View File

@ -1,136 +1,136 @@
{if $action == ''} {if $action == ''}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="de"> <html lang="de">
<head> <head>
<title>JU & MI Benutzer bearbeiten</title> <title>JU & MI Benutzer bearbeiten</title>
<link rel="stylesheet" href="../jquery/jquery-ui.css"> <link rel="stylesheet" href="../jquery/jquery-ui.css">
<link rel="stylesheet" href="../jquery/jquery.timepicker.min.css"> <link rel="stylesheet" href="../jquery/jquery.timepicker.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../bootstrap/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="../bootstrap/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="../bootstrap/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script> <script src="../bootstrap/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<!-- nochmals bootstrap.css mit Erweiterungen vom Dashboard --> <!-- nochmals bootstrap.css mit Erweiterungen vom Dashboard -->
<link href="css/styles.css" rel="stylesheet" /> <link href="css/styles.css" rel="stylesheet" />
<!-- icons in nav--> <!-- icons in nav-->
<!-- data Table: https://datatables.net/ --> <!-- data Table: https://datatables.net/ -->
<script src="../bootstrap/data-table/jquery.min.js"></script> <script src="../bootstrap/data-table/jquery.min.js"></script>
<link rel="stylesheet" href="../bootstrap/data-table/dataTables.bootstrap5.min.css"></style> <link rel="stylesheet" href="../bootstrap/data-table/dataTables.bootstrap5.min.css"></style>
<link rel="stylesheet" href="../bootstrap/data-table/rowReorder.dataTables.min.css"></style> <link rel="stylesheet" href="../bootstrap/data-table/rowReorder.dataTables.min.css"></style>
<script type="text/javascript" src="../bootstrap/data-table/jquery.dataTables.min.js"></script> <script type="text/javascript" src="../bootstrap/data-table/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../bootstrap/data-table/dataTables.rowReorder.min.js"></script> <script type="text/javascript" src="../bootstrap/data-table/dataTables.rowReorder.min.js"></script>
<script type="text/javascript" src="../bootstrap/data-table/dataTables.bootstrap5.min.js"></script> <script type="text/javascript" src="../bootstrap/data-table/dataTables.bootstrap5.min.js"></script>
<link rel="stylesheet" href="../bootstrap/data-table/jumistyle.css"></style> <link rel="stylesheet" href="../bootstrap/data-table/jumistyle.css"></style>
<script src="js/all.js" crossorigin="anonymous"></script> <script src="js/all.js" crossorigin="anonymous"></script>
<script src="../jquery/jquery-3.4.1.min.js"></script> <script src="../jquery/jquery-3.4.1.min.js"></script>
<link rel="stylesheet" href="../bootstrap/node_modules/bootstrap-icons/font/bootstrap-icons.css"> <link rel="stylesheet" href="../bootstrap/node_modules/bootstrap-icons/font/bootstrap-icons.css">
</head> </head>
<body class="sb-nav-fixed"> <body class="sb-nav-fixed">
<div id="navtop"></div> <div id="navtop"></div>
{literal} {literal}
<script> <script>
$(function(){ $(function(){
// im Navbar muss der toggle in der Callbackfunktion definiert werden. Sonst findet jquery getelementbyID nicht // im Navbar muss der toggle in der Callbackfunktion definiert werden. Sonst findet jquery getelementbyID nicht
$("#navtop").load('navtop.php', null, function(){$.getScript('js/scripts.js');}); $("#navtop").load('navtop.php', null, function(){$.getScript('js/scripts.js');});
$("#navleft").load("nav.php"); $("#navleft").load("nav.php");
$("#footer").load("footer.php"); $("#footer").load("footer.php");
}); });
</script> </script>
{/literal} {/literal}
<div id="layoutSidenav"> <div id="layoutSidenav">
<!-- Navigation left --> <!-- Navigation left -->
<div id="navleft"></div> <div id="navleft"></div>
<div id="layoutSidenav_content"> <div id="layoutSidenav_content">
<main> <main>
<!--Anwendung--> <!--Anwendung-->
<script src="../js/components/admin_create_user.js"></script> <script src="../js/components/admin_create_user.js"></script>
<div class="container-fluid"> <div class="container-fluid">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<i class="fas fa-edit me-1"></i> <i class="fas fa-edit me-1"></i>
Benutzer bearbeiten Benutzer bearbeiten
</div> </div>
<div class="card-body"> <div class="card-body">
<!-- https://datatables.net/download/release --> <!-- https://datatables.net/download/release -->
<table id="myTable" class="table table-striped table-bordered table-hover" > <table id="myTable" class="table table-striped table-bordered table-hover" >
<thead> <thead>
<tr> <tr>
<th>Vorname</th> <th>Vorname</th>
<th>Nachname</th> <th>Nachname</th>
<th class="d-none d-md-table-cell"> Mail</th> <th class="d-none d-md-table-cell"> Mail</th>
<th class="d-none d-md-table-cell">Letzter Login</th> <th class="d-none d-md-table-cell">Letzte Aktivität</th>
<th class="d-none d-md-table-cell">Status</th> <th class="d-none d-md-table-cell">Status</th>
<th>Aktion</th> <th>Aktion</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{section name=table_data loop=$table_data} {section name=table_data loop=$table_data}
<tr> <tr>
<td>{$table_data[table_data].vorname}</td> <td>{$table_data[table_data].vorname}</td>
<td>{$table_data[table_data].nachname}</td> <td>{$table_data[table_data].nachname}</td>
<td class="d-none d-md-table-cell">{$table_data[table_data].mail}</td> <td class="d-none d-md-table-cell">{$table_data[table_data].mail}</td>
<td class="d-none d-md-table-cell">{$table_data[table_data].last_login}</td> <td class="d-none d-md-table-cell">{$table_data[table_data].last_activity}</td>
<td class="d-none d-md-table-cell"> <td class="d-none d-md-table-cell">
<!-- <!--
# 4 Neu # 4 Neu
# 3 Deaktiviert # 3 Deaktiviert
# 2 Inaktiv # 2 Inaktiv
# 1 Aktiv # 1 Aktiv
--> -->
{if $table_data[table_data].status == '4'} {if $table_data[table_data].status == '4'}
<span class="status text-secondary">&bull;</span> Neu <span class="status text-secondary">&bull;</span> Neu
{/if} {/if}
{if $table_data[table_data].status == '3'} {if $table_data[table_data].status == '3'}
<span class="status text-danger">&bull;</span> Deaktiviert <span class="status text-danger">&bull;</span> Deaktiviert
{/if} {/if}
{if $table_data[table_data].status == '2'} {if $table_data[table_data].status == '2'}
<span class="status text-danger">&bull;</span> Inaktiv <span class="status text-danger">&bull;</span> Inaktiv
{/if} {/if}
{if $table_data[table_data].status == '1'} {if $table_data[table_data].status == '1'}
<span class="status text-success">&bull;</span> Aktiv <span class="status text-success">&bull;</span> Aktiv
{/if} {/if}
</td> </td>
<td> <td>
<a href="create_user.php?edituid={$table_data[table_data].uid}" class="settings" title="Edit User" data-toggle="tooltip"><i class="fas fa fa-cog"></i></a> <a href="create_user.php?edituid={$table_data[table_data].uid}" class="settings" title="Edit User" data-toggle="tooltip"><i class="fas fa fa-cog"></i></a>
&nbsp; &nbsp;
{if $table_data[table_data].aktiv == 1} {if $table_data[table_data].aktiv == 1}
<a href="#" class="settings text-danger" id="disable" onclick="disableuser({$table_data[table_data].uid});" title="Lock User" data-toggle="tooltip"><i class="fas fa fa-lock"></i></a> <a href="#" class="settings text-danger" id="disable" onclick="disableuser({$table_data[table_data].uid});" title="Lock User" data-toggle="tooltip"><i class="fas fa fa-lock"></i></a>
{else} {else}
<a href="#" class="settings text-success" id="enable" onclick="enableuser({$table_data[table_data].uid});" title="Unlock User" data-toggle="tooltip"><i class="fas fa fa-unlock"></i></a> <a href="#" class="settings text-success" id="enable" onclick="enableuser({$table_data[table_data].uid});" title="Unlock User" data-toggle="tooltip"><i class="fas fa fa-unlock"></i></a>
{/if} {/if}
</td> </td>
</tr> </tr>
{/section} {/section}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<div id="msg"></div> <div id="msg"></div>
</main> </main>
<!-- footer --> <!-- footer -->
<div id="footer"></div> <div id="footer"></div>
</div> </div>
</div> </div>
</body> </body>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
var table = new DataTable('#myTable', { var table = new DataTable('#myTable', {
rowReorder: true, rowReorder: true,
pageLength: 5, pageLength: 5,
language: { language: {
url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/de-DE.json', url: '//cdn.datatables.net/plug-ins/1.13.4/i18n/de-DE.json',
search: "", search: "",
lengthMenu: "_MENU_ Zeilen", lengthMenu: "_MENU_ Zeilen",
}, },
}); });
}); });
</script> </script>
</html> </html>
{/if} {/if}