Quelltext des aktuellen Standes
<?php
$this->layout('layouts/main', [
'page_title' => $page_title,
'current_route' => $current_route,
]);
function feTrashIcon(string $type): string
{
$paths = [
'folder' => '<path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>',
'file' => '<path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><polyline points="13 2 13 9 20 9"/>',
];
$color = $type === 'folder' ? '#f59e0b' : '#94a3b8';
return '<svg viewBox="0 0 24 24" fill="none" stroke="' . $color . '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18">' . $paths[$type] . '</svg>';
}
$total = count($trash_folders) + count($trash_files);
?>
<style>
.tr-wrap { max-width:960px; margin:0 auto; }
.tr-head { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; flex-wrap:wrap; }
.tr-box { background:var(--color-bg); border:1px solid var(--slate-200); border-radius:6px; overflow:hidden; }
.tr-row { display:flex; align-items:center; gap:0.65rem; padding:0.6rem 1rem; border-bottom:1px solid var(--slate-100); }
.tr-row:last-child { border-bottom:none; }
.tr-row:hover { background:var(--slate-50); }
.tr-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:0.86rem; color:var(--slate-800); font-weight:500; }
.tr-meta { font-size:0.76rem; color:var(--slate-400); white-space:nowrap; }
.tr-actions { display:flex; gap:0.4rem; flex-shrink:0; }
.tr-empty-icon { font-size:2.5rem; opacity:.5; margin-bottom:.5rem; }
.tr-badge { font-size:0.72rem; background:var(--slate-100); color:var(--slate-500); border-radius:99px; padding:0.05rem 0.45rem; }
form.tr-inline { display:inline; }
</style>
<div class="content-header">
<div>
<h1><?= $this->te('Papierkorb') ?></h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/"><?= $this->te('Home') ?></a></li>
<li class="breadcrumb-item"><a href="/files"><?= $this->te('Datei-Explorer') ?></a></li>
<li class="breadcrumb-item active"><?= $this->te('Papierkorb') ?></li>
</ol>
</div>
<div class="content-header-actions">
<a class="btn btn-default btn-sm" href="/files"><?= $this->te('← Zurück zum Explorer') ?></a>
<?php if ($can_delete && $total > 0): ?>
<form class="tr-inline" method="POST" action="/files/trash/empty"
onsubmit="return confirm('Den gesamten Papierkorb endgültig leeren? Diese Aktion kann nicht rückgängig gemacht werden.');">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<button class="btn btn-danger btn-sm" type="submit"><?= $this->te('Papierkorb leeren') ?></button>
</form>
<?php endif; ?>
</div>
</div>
<div class="content-body">
<div class="tr-wrap">
<?php if ($total === 0): ?>
<div class="tr-box">
<div class="empty-state">
<div class="tr-empty-icon">🗑️</div>
<div><?= $this->te('Der Papierkorb ist leer.') ?></div>
</div>
</div>
<?php else: ?>
<div class="tr-head">
<div style="font-size:0.85rem;color:var(--gray-500);"><?= $this->te($total === 1 ? '{anzahl} Element im Papierkorb' : '{anzahl} Elemente im Papierkorb', ['anzahl' => $total]) ?></div>
</div>
<div class="tr-box">
<?php foreach ($trash_folders as $f): ?>
<div class="tr-row">
<?= feTrashIcon('folder') ?>
<span class="tr-name"><?= htmlspecialchars($f['name']) ?></span>
<span class="tr-badge"><?= $this->te('Ordner') ?><?php if ((int)$f['item_count'] > 0): ?> · <?= $this->te((int)$f['item_count'] === 1 ? '{anzahl} Datei' : '{anzahl} Dateien', ['anzahl' => (int)$f['item_count']]) ?><?php endif; ?></span>
<span class="tr-meta"><?= $f['deleted_at'] ? date('d.m.Y H:i', strtotime($f['deleted_at'])) : '' ?></span>
<div class="tr-actions">
<form class="tr-inline" method="POST" action="/files/trash/restore">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<input type="hidden" name="batch" value="<?= htmlspecialchars($f['deleted_batch']) ?>">
<button class="btn btn-default btn-xs" type="submit"><?= $this->te('Wiederherstellen') ?></button>
</form>
<?php if ($can_delete): ?>
<form class="tr-inline" method="POST" action="/files/trash/purge"
onsubmit="return confirm('Ordner endgültig löschen? Diese Aktion kann nicht rückgängig gemacht werden.');">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<input type="hidden" name="batch" value="<?= htmlspecialchars($f['deleted_batch']) ?>">
<button class="btn btn-default btn-xs" type="submit" style="color:var(--red-600);"><?= $this->te('Löschen') ?></button>
</form>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
<?php foreach ($trash_files as $f): ?>
<div class="tr-row">
<?= feTrashIcon('file') ?>
<span class="tr-name"><?= htmlspecialchars($f['name']) ?></span>
<span class="tr-meta"><?= $mgr->formatSize((int)$f['file_size']) ?></span>
<span class="tr-meta"><?= $f['deleted_at'] ? date('d.m.Y H:i', strtotime($f['deleted_at'])) : '' ?></span>
<div class="tr-actions">
<form class="tr-inline" method="POST" action="/files/trash/restore">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<input type="hidden" name="batch" value="<?= htmlspecialchars($f['deleted_batch']) ?>">
<button class="btn btn-default btn-xs" type="submit"><?= $this->te('Wiederherstellen') ?></button>
</form>
<?php if ($can_delete): ?>
<form class="tr-inline" method="POST" action="/files/trash/purge"
onsubmit="return confirm('Datei endgültig löschen? Diese Aktion kann nicht rückgängig gemacht werden.');">
<input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
<input type="hidden" name="batch" value="<?= htmlspecialchars($f['deleted_batch']) ?>">
<button class="btn btn-default btn-xs" type="submit" style="color:var(--red-600);"><?= $this->te('Löschen') ?></button>
</form>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>