| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                 <!-- log events --> | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                 <div class="container-fluid mt-4"> | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                     <div class="row mb-4"> | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                         <div class="col-md-6"> | 
					
						
							| 
									
										
										
										
											2025-01-29 08:45:24 +00:00
										 |  |  |                             <h2 class="mb-0">Log events</h2> | 
					
						
							|  |  |  |                             <small>events recorded in the Jilo monitoring platform</small> | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                         </div> | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                     </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> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php if ($has_system_access) { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                         <li class="nav-item"> | 
					
						
							|  |  |  |                             <a class="nav-link <?= $scope === 'system' ? 'active' : '' ?>" href="?page=logs&tab=system"> | 
					
						
							|  |  |  |                                 Logs for all users | 
					
						
							|  |  |  |                             </a> | 
					
						
							|  |  |  |                         </li> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                     </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> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | <?php if ($scope === 'system') { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                 <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> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                                 <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"> | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                                 </div> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                 <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 --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     <!-- logs --> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php if ($time_range_specified) { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                     <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> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                     <div class="mb-5"> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php if (!empty($logs['records'])) { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                         <div class="table-responsive"> | 
					
						
							|  |  |  |                             <table class="table table-hover align-middle mb-0"> | 
					
						
							|  |  |  |                                 <thead class="table-light"> | 
					
						
							|  |  |  |                                     <tr> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php if ($scope === 'system') { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                         <th>Username (id)</th> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                         <th>Time</th> | 
					
						
							|  |  |  |                                         <th>Log message</th> | 
					
						
							|  |  |  |                                     </tr> | 
					
						
							|  |  |  |                                 </thead> | 
					
						
							|  |  |  |                                 <tbody> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php     foreach ($logs['records'] as $row) { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                     <tr> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php         if ($scope === 'system') { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                         <td><strong><?= htmlspecialchars($row['username']) ?> (<?= htmlspecialchars($row['userID']) ?>)</strong></td>
 | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php         } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                         <td><span class="text-muted"><?= date('d M Y H:i', strtotime($row['time'])) ?></span></td>
 | 
					
						
							|  |  |  |                                         <td><?= htmlspecialchars($row['log message']) ?></td>
 | 
					
						
							|  |  |  |                                     </tr> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php     } ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                                 </tbody> | 
					
						
							|  |  |  |                             </table> | 
					
						
							|  |  |  |                         </div> | 
					
						
							| 
									
										
										
										
											2025-01-22 22:15:52 +00:00
										 |  |  | <?php include '../app/templates/pagination.php'; ?>
 | 
					
						
							|  |  |  | <?php } else { ?>
 | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  |                         <div class="alert alert-info m-3"> | 
					
						
							|  |  |  |                             <i class="fas fa-info-circle me-2"></i>No log entries found for the specified criteria. | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                         </div> | 
					
						
							| 
									
										
										
										
											2025-02-28 11:50:54 +00:00
										 |  |  | <?php } ?>
 | 
					
						
							| 
									
										
										
										
											2025-01-26 12:07:28 +00:00
										 |  |  |                     </div> | 
					
						
							|  |  |  |                 </div> | 
					
						
							|  |  |  |                 <!-- /log events --> |