OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

archived-pages.php

4 KB
<?php $this->layout('layouts/admin', [
    'page_title' => 'Archivierte Seiten',
    'current_admin_page' => 'archived'
]); ?>

<?php $pages = $pages ?? []; ?>

<?php if (empty($pages)): ?>
    <div class="empty-state">
        <div class="empty-icon">&#128451;</div>
        <h2><?= $this->te('Keine archivierten Seiten') ?></h2>
        <p><?= $this->te('Es befinden sich aktuell keine Seiten im Archiv.') ?></p>
    </div>
<?php else: ?>
    <div class="archived-info">
        <?= $this->t(count($pages) === 1 ? '<strong>{anzahl}</strong> Seite im Archiv.' : '<strong>{anzahl}</strong> Seiten im Archiv.', ['anzahl' => count($pages)]) ?>
        <?= $this->te('Wiederhergestellte Seiten erscheinen wieder in ihrem urspr&uuml;nglichen Themengebiet.') ?>
    </div>

    <div class="table-responsive">
        <div class="table-wrapper">
        <table class="data-table">
            <thead>
                <tr>
                    <th scope="col"><?= $this->te('Titel') ?></th>
                    <th scope="col"><?= $this->te('Themengebiet') ?></th>
                    <th scope="col"><?= $this->te('Letzter Autor') ?></th>
                    <th scope="col"><?= $this->te('Archiviert am') ?></th>
                    <th scope="col" class="text-right"><?= $this->te('Aktion') ?></th>
                </tr>
            </thead>
            <tbody>
                <?php foreach ($pages as $page): ?>
                <tr>
                    <td>
                        <strong><?= $this->e($page['title']) ?></strong>
                    </td>
                    <td>
                        <?php if (!empty($page['topic_name'])): ?>
                            <span class="badge badge-muted"><?= $this->e($page['topic_name']) ?></span>
                        <?php else: ?>
                            <span class="text-muted">&ndash;</span>
                        <?php endif; ?>
                    </td>
                    <td><?= $this->e($page['created_by_name'] ?? '&ndash;') ?></td>
                    <td>
                        <span title="<?= $this->e($page['updated_at'] ?? '') ?>">
                            <?= $this->relativeTime($page['updated_at'] ?? '') ?>
                        </span>
                    </td>
                    <td class="text-right">
                        <form action="/admin/archived-pages/<?= $page['id'] ?>/restore" method="POST" style="display: inline;">
                            <input type="hidden" name="_csrf" value="<?= $this->csrf() ?>">
                            <button type="submit" class="btn btn-sm btn-primary"
                                    onclick="return confirm('Seite &laquo;<?= $this->e(addslashes($page['title'])) ?>&raquo; wiederherstellen?')">
                                <?= $this->te('&#8635; Wiederherstellen') ?>
                            </button>
                        </form>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        </div>
    </div>
<?php endif; ?>

<style>
.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}
.archived-info {
    padding: 0.75rem 1rem;
    background: var(--blue-50);
    border: 1px solid var(--blue-200);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--blue-800);
    margin-bottom: 1.5rem;
}

.table-responsive {
    overflow-x: auto;
}
.text-right {
    text-align: right;
}

.text-muted {
    color: var(--color-text-muted, var(--gray-500));
}

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-muted {
    background: var(--gray-100);
    color: var(--gray-700);
}
</style>