szurubooru/src/Views/index-index.phtml

66 lines
1.7 KiB
PHTML
Raw Normal View History

<?php
2014-04-29 21:35:29 +02:00
Assets::setSubtitle('home');
Assets::addStylesheet('index-index.css');
?>
2013-10-21 09:35:06 +02:00
<div id="welcome">
2014-04-29 21:35:29 +02:00
<h1><?= getConfig()->main->title ?></h1>
2013-10-19 13:38:20 +02:00
<p>
2014-04-27 14:44:06 +02:00
<span>serving <?= $this->context->transport->postCount ?> posts</span>
2013-10-19 13:38:20 +02:00
</p>
</div>
<?php if (!empty($this->context->featuredPost)): ?>
2013-10-21 09:35:06 +02:00
<div class="body">
2014-04-27 15:59:29 +02:00
<?php
$this->context->transport->post = $this->context->featuredPost;
2014-04-29 21:35:29 +02:00
$this->context->imageLink = \Chibi\Router::linkTo(['PostController', 'viewAction'], [
2014-04-27 15:59:29 +02:00
'id' => $this->context->featuredPost->id]);
?>
2014-04-29 21:35:29 +02:00
<?php \Chibi\View::render('post-file-render', $this->context) ?>
2013-10-21 09:35:06 +02:00
</div>
2013-10-19 13:38:20 +02:00
2013-10-21 09:35:06 +02:00
<div class="footer">
2013-11-18 14:00:54 +01:00
<div class="left">
2013-11-10 12:23:59 +01:00
Tags:&nbsp;
<ul class="tags">
<?php $tags = $this->context->featuredPost->getTags() ?>
<?php uasort($tags, function($a, $b) { return strnatcasecmp($a->name, $b->name); }) ?>
<?php foreach ($tags as $tag): ?>
<li>
2014-05-02 13:49:31 +02:00
<a href="<?= \Chibi\Router::linkTo(['PostController', 'listView'], ['query' => $tag->name]) ?>">
2014-04-27 14:44:06 +02:00
<?= $tag->name ?>
</a>
</li>
<?php endforeach ?>
2013-11-10 12:23:59 +01:00
</ul>
2013-11-18 14:00:54 +01:00
</div>
2013-11-10 12:23:59 +01:00
2013-11-18 14:00:54 +01:00
<div class="right">
2014-04-27 15:59:29 +02:00
Featured
2013-11-10 12:23:59 +01:00
<?php if ($this->context->featuredPostUser): ?>
2014-04-27 15:59:29 +02:00
by
2014-04-30 00:11:13 +02:00
<a href="<?= \Chibi\Router::linkTo(
['UserController', 'viewAction'],
['name' => $this->context->featuredPostUser->name]) ?>">
2014-04-27 15:59:29 +02:00
<?= $this->context->featuredPostUser->name ?>
</a>,
2013-11-10 12:23:59 +01:00
<?php endif ?>
2014-04-27 15:59:29 +02:00
2013-11-10 12:23:59 +01:00
<?php $x = round((time() - $this->context->featuredPostDate) / (24 * 3600.)) ?>
<?php if ($x == 0): ?>
today
<?php elseif ($x == 1):?>
yesterday
<?php else: ?>
<?php printf('%d days ago', $x) ?>
<?php endif ?>
2013-11-18 14:00:54 +01:00
</div>
2013-11-10 12:23:59 +01:00
2013-10-19 13:38:20 +02:00
<div class="clear"></div>
</div>
2013-10-21 09:35:06 +02:00
<div class="clear"></div>
2013-10-19 13:38:20 +02:00
<?php endif ?>