-
Notifications
You must be signed in to change notification settings - Fork 0
/
page-list.php
executable file
·36 lines (34 loc) · 1.1 KB
/
page-list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php theme_include('partial/header'); ?>
<main class="container padding-container">
<?php
if (user_authed() && user_authed_role() == 'administrator') {
$items = Query::table(Base::table('posts'))
->get();
} else {
$items = Query::table(Base::table('posts'))
->where('status', '=', 'published')->get();
}
$previousMonth = "";
$page = Registry::get('posts_page');
?>
<div id="previousPosts">
<?php
for ($i = count($items) - 1; $i >= 0; $i--) {
$item = $items[$i];
$currMonth = date('F Y', strtotime($item->created));
if ($currMonth != $previousMonth) {
if ($previousMonth != "") { echo "</ul>"; }
echo "<p class='month'>{$currMonth}</p>";
echo "<ul>";
$previousMonth = $currMonth;
}
$suffix = "";
if ($item->status != 'published') {
$suffix = " <span class='glyphicon' style='font-size:0.7em;'></span>";
}
echo "<li><a href='" . base_url($page->slug . '/' . $item->slug) . "' title='" . $item->title . "'>" . $item->title . "$suffix</a></li>";
}
?>
</div>
</main>
<?php theme_include('partial/footer'); ?>