67 lines
3.0 KiB
PHP
67 lines
3.0 KiB
PHP
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2>Artykuły <small class="text-muted">(<?= $total ?>)</small></h2>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body p-0">
|
|
<table class="table table-hover mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Tytuł</th>
|
|
<th>Strona</th>
|
|
<th>Temat</th>
|
|
<th>Status</th>
|
|
<th>Data</th>
|
|
<th>Akcje</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (empty($articles)): ?>
|
|
<tr><td colspan="7" class="text-center text-muted py-4">Brak artykułów</td></tr>
|
|
<?php else: ?>
|
|
<?php foreach ($articles as $article): ?>
|
|
<tr>
|
|
<td><?= $article['id'] ?></td>
|
|
<td>
|
|
<a href="/articles/<?= $article['id'] ?>">
|
|
<?= htmlspecialchars(mb_strimwidth($article['title'], 0, 50, '...')) ?>
|
|
</a>
|
|
</td>
|
|
<td><?= htmlspecialchars($article['site_name']) ?></td>
|
|
<td><span class="badge bg-secondary"><?= htmlspecialchars($article['topic_name']) ?></span></td>
|
|
<td>
|
|
<?php if ($article['status'] === 'published'): ?>
|
|
<span class="badge bg-success">Opublikowany</span>
|
|
<?php elseif ($article['status'] === 'failed'): ?>
|
|
<span class="badge bg-danger" title="<?= htmlspecialchars($article['error_message'] ?? '') ?>">Błąd</span>
|
|
<?php else: ?>
|
|
<span class="badge bg-warning">Wygenerowany</span>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td class="small"><?= $article['published_at'] ? date('d.m.Y H:i', strtotime($article['published_at'])) : date('d.m.Y H:i', strtotime($article['created_at'])) ?></td>
|
|
<td>
|
|
<a href="/articles/<?= $article['id'] ?>" class="btn btn-sm btn-outline-primary">
|
|
<i class="bi bi-eye"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if ($totalPages > 1): ?>
|
|
<nav class="mt-3">
|
|
<ul class="pagination justify-content-center">
|
|
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
|
<li class="page-item <?= $i === $page ? 'active' : '' ?>">
|
|
<a class="page-link" href="/articles?page=<?= $i ?>"><?= $i ?></a>
|
|
</li>
|
|
<?php endfor; ?>
|
|
</ul>
|
|
</nav>
|
|
<?php endif; ?>
|