diff options
Diffstat (limited to 'custom/views/default/archive.tpl.php')
-rw-r--r-- | custom/views/default/archive.tpl.php | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/custom/views/default/archive.tpl.php b/custom/views/default/archive.tpl.php new file mode 100644 index 0000000..f775971 --- /dev/null +++ b/custom/views/default/archive.tpl.php @@ -0,0 +1,105 @@ +<?php +$pageTitle = $PlanetConfig->getName() . ' · ' . _g('All Headlines'); +$count = 0; +$today = array(); +$week = array(); +$month = array(); +$older = array(); +$now = time(); + +foreach ($items as $item) { + $age = ($now - $item->get_date('U')) / (60*60*24); + if ($age < 1) { + $today[] = $item; + } elseif ($age < 7) { + $week[] = $item; + } elseif ($age < 30) { + $month[] = $item; + } else { + $older[] = $item; + } +} + +header('Content-type: text/html; charset=UTF-8'); +?><!DOCTYPE html> +<html lang="<?=$PlanetConfig->getLocale()?>" class="no-js"> +<head> + <?php include(__DIR__.'/head.tpl.php'); ?> +</head> +<body> + <div id="page"> + <?php include(__DIR__.'/top.tpl.php'); ?> + <main id="content"> + <?php if (0 == count($items)) :?> + <article class="article"> + <h2 class="article-title"> + <?=_g('No article')?> + </h2> + <p class="article-content"><?=_g('No news, good news.')?></p> + </article> + <?php endif; ?> + <?php if (count($today)) : ?> + <article class="article"> + <h2><?=_g('Today')?></h2> + <ul> + <?php foreach ($today as $item) : ?> + <?php $feed = $item->get_feed(); ?> + <li> + <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> · + <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a> + </li> + <?php endforeach; ?> + </ul> + </article> + <?php endif; ?> + + <?php if (count($week)) : ?> + <div class="article"> + <h2><?=_g('This week')?></h2> + <ul> + <?php foreach ($week as $item) : ?> + <?php $feed = $item->get_feed(); ?> + <li> + <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> · + <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a> + </li> + <?php endforeach; ?> + </ul> + </div> + <?php endif; ?> + + <?php if (count($month)) : ?> + <div class="article"> + <h2><?=_g('This month')?></h2> + <ul> + <?php foreach ($month as $item) : ?> + <?php $feed = $item->get_feed(); ?> + <li> + <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> · + <a href="<?php echo $item->get_permalink(); ?>" title="<?=_g('Go to original place')?>"><?php echo $item->get_title(); ?></a> + </li> + <?php endforeach; ?> + </ul> + </div> + <?php endif; ?> + + <?php if (count($older)) : ?> + <div class="article"> + <h2><?=_g('Older items')?></h2> + <ul> + <?php foreach ($older as $item) : ?> + <?php $feed = $item->get_feed(); ?> + <li> + <a href="<?php echo $feed->getWebsite() ?>" class="source"><?php echo $feed->getName() ?></a> · + <a href="<?php echo $item->get_permalink(); ?>" title="Go to original place"><?php echo $item->get_title(); ?></a> + </li> + <?php endforeach; ?> + </ul> + </div> + <?php endif; ?> + </main> + <?php include_once(__DIR__.'/sidebar.tpl.php'); ?> + <?php include(__DIR__.'/footer.tpl.php'); ?> + </div> +</body> +</html> |