This commit is contained in:
Jay Trees 2022-01-14 08:34:55 +01:00
parent 601364a7ea
commit 1868aea065
2 changed files with 55 additions and 15 deletions

View file

@ -6,6 +6,8 @@
namespace wishthis; namespace wishthis;
use wishthis\User;
class Page class Page
{ {
private string $language = 'en'; private string $language = 'en';
@ -93,22 +95,50 @@ class Page
?> ?>
<div class="ui attached stackable menu"> <div class="ui attached stackable menu">
<div class="ui container"> <div class="ui container">
<a class="item"> <a class="item" href="/?page=home">
<i class="home icon"></i> Home <i class="home icon"></i> Home
</a> </a>
<a class="item">
<i class="grid layout icon"></i> Browse
</a>
<a class="item">
<i class="mail icon"></i> Messages
</a>
<div class="ui simple dropdown item"> <div class="ui simple dropdown item">
More Wishlist
<i class="dropdown icon"></i> <i class="dropdown icon"></i>
<div class="menu"> <div class="menu">
<a class="item"><i class="edit icon"></i> Edit Profile</a> <a class="item" href="/?page=wishlist-create">
<a class="item"><i class="globe icon"></i> Choose Language</a> <i class="list icon"></i>
<a class="item"><i class="settings icon"></i> Account Settings</a> Create
</a>
<a class="item" href="/?page=wishlist-product-add">
<i class="plus square icon"></i>
Add product
</a>
</div>
</div>
<div class="ui simple dropdown item">
Account
<i class="dropdown icon"></i>
<div class="menu">
<?php
$user = new User();
if ($user->isLoggedIn()) {
?>
<a class="item" href="/?page=logout">
<i class="sign out alternate icon"></i>
Logout
</a>
<?php
} else {
?>
<a class="item" href="/?page=login">
<i class="sign in alternate icon"></i>
Login
</a>
<a class="item" href="/?page=register">
<i class="user plus icon"></i>
Register
</a>
<?php
}
?>
</div> </div>
</div> </div>
<div class="right item"> <div class="right item">

View file

@ -23,6 +23,16 @@ class User
} }
} }
/**
* Return whether the current user is logged in.
*
* @return bool
*/
public function isLoggedIn(): bool
{
return isset($_SESSION['user']);
}
/** /**
* Returns a list of the users wishlists. * Returns a list of the users wishlists.
* Defaults to the currently logged in user. * Defaults to the currently logged in user.