45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
|
<h2>Control Panel</h2>
|
||
|
<p><a href="<?= HOME_DIRECTORY ?>index.php?url=admin/create">New Post</a> </p>
|
||
|
|
||
|
<?php if (!empty($posts)): ?>
|
||
|
<table border="1" cellpadding="5" cellspacing="0">
|
||
|
<tr>
|
||
|
<th>ID</th>
|
||
|
<th>Title</th>
|
||
|
<th>Date</th>
|
||
|
<th>Actions</th>
|
||
|
</tr>
|
||
|
<?php foreach ($posts as $post): ?>
|
||
|
<tr>
|
||
|
<td><?= e($post['id']) ?></td>
|
||
|
<td><?= e($post['title']) ?></td>
|
||
|
<td><?= e($post['created_at']) ?></td>
|
||
|
<td>
|
||
|
<a href="<?= HOME_DIRECTORY ?>index.php?url=admin/edit/<?= e($post['id']) ?>">Edit</a> |
|
||
|
<a href="<?= HOME_DIRECTORY ?>index.php?url=admin/delete/<?= e($post['id']) ?>"
|
||
|
onclick="return confirm('Are you sure?')">
|
||
|
Delete
|
||
|
</a> |
|
||
|
<a href="<?= HOME_DIRECTORY ?>index.php?url=admin/hide/<?= e($post['id']) ?>"> Hide </a>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<?php endforeach; ?>
|
||
|
</table>
|
||
|
<?php if ($totalPages > 1): ?>
|
||
|
<p>
|
||
|
<?php for ($i = 1; $i <= $totalPages; $i++): ?>
|
||
|
<?php if ($i == $currentPage): ?>
|
||
|
<strong><?= $i ?></strong>
|
||
|
<?php else: ?>
|
||
|
<a href="?url=admin/index&page=<?= $i ?>"><?= $i ?></a>
|
||
|
<?php endif; ?>
|
||
|
<?php endfor; ?>
|
||
|
</p>
|
||
|
<?php endif; ?>
|
||
|
<p><a href=?url=admin/hidden>Hidden posts</a></p>
|
||
|
|
||
|
<?php else: ?>
|
||
|
<p>No new posts</p>
|
||
|
<?php endif; ?>
|
||
|
|