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 <?php
session_start(); 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"])) { if(empty($_POST["userID"]) OR empty($_POST["delete"]) AND empty($_POST["accept"]) AND empty($_POST["request"])) {
echo "Not enough arguments."; echo "Not enough arguments.";

View File

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

View File

@@ -64,3 +64,31 @@
#quick-links i:hover { #quick-links i:hover {
color: #FBC02D; 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(" $stmt = $GLOBALS["db"]->prepare("
SELECT SELECT
LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`, LEFT(CONCAT(`user`.`fname`, ' ', `user`.`lname`), 15) as `name`,
`user`.`userID`,
IFNULL( IFNULL(
`profilepicture`, `profilepicture`,
'../img/notbad.jpg' '../img/notbad.jpg'

View File

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

View File

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