<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title><?php if(Navigation::getTitle()) echo Navigation::getTitle() . " - ";  ?>Seinheit</title>
	<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/main.css" />
<?php if(Access::isLoggedIn()): ?> 
	<link rel="stylesheet" type="text/css" href="<?php echo $this->base ?>/style/admin.css" />
	<script src="<?php echo $this->base ?>/script/admin.js"></script>
<?php endif ?>
</head>
<body<?php if(Access::isLoggedIn()): ?> class="admin"<?php endif ?>>

<div id="container">
	<header>

		<?php if(Access::isLoggedIn()): ?>
			<ul id="adminNavigation">
				<li>Admin Bereich</li>
				<li><a href="<?php echo $this->base ?>/adminNavigation">Navigationen</a></li>
				<li><a href="<?php echo $this->base ?>/adminPage">Pages</a></li>
				<?php if(Katharsis_Request::getControllerName() == 'page'): ?>
					<li><a href="<?php echo $this->base ?>/adminPage/edit/pageId/<?php echo $this->id; ?>">Page Editieren</a></li>
				<?php endif ?>
				<li><a href="<?php echo $this->base ?>/admin/logout">Ausloggen</a></li>
			</ul>
		<?php endif ?>

		<?php if($this->notices): ?>
			<ul class="notices">
			<?php foreach($this->notices as $notice): ?>
				<li><?php echo $notice ?></li>
			<?php endforeach ?>
			</ul>
		<?php endif ?>

		<nav>
		    <a id="logo" href="<?php echo $this->base ?>/"><img src="<?php echo $this->base ?>/img/logo.png" alt="SEINHEIT logo"/></a>

			<ul id="navi">
			<?php foreach($this->mainNavigationItems as $item): ?>
				<li<?php if($item['id'] == $this->activeMenuItem) echo ' class="active"'?>>
					<?php if($item['link']): ?>
						<a href="<?php echo $item['link'] ?>"><?php echo $item['name'] ?></a>
					<?php else: ?>
						<a href="<?php echo $this->base ?>/<?php echo $item['controller'] ?>/<?php echo $item['action'] ?>"><?php echo $item['name'] ?></a>
					<?php endif ?>

					<?php if(count($item['children']) > 0): ?>
						<ul>
						<?php foreach($item['children'] as $child): ?>
							<li<?php if($child['id'] == $this->activeSubMenuItem) echo ' class="active"'?>>
								<?php if($child['link']): ?>
									<a href="<?php echo $child['link'] ?>"><?php echo $child['name'] ?></a>
								<?php else: ?>
									<a href="<?php echo $this->base ?>/<?php echo $child['controller'] ?>/<?php echo $child['action'] ?>"><?php echo $child['name'] ?></a>
								<?php endif ?>
							</li>
						<?php endforeach ?>
						</ul>
					<?php endif ?>
				</li>
			<?php endforeach ?>
			</ul>
		</nav>

	</header>

	<article id="stage">
		<?php echo $this->stageContent ?>
	</article>

	<footer>
		<p id="social">
			<a href="https://www.facebook.com/pages/Naturheilpraxis-SEINHEIT/190046497711632">
				<img src="<?php echo $this->base ?>/img/facebook-icon.png" alt="SEINHEIT bei Facebook">
			</a>
		</p>
		<p>Naturheilpraxis SEINHEIT. Kinga Pannek, Bahnhofstraße 105, 8620 Wetzikon, Schweiz</p>
	</footer>

</div>
</body>
</html>