return null;
}
-function cx_pages_get() {
+function cx_pages_get(bool $include_drafts = false) {
$sql = 'SELECT
post_id,
post_slug,
post_title,
post_data
FROM posts
- WHERE post_is_page == TRUE
- AND post_is_draft == FALSE
- ORDER BY post_creation_time ASC;';
+ WHERE post_is_page == TRUE';
+
+ if ($include_drafts == false) {
+ $sql .= ' AND post_is_draft == FALSE';
+ }
+
+ $sql .= ' ORDER BY post_date ASC';
+
+ $sql .= ';';
foreach (cx_db_query($sql) as $post) {
$p = new Post($post);
<?php cx_template_base('base'); ?>
<h2>Posts</h2>
-<ul role="list">
+<table>
<?php foreach (cx_posts_get(include_drafts: true) as $post): ?>
-<li><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a> <a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">🚮</a></li>
+<tr>
+ <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+</tr>
<?php endforeach; ?>
-</ul>
+</table>
<h2>Pages</h2>
-<ul role="list">
-<?php foreach (cx_pages_get() as $post): ?>
-<li><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a> <a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">🚮</a></li>
+<table>
+<?php foreach (cx_pages_get(include_drafts: true) as $post): ?>
+<tr>
+ <td class="fill"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>"><?= $post->title ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/edit?id=' . $post->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/posts/delete?id=' . $post->id); ?>">Delete</a></td>
+</tr>
<?php endforeach; ?>
-</ul>
+</table>
<h2>Images</h2>
-<ul role="list">
+<table>
<?php foreach (cx_images_get() as $image): ?>
-<li><a href="<?= cx_url_admin('/images/edit?id=' . $image->id); ?>"><?= $image->url ?></a> <a href="<?= cx_url_admin('/images/delete?id=' . $image->id); ?>">🚮</a></li>
+<tr>
+ <td class="fill"><a href="<?= $image->url ?>"><?= $image->url ?></a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/edit?id=' . $image->id); ?>">Edit</a></td>
+ <td class="hug"><a href="<?= cx_url_admin('/images/delete?id=' . $image->id); ?>">Delete</a></td>
+</tr>
<?php endforeach; ?>
-</ul>
+</table>