
<?php
$method = $this->uri->segment(2);
$username = $this->session->userdata('username');
?>

<nav class="site-navigation" role="navigation">

	<?php
	if( $method == 'login' OR $method == 'registration' OR $method == 'reset_password' ): // if user is not logged in
	?>
		<ul>
			<li<?php if ($method == 'login') {echo ' class="active"';} ?>>
				<?php echo anchor(base_url().'admin/login', 'Login'); ?>
			</li>
			<li<?php if ($method == 'registration') {echo ' class="active"';} ?>>
				<?php echo anchor(base_url().'admin/registration', 'Registration'); ?>
			</li>
			<li<?php if ($method == 'reset_password') {echo ' class="active"';} ?>>
				<?php echo anchor(base_url().'admin/reset_password', 'Reset password'); ?>
			</li>
			<li><?php echo anchor(base_url().'', 'Visit site'); ?></li>
		</ul>
	<?php else: // if user is logged in ?>
		<ul>
			<li<?php if ($method == 'index' OR $method == '') {echo ' class="active"';} ?>>
				<?php echo anchor(base_url().'admin/', 'Dashboard'); ?>
			</li>
			<li<?php if ($method == 'posts' OR $method == 'post_edit') {echo ' class="active"';} ?>>
				<?php echo anchor(base_url().'admin/posts', 'Posts'); ?>
			</li>
			<li><?php echo anchor(base_url().'', 'Visit site'); ?></li>
			<li>Signed in as <a href="#" class="navbar-link"><?php echo $username; ?></a></li>
			<li><?php echo anchor(base_url().'admin/logout', 'Logout'); ?></li>
		</ul>
	<?php endif; ?>

</nav> <!-- /.site-navigation -->
