2013-10-05 12:55:03 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
2013-10-05 21:22:28 +02:00
|
|
|
<?php if (isset($this->context->subTitle)): ?>
|
|
|
|
<title><?php printf('%s – %s', $this->context->title, $this->context->subTitle) ?></title>
|
|
|
|
<?php else: ?>
|
|
|
|
<title><?php echo $this->context->title ?></title>
|
|
|
|
<?php endif ?>
|
2013-10-05 22:52:55 +02:00
|
|
|
<?php foreach ($this->context->stylesheets as $name): ?>
|
|
|
|
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>" />
|
|
|
|
<?php endforeach ?>
|
2013-10-06 13:21:16 +02:00
|
|
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
2013-10-05 12:55:03 +02:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
2013-10-05 19:24:08 +02:00
|
|
|
<nav>
|
2013-10-05 22:52:55 +02:00
|
|
|
<div class="main-wrapper">
|
|
|
|
<ul>
|
|
|
|
<?php
|
|
|
|
$preNav = [];
|
|
|
|
$postNav = [];
|
|
|
|
|
|
|
|
$preNav []= ['Home', \Chibi\UrlHelper::route('index', 'index')];
|
|
|
|
$preNav []= ['Browse', \Chibi\UrlHelper::route('post', 'list')];
|
|
|
|
$preNav []= ['Comments', \Chibi\UrlHelper::route('comment', 'list')];
|
|
|
|
$preNav []= ['Favorites', \Chibi\UrlHelper::route('post', 'favorites')];
|
2013-10-06 13:21:16 +02:00
|
|
|
if (PrivilegesHelper::confirm($this->context->user, Privilege::UploadPost))
|
|
|
|
$preNav []= ['Upload', \Chibi\UrlHelper::route('post', 'upload')];
|
|
|
|
|
2013-10-05 22:52:55 +02:00
|
|
|
if (!$this->context->loggedIn)
|
|
|
|
{
|
|
|
|
$postNav []= ['Login', \Chibi\UrlHelper::route('auth', 'login')];
|
|
|
|
$postNav []= ['Register', \Chibi\UrlHelper::route('auth', 'register')];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$postNav []= ['Account', \Chibi\UrlHelper::route('user', 'show', ['name' => $this->context->user->name])];
|
|
|
|
$postNav []= ['Logout', \Chibi\UrlHelper::route('auth', 'logout')];
|
|
|
|
}
|
|
|
|
|
|
|
|
function printNav($nav)
|
|
|
|
{
|
|
|
|
foreach ($nav as $navItem)
|
|
|
|
{
|
|
|
|
list ($text, $link) = $navItem;
|
|
|
|
echo '<li>';
|
|
|
|
echo '<a href="' . $link . '">' . $text . '</a>';
|
|
|
|
echo '</li>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php printNav($preNav); ?>
|
|
|
|
<li class="search">
|
|
|
|
<form action="<?php echo \Chibi\UrlHelper::route('post', 'list') ?>" method="get">
|
|
|
|
<input type="search" name="query" placeholder="search…" value="<?php if (isset($this->context->searchQuery)) echo $this->context->searchQuery ?>">
|
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
<?php printNav($postNav); ?>
|
|
|
|
</ul>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
2013-10-05 19:24:08 +02:00
|
|
|
</nav>
|
2013-10-05 12:55:03 +02:00
|
|
|
|
2013-10-05 22:52:55 +02:00
|
|
|
<section id="content">
|
|
|
|
<div class="main-wrapper">
|
|
|
|
<?php echo $this->renderView() ?>
|
|
|
|
</div>
|
2013-10-05 19:24:08 +02:00
|
|
|
</section>
|
2013-10-05 12:55:03 +02:00
|
|
|
</body>
|
|
|
|
</html>
|