Friends and friendrequest are fully ajax. Also added friend-item
This commit is contained in:
@@ -37,9 +37,8 @@
|
||||
</li>
|
||||
";
|
||||
}
|
||||
|
||||
$chatID = $_GET["chatID"];
|
||||
if (isset($chatID) && $chatID != "") {
|
||||
if (isset($_GET["chatID"]) && $_GET["chatID"] != "") {
|
||||
$chatID = $_GET["chatID"];
|
||||
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<title>MyHyvesbook+</title>
|
||||
<!-- Add your javascript files here. -->
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="js/main.js"></script>
|
||||
<script src="js/header.js"></script>
|
||||
<script src="js/menu.js"></script>
|
||||
<script src="js/notifications.js"></script>
|
||||
|
||||
@@ -1,75 +1,19 @@
|
||||
<nav class="menu">
|
||||
<section id="friends-menu-section">
|
||||
<?php
|
||||
|
||||
// Load file.
|
||||
require_once("../queries/friendship.php");
|
||||
require_once("../queries/user.php");
|
||||
|
||||
// Get confirmed friends of the user and a random non-friend.
|
||||
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
|
||||
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
||||
$i = 0;
|
||||
|
||||
if (sizeof($friends) == 0) {
|
||||
echo "
|
||||
<ul class=\"nav-list\"><li class='friend-item'>
|
||||
<form action='profile.php' method='get'>
|
||||
<button type='submit'
|
||||
name='username'
|
||||
value='$randomUser'>
|
||||
<div class='friend'>
|
||||
Maak nieuwe vrienden :)
|
||||
</div>
|
||||
</button>
|
||||
</form>
|
||||
</li><ul class=\"nav-list\">
|
||||
";
|
||||
} else {
|
||||
echo "
|
||||
<h4>
|
||||
Vrienden
|
||||
</h4>
|
||||
<ul class=\"nav-list\">
|
||||
";
|
||||
|
||||
foreach ($friends as $i => $friend) {
|
||||
$username = $friend["username"];
|
||||
$name = $friend["name"];
|
||||
$extraItem = "";
|
||||
$pf = $friend["profilepicture"];
|
||||
|
||||
if ($i >= 5)
|
||||
$extraItem = "extra-menu-items";
|
||||
|
||||
echo "
|
||||
<li class='friend-item $extraItem'>
|
||||
<form action='profile.php' method='get'>
|
||||
<button type='submit'
|
||||
name='username'
|
||||
value='$username'>
|
||||
<div class='friend'>
|
||||
<img alt='PF' class='profile-picture' src='$pf'/>
|
||||
<div class='friend-name'>
|
||||
$name<br/>
|
||||
<span style='color: #666'>$username</span>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
";
|
||||
}
|
||||
|
||||
if (sizeof($friends) > 5) {
|
||||
echo "
|
||||
<li class='more-item' id='more-friends-click'>
|
||||
Meer vrienden..
|
||||
</li>
|
||||
";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h4>
|
||||
Vrienden
|
||||
</h4>
|
||||
<ul id="menu-friends-list" class="nav-list">
|
||||
</ul>
|
||||
<h4><form action="search.php">
|
||||
<input type="hidden"
|
||||
value="friends"
|
||||
name="filter" />
|
||||
<button value=""
|
||||
name="search">
|
||||
Alle vrienden...
|
||||
</button>
|
||||
</form></h4>
|
||||
</section>
|
||||
<section id="groups-menu-section">
|
||||
<?php
|
||||
|
||||
@@ -5,19 +5,19 @@
|
||||
<a href="profile.php"><i class="fa fa-user" data-title="Profiel"></i></a>
|
||||
<a href="logout.php"><i class="fa fa-sign-out" data-title="Uitloggen"></i></a>
|
||||
</section>
|
||||
<section>
|
||||
<section id="friend-request-section">
|
||||
<h4>
|
||||
Vriendchapsverzoeken
|
||||
</h4>
|
||||
<ul class="nav-list" id="friendrequestslist">
|
||||
<ul class="nav-list" id="friend-requests-list">
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
<section>
|
||||
<section id="unread-messages-section">
|
||||
<h4>
|
||||
Nieuwe berichten
|
||||
</h4>
|
||||
<ul class="nav-list" id="unreadChatlist">
|
||||
<ul class="nav-list" id="unread-chat-list">
|
||||
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user