Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cse4707-secure-messaging/public/template/user_menu_button.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
40 lines (36 sloc)
1.27 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('APP_DIR') or define('APP_DIR', __DIR__ . '/../app/'); | |
include_once(APP_DIR . 'model/User.php'); | |
include_once(APP_DIR . 'model/SecureMessage.php'); | |
include_once(APP_DIR . 'include/http.php'); | |
$data = User::authenticated(); | |
$user = User::get($data->username); | |
$num_unread = SecureMessage::count_unread($user->id); | |
?> | |
<div class="user-button-container"> | |
<!-- Dropdown Trigger --> | |
<a class='dropdown-button btn user-button'data-activates='dropdown1'> | |
<?php echo $data->username ?> | |
<?php if ($num_unread > 0) { ?> | |
<span class="notification-count"> | |
<?php echo $num_unread ?> | |
</span> | |
<?php } ?> | |
</a> | |
<!-- Dropdown Structure --> | |
<ul id='dropdown1' class='dropdown-content'> | |
<li><a href="account.php">Account</a></li> | |
<li><a href ="user.php">User</a></li> | |
<?php if ($data->access == 'admin') { ?> | |
<li><a href ="admin.php">Admin</a></li> | |
<?php } ?> | |
<li class="divider"></li> | |
<li><a href="messages.php"> | |
Messages | |
<span class="new badge menu-messages-count" data-badge-caption=""> | |
<?php echo $num_unread ?> | |
</span> | |
</a></li> | |
<li><a href="logout.php">Sign out</a></li> | |
</ul> | |
</div> |