first commit
This commit is contained in:
commit
c9fb67e751
423 files changed
+53287
No files matched your search
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
// Verificar se o usuário está logado
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
}
|
||||
$processed_dir = './processed/';
|
||||
date_default_timezone_set('America/Araguaina');
|
||||
|
||||
if (is_dir($processed_dir)) {
|
||||
$files = scandir($processed_dir);
|
||||
$files = array_diff($files, array('.', '..'));
|
||||
usort($files, function($a, $b) use ($processed_dir) {
|
||||
return filemtime($processed_dir . $b) - filemtime($processed_dir . $a);
|
||||
});
|
||||
} else {
|
||||
$files = [];
|
||||
}
|
||||
|
||||
// Paginação
|
||||
$files_per_page = 10;
|
||||
$total_files = count($files);
|
||||
$total_pages = ceil($total_files / $files_per_page);
|
||||
$current_page = isset($_GET['page_num']) ? (int)$_GET['page_num'] : 1;
|
||||
$current_page = max(1, min($total_pages, $current_page));
|
||||
$start_index = ($current_page - 1) * $files_per_page;
|
||||
$paginated_files = array_slice($files, $start_index, $files_per_page);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt-BR">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Lista de Arquivos Processados</title>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.11.3/css/lightbox.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
table { width: 100%; border-collapse: collapse; }
|
||||
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #ddd; }
|
||||
th { background-color: #f4f4f4; }
|
||||
a.download-link { color: #007BFF; text-decoration: none; }
|
||||
a.download-link:hover { text-decoration: underline; }
|
||||
.pagination { margin-top: 20px; text-align: center; }
|
||||
.pagination a { margin: 0 5px; text-decoration: none; color: #007BFF; }
|
||||
.pagination a:hover { text-decoration: underline; }
|
||||
.lightbox-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.8);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
.lightbox-content {
|
||||
width: 80%;
|
||||
height: 80%;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.lightbox-content iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.lightbox-close {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 5px 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>Lista de Arquivos Processados</h2>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nome do Arquivo</th>
|
||||
<th>Data de Modificação</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($paginated_files as $file): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a class="download-link" href="#" data-file="<?php echo 'processed/' . urlencode($file); ?>" data-title="<?php echo htmlspecialchars($file); ?>">
|
||||
<?php echo htmlspecialchars($file); ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo date("d/m/Y H:i:s", filemtime($processed_dir . $file)); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="pagination">
|
||||
<?php if ($current_page > 1): ?>
|
||||
<a href="index.php?page=list_files&page_num=<?php echo $current_page - 1; ?>">« Anterior</a>
|
||||
<?php endif; ?>
|
||||
<?php for ($i = 1; $i <= $total_pages; $i++): ?>
|
||||
<a href="index.php?page=list_files&page_num=<?php echo $i; ?>" <?php if ($i == $current_page) echo 'style="font-weight: bold;"'; ?>><?php echo $i; ?></a>
|
||||
<?php endfor; ?>
|
||||
<?php if ($current_page < $total_pages): ?>
|
||||
<a href="index.php?page=list_files&page_num=<?php echo $current_page + 1; ?>">Próximo »</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="lightbox" class="lightbox-container">
|
||||
<div class="lightbox-content">
|
||||
<button class="lightbox-close" onclick="closeLightbox()">Fechar</button>
|
||||
<iframe id="lightbox-iframe" src="" frameborder="0"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('.download-link').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
var fileUrl = $(this).data('file');
|
||||
$('#lightbox-iframe').attr('src', fileUrl);
|
||||
$('#lightbox').css('display', 'flex'); // Usar flex para centralizar
|
||||
});
|
||||
});
|
||||
|
||||
function closeLightbox() {
|
||||
$('#lightbox').hide();
|
||||
$('#lightbox-iframe').attr('src', '');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user