Dingen door elkaar

This commit is contained in:
Lars van Hijfte
2017-01-24 17:06:39 +01:00
parent fd055e8355
commit 7bf8a16cf0
6 changed files with 61 additions and 7 deletions

View File

@@ -1,7 +1,8 @@
<?php
session_start();
require("../queries/friendship.php");
require("../queries/user.php");
require("../../queries/friendship.php");
require("../../queries/user.php");
if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
echo "Not enough arguments.";

View File

@@ -2,8 +2,8 @@ function showFriendNotifications(notifications) {
$("#friendrequestslist").html("");
for (i in notifications) {
$("#friendrequestslist").append(" \
<li class='friend-item $extraItem'> \
<form action='profile.php' method='get'> \
<li class='friend-item'> \
<form action='profile.php' method='post'> \
<button type='submit' \
name='username' \
value='"+ notifications[i].username +"'> \
@@ -13,6 +13,22 @@ function showFriendNotifications(notifications) {
</div> \
</button> \
</form> \
<div class='notification-options'>\
<form action='API/edit_friendship.php' method='post'> \
<button type='submit' \
name='accept' \
class='accept-notification' \
value='"+ notifications[i].userID +"'> \
<i class='fa fa-check'></i> \
</button>\
<button\
name='delete' \
class='deny-notification' \
value='"+ notifications[i].userID +"'> \
<i class='fa fa-times'></i> \
</button> \
<form>\
</div> \
</li> \
");
}
@@ -22,10 +38,10 @@ function showChatNotifications(notifications) {
$("#unreadChatlist").html("");
for (i in notifications) {
$("#unreadChatlist").append(" \
<li class='friend-item $extraItem'> \
<li class='friend-item'> \
<form action='chat.php' method='get'> \
<button type='submit' \
name='username' \
name='chatID' \
value='"+ notifications[i].userID +"'> \
<div class='friend'> \
<img alt='PF' class='profile-picture' src='"+ notifications[i].profilepicture +"'/> \

View File

@@ -64,3 +64,31 @@
#quick-links i:hover {
color: #FBC02D;
}
.notification-options {
display: none;
width: 100%;
}
.notification-options form {
width: 100%;
text-align: center;
}
.notification-options button {
display: inline-block;
padding: 5px 20px;
width: auto;
}
.accept-notification:hover {
color: #4CAF50;
}
.deny-notification:hover {
color: firebrick;
}
.friend-item:hover .notification-options {
display: inline-block;
}

View File

@@ -80,6 +80,7 @@ function selectAllUnreadChat() {
$stmt = $GLOBALS["db"]->prepare("
SELECT
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
`user`.`userID`,
IFNULL(
`profilepicture`,
'../img/notbad.jpg'

View File

@@ -35,7 +35,12 @@
</div>
</div>
</li>
";
";
}
$chatID = $_GET["chatID"];
if (isset($chatID) && $chatID != "") {
echo "<script>$(document).ready(function(){switchUser('$chatID')});</script>";
}
?>
</ul>

View File

@@ -0,0 +1,3 @@
<?php
echo json_encode(selectAllFriends($_SESSION["userID"])->fetchAll());