HTML fixes
parent
921f310ac1
commit
e2daf22ad7
|
@ -1,104 +1,109 @@
|
|||
|
||||
<!-- log events -->
|
||||
<div class="container-fluid mt-2">
|
||||
<div class="container-fluid mt-4">
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6 mb-5">
|
||||
<div class="col-md-6">
|
||||
<h2 class="mb-0">Log events</h2>
|
||||
<small>events recorded in the Jilo monitoring platform</small>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<ul class="nav nav-tabs mb-3">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $scope === 'user' ? 'active' : '' ?>" href="?page=logs&tab=user">
|
||||
Logs for current user
|
||||
</a>
|
||||
</li>
|
||||
</div>
|
||||
|
||||
<!-- Tabs navigation -->
|
||||
<ul class="nav nav-tabs mb-4">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $scope === 'user' ? 'active' : '' ?>" href="?page=logs&tab=user">
|
||||
Logs for current user
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($has_system_access) { ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $scope === 'system' ? 'active' : '' ?>" href="?page=logs&tab=system">
|
||||
Logs for all users
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $scope === 'system' ? 'active' : '' ?>" href="?page=logs&tab=system">
|
||||
Logs for all users
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<!-- logs filter -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<form method="GET" action="" class="row g-3 align-items-end">
|
||||
<input type="hidden" name="page" value="logs">
|
||||
<input type="hidden" name="tab" value="<?= htmlspecialchars($scope) ?>">
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="from_time" class="form-label">From date</label>
|
||||
<input type="date" class="form-control" id="from_time" name="from_time" value="<?= htmlspecialchars($_REQUEST['from_time'] ?? '') ?>">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label for="until_time" class="form-label">Until date</label>
|
||||
<input type="date" class="form-control" id="until_time" name="until_time" value="<?= htmlspecialchars($_REQUEST['until_time'] ?? '') ?>">
|
||||
</div>
|
||||
|
||||
<?php if ($scope === 'system') { ?>
|
||||
<div class="col-md-2">
|
||||
<label for="id" class="form-label">User ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id" value="<?= htmlspecialchars($_REQUEST['id'] ?? '') ?>" placeholder="Enter user ID">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="col-md">
|
||||
<label for="message" class="form-label">Message</label>
|
||||
<input type="text" class="form-control" id="message" name="message" value="<?= htmlspecialchars($_REQUEST['message'] ?? '') ?>" placeholder="Search in log messages">
|
||||
</div>
|
||||
|
||||
<div class="col-md-auto">
|
||||
<button type="submit" class="btn btn-primary me-2">
|
||||
<i class="fas fa-search me-2"></i>Search
|
||||
</button>
|
||||
<a href="?page=logs&tab=<?= htmlspecialchars($scope) ?>" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-times me-2"></i>Clear
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
|
||||
<!-- logs filter -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<form method="get" action="" class="row g-3 align-items-end">
|
||||
<input type="hidden" name="page" value="logs">
|
||||
<input type="hidden" name="tab" value="<?= htmlspecialchars($scope) ?>">
|
||||
<div class="col-md-3">
|
||||
<label for="from_time" class="form-label">From date</label>
|
||||
<input type="date" class="form-control" id="from_time" name="from_time" value="<?= htmlspecialchars($_REQUEST['from_time'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label for="until_time" class="form-label">Until date</label>
|
||||
<input type="date" class="form-control" id="until_time" name="until_time" value="<?= htmlspecialchars($_REQUEST['until_time'] ?? '') ?>">
|
||||
</div>
|
||||
<?php if ($scope === 'system') { ?>
|
||||
<div class="col-md-2">
|
||||
<label for="id" class="form-label">User ID</label>
|
||||
<input type="text" class="form-control" id="id" name="id" value="<?= htmlspecialchars($_REQUEST['id'] ?? '') ?>" placeholder="Enter user ID">
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="col-md">
|
||||
<label for="message" class="form-label">Message</label>
|
||||
<input type="text" class="form-control" id="message" name="message" value="<?= htmlspecialchars($_REQUEST['message'] ?? '') ?>" placeholder="Search in log messages">
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button type="submit" class="btn btn-primary me-2">
|
||||
<i class="fas fa-search me-2"></i>Search
|
||||
</button>
|
||||
<a href="?page=logs&tab=<?= htmlspecialchars($scope) ?>" class="btn btn-outline-secondary">
|
||||
<i class="fas fa-times me-2"></i>Clear
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /logs filter -->
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /logs filter -->
|
||||
|
||||
<!-- logs -->
|
||||
<!-- logs -->
|
||||
<?php if ($time_range_specified) { ?>
|
||||
<div class="alert alert-info m-3">
|
||||
<i class="fas fa-calendar-alt me-2"></i>Time period: <strong><?= htmlspecialchars($from_time) ?> - <?= htmlspecialchars($until_time) ?></strong>
|
||||
</div>
|
||||
<div class="alert alert-info m-3">
|
||||
<i class="fas fa-calendar-alt me-2"></i>Time period: <strong><?= htmlspecialchars($from_time) ?> - <?= htmlspecialchars($until_time) ?></strong>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="mb-5">
|
||||
<div class="mb-5">
|
||||
<?php if (!empty($logs['records'])) { ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<?php if ($scope === 'system') { ?>
|
||||
<th>Username (id)</th>
|
||||
<th>Username (id)</th>
|
||||
<?php } ?>
|
||||
<th>Time</th>
|
||||
<th>Log message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<th>Time</th>
|
||||
<th>Log message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($logs['records'] as $row) { ?>
|
||||
<tr>
|
||||
<tr>
|
||||
<?php if ($scope === 'system') { ?>
|
||||
<td><strong><?= htmlspecialchars($row['username']) ?> (<?= htmlspecialchars($row['userID']) ?>)</strong></td>
|
||||
<td><strong><?= htmlspecialchars($row['username']) ?> (<?= htmlspecialchars($row['userID']) ?>)</strong></td>
|
||||
<?php } ?>
|
||||
<td><span class="text-muted"><?= date('d M Y H:i', strtotime($row['time'])) ?></span></td>
|
||||
<td><?= htmlspecialchars($row['log message']) ?></td>
|
||||
</tr>
|
||||
<td><span class="text-muted"><?= date('d M Y H:i', strtotime($row['time'])) ?></span></td>
|
||||
<td><?= htmlspecialchars($row['log message']) ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php include '../app/templates/pagination.php'; ?>
|
||||
<?php } else { ?>
|
||||
<div class="alert alert-info m-3">
|
||||
<i class="fas fa-info-circle me-2"></i>No log entries found for the specified criteria.
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="alert alert-info m-3">
|
||||
<i class="fas fa-info-circle me-2"></i>No log entries found for the specified criteria.
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /log events -->
|
||||
|
|
|
@ -18,26 +18,24 @@ $range = 2;
|
|||
<?php if ($totalPages > 1): ?>
|
||||
<nav aria-label="Page navigation" class="mt-4">
|
||||
<ul class="pagination justify-content-center d-flex flex-row gap-1">
|
||||
|
||||
<!-- First page -->
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . $params) ?>">First</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . ($currentPage > 1 ? '&page_num=' . ($currentPage - 1) : '') . $params) ?>">«</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">First</span>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">«</span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($currentPage > 1): ?>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . $params) ?>">First</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . ($currentPage > 1 ? '&page_num=' . ($currentPage - 1) : '') . $params) ?>">«</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">First</span>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">«</span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<!-- Page numbers -->
|
||||
<?php
|
||||
<?php
|
||||
for ($i = 1; $i <= $totalPages; $i++) {
|
||||
// Show first, last, current page, 2 pages before and after current, and step pages (10, 20, etc.)
|
||||
if ($i === 1 ||
|
||||
|
@ -49,37 +47,32 @@ $range = 2;
|
|||
$i === $currentPage + 2 ||
|
||||
($i % 10 === 0 && $i > 10)
|
||||
) { ?>
|
||||
<li class="page-item <?= $i === (int)$currentPage ? 'active' : '' ?>">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . ($i > 1 ? '&page_num=' . $i : '') . $params) ?>">
|
||||
<?= $i ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php
|
||||
} elseif ($i === $currentPage - 3 || $i === $currentPage + 3) {
|
||||
?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">...</span>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
} ?>
|
||||
|
||||
<li class="page-item <?= $i === (int)$currentPage ? 'active' : '' ?>">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . ($i > 1 ? '&page_num=' . $i : '') . $params) ?>"><?= $i ?></a>
|
||||
</li>
|
||||
<?php } elseif ($i === $currentPage - 3 || $i === $currentPage + 3) { ?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">...</span>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<!-- Last page -->
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . '&page_num=' . ($currentPage + 1) . $params) ?>">»</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . '&page_num=' . $totalPages . $params) ?>">Last</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">»</span>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">Last</span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($currentPage < $totalPages): ?>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . '&page_num=' . ($currentPage + 1) . $params) ?>">»</a>
|
||||
</li>
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="<?= htmlspecialchars($app_root . '?page=' . $page . '&page_num=' . $totalPages . $params) ?>">Last</a>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">»</span>
|
||||
</li>
|
||||
<li class="page-item disabled">
|
||||
<span class="page-link">Last</span>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<?php endif; ?>
|
||||
|
|
Loading…
Reference in New Issue