Friends and friendrequest are fully ajax. Also added friend-item
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user