63 lines
1.7 KiB
PHP
63 lines
1.7 KiB
PHP
<?php
|
|
$current_page = $_SERVER['SCRIPT_NAME'];
|
|
$nav = '
|
|
<nav>
|
|
<div class="row_space_between no_margin">
|
|
<div class="site_navigation">
|
|
<ul>
|
|
<li><a href="/index.php"' . ($current_page == '/index.php' ? ' class="underline"' : '') . '>Home</a></li>
|
|
<li><a href="/spaces.php?view=displaySpaces"' . ($current_page == '/spaces.php' ? ' class="underline"' : '') . '>Spaces</a></li>
|
|
';
|
|
|
|
if (isset($_SESSION['user'])) {
|
|
$nav .= '
|
|
<li><a href="/user.php?view=display&user_id=' . $_SESSION['user_id'] . '"' . ($current_page == '/user.php' ? ' class="underline"' : '') . '>Account</a></li>
|
|
<li><a href="/todo.php?view=display"' . ($current_page == '/todo.php' ? ' class="underline"' : '') . '>Todos</a></li>
|
|
';
|
|
|
|
if ($_SESSION['user'] <= developer) {
|
|
$nav .= '
|
|
<li><a href="/admin.php?view=users"' . ($current_page == '/admin.php' ? ' class="underline"' : '') . '>Admin</a></li>
|
|
';
|
|
}
|
|
}
|
|
|
|
$nav .= '
|
|
</ul>
|
|
</div>
|
|
<div class="nav_right_hand">
|
|
<form method="post">
|
|
';
|
|
|
|
$theme_toggle = '';
|
|
if ($_SESSION['theme'] == 'dark')
|
|
$theme_toggle = 'light';
|
|
else
|
|
$theme_toggle = 'dark';
|
|
|
|
$nav .= '
|
|
<button id="theme_toggle" value="' . $theme_toggle . '" name="theme"><i class="nf ' . ($theme_toggle == 'dark' ? 'nf-oct-moon' : 'nf-oct-sun') . '"></i></button>
|
|
</form>
|
|
';
|
|
|
|
if (isset($_SESSION['username'])) {
|
|
$nav .= '
|
|
<a href="user.php?view=logout">Log Out</a>
|
|
';
|
|
} else {
|
|
$nav .= '
|
|
<a href="user.php?view=login">Login</a>
|
|
<a href="user.php?view=signup">Sign Up</a>
|
|
';
|
|
}
|
|
|
|
$nav .= '
|
|
</div>
|
|
</div>
|
|
|
|
<script src="js/nav.js" defer></script>
|
|
</nav>
|
|
';
|
|
|
|
echo $nav;
|