Merge branch 'lars-algemeen' into 'master'
Lars algemeen See merge request !98
This commit was merged in pull request #102.
This commit is contained in:
8
website/public/API/loadChatNotifications.php
Normal file
8
website/public/API/loadChatNotifications.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
require_once ("../../queries/connect.php");
|
||||||
|
require_once ("../../queries/friendship.php");
|
||||||
|
|
||||||
|
echo selectAllUnreadChat();
|
||||||
@@ -13,14 +13,14 @@ $(document).ready(function() {
|
|||||||
marginRight: "256px"
|
marginRight: "256px"
|
||||||
}, 500);
|
}, 500);
|
||||||
$(".chat-right").animate({
|
$(".chat-right").animate({
|
||||||
width: "100%"
|
width: "calc(100% - 512px - 40px)"
|
||||||
}, 500);
|
}, 500);
|
||||||
$("#notification-center").animate({
|
$("#notification-center").animate({
|
||||||
right: "0px"
|
right: "0px"
|
||||||
}, 500);
|
}, 500);
|
||||||
} else {
|
} else {
|
||||||
$(".chat-right").animate({
|
$(".chat-right").animate({
|
||||||
width: "100%"
|
width: "calc(100% - 256px - 40px)"
|
||||||
}, 500);
|
}, 500);
|
||||||
$(".content").animate({
|
$(".content").animate({
|
||||||
marginRight: "0px"
|
marginRight: "0px"
|
||||||
@@ -30,4 +30,6 @@ $(document).ready(function() {
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#own-profile-picture").click();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
function showNotifications(notifications, id) {
|
function showNotifications(notifications, id) {
|
||||||
$("#friendrequestslist").html("");
|
$("#" + id).html("");
|
||||||
for (i in notifications) {
|
for (i in notifications) {
|
||||||
$("#friendrequestslist").append(" \
|
$("#" + id).append(" \
|
||||||
<li class='friend-item $extraItem'> \
|
<li class='friend-item $extraItem'> \
|
||||||
<form action='profile.php' method='get'> \
|
<form action='profile.php' method='get'> \
|
||||||
<button type='submit' \
|
<button type='submit' \
|
||||||
@@ -20,15 +20,25 @@ function showNotifications(notifications, id) {
|
|||||||
|
|
||||||
function loadNotifications() {
|
function loadNotifications() {
|
||||||
$.post(
|
$.post(
|
||||||
"API/loadNotifications.php"
|
"API/loadFriendRequestNotifications.php"
|
||||||
).done(function(data) {
|
).done(function(data) {
|
||||||
if (data && data != "[]") {
|
if (data && data != "[]") {
|
||||||
showNotifications(JSON.parse(data), "friendrequestslist");
|
showNotifications(JSON.parse(data), "friendrequestslist");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$.post(
|
||||||
|
"API/loadChatNotifications.php"
|
||||||
|
).done(function(data) {
|
||||||
|
if (data && data != "[]") {
|
||||||
|
showNotifications(JSON.parse(data), "unreadChatlist");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(loadNotifications, 10000);
|
setTimeout(loadNotifications, 10000);
|
||||||
}
|
}
|
||||||
|
$(document).ready(function() {
|
||||||
|
loadNotifications();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
loadNotifications();
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
footer {
|
footer {
|
||||||
width: calc(100% - 256px);
|
width: 100%;
|
||||||
margin-left: 256px;
|
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.4);
|
background-color: rgba(0,0,0,0.4);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ textarea {
|
|||||||
|
|
||||||
textarea:hover, input:hover, select:hover {
|
textarea:hover, input:hover, select:hover {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 1px 1px rgba(0,0,0,0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea:focus, input:focus, select:focus {
|
textarea:focus, input:focus, select:focus {
|
||||||
|
|||||||
@@ -6,15 +6,15 @@
|
|||||||
left: 0;
|
left: 0;
|
||||||
top: 80px;
|
top: 80px;
|
||||||
height: calc(100% - 80px);
|
height: calc(100% - 80px);
|
||||||
width: 256px;
|
width: 236px;
|
||||||
|
|
||||||
background-color: #EEE;
|
padding: 20px 10px;
|
||||||
/*box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu section {
|
.menu section {
|
||||||
margin: 0 5px 10px 5px;
|
margin-bottom: 10px;
|
||||||
background-color: white;
|
border-radius: 5px;
|
||||||
|
background-color: #FFFFFF;
|
||||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
.nav-list li {
|
.nav-list li {
|
||||||
padding: 5px 20px;
|
padding: 5px 20px;
|
||||||
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.more-item {
|
.more-item {
|
||||||
@@ -40,7 +41,7 @@
|
|||||||
|
|
||||||
.friend-item:hover, .group-item:hover {
|
.friend-item:hover, .group-item:hover {
|
||||||
background: #FBC02D;
|
background: #FBC02D;
|
||||||
color: white;
|
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu button {
|
.menu button {
|
||||||
@@ -54,7 +55,7 @@
|
|||||||
|
|
||||||
#notification-center {
|
#notification-center {
|
||||||
left: auto;
|
left: auto;
|
||||||
width: 256px;
|
width: 236px;
|
||||||
right: -256px;
|
right: -256px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,4 +68,9 @@
|
|||||||
color: #4CAF50;
|
color: #4CAF50;
|
||||||
font-size: 42px;
|
font-size: 42px;
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
|
transition-duration: 250ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
#quick-links i:hover {
|
||||||
|
color: #FBC02D;
|
||||||
}
|
}
|
||||||
@@ -33,9 +33,6 @@ div.posts div.post {
|
|||||||
}
|
}
|
||||||
|
|
||||||
div.posts div.post:hover {
|
div.posts div.post:hover {
|
||||||
/*margin: 15px 0 0 -5px;*/
|
|
||||||
/*padding: 15px;*/
|
|
||||||
/*z-index: 20;*/
|
|
||||||
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ function selectAllFriends($userID) {
|
|||||||
`friendship`.`user2ID` = `user`.`userID` OR
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
`friendship`.`user2ID` = :userID AND
|
`friendship`.`user2ID` = :userID AND
|
||||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
`role` != 5 AND
|
`user`.`role` != 'banned' AND
|
||||||
`status` = 1
|
`friendship`.`status` = 'confirmed'
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
@@ -52,8 +52,8 @@ function selectAllFriendRequests() {
|
|||||||
`friendship`.`user2ID` = `user`.`userID` OR
|
`friendship`.`user2ID` = `user`.`userID` OR
|
||||||
`friendship`.`user2ID` = :userID AND
|
`friendship`.`user2ID` = :userID AND
|
||||||
`friendship`.`user1ID` = `user`.`userID`) AND
|
`friendship`.`user1ID` = `user`.`userID`) AND
|
||||||
`role` != 5 AND
|
`user`.`role` != 5 AND
|
||||||
`status` = 0
|
`friendship`.`status` = 'requested'
|
||||||
");
|
");
|
||||||
|
|
||||||
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
$stmt->bindParam(':userID', $_SESSION["userID"], PDO::PARAM_INT);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function selectAllGroupsFromUser($userID) {
|
function selectAllGroupsFromUser($userID) {
|
||||||
return $GLOBALS["db"]->query("
|
$stmt = $GLOBALS["db"]->prepare("
|
||||||
SELECT
|
SELECT
|
||||||
`group_page`.`name`,
|
`group_page`.`name`,
|
||||||
`group_page`.`picture`
|
`group_page`.`picture`
|
||||||
@@ -10,8 +10,13 @@ function selectAllGroupsFromUser($userID) {
|
|||||||
INNER JOIN
|
INNER JOIN
|
||||||
`group_member`
|
`group_member`
|
||||||
WHERE
|
WHERE
|
||||||
`group_member`.`userID` = $userID AND
|
`group_member`.`userID` = :userID AND
|
||||||
`group_member`.`groupID` = `group_page`.`groupID` AND
|
`group_member`.`groupID` = `group_page`.`groupID` AND
|
||||||
`group_page`.`status` != 0
|
`group_page`.`status` != 'hidden'
|
||||||
");
|
");
|
||||||
|
|
||||||
|
$stmt->bindParam(':userID', $userID, PDO::PARAM_INT);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
|
return $stmt;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,46 @@
|
|||||||
<nav class="menu">
|
<nav class="menu">
|
||||||
<section id="friends-menu-section platform">
|
<section id="friends-menu-section">
|
||||||
<h4>
|
<?php
|
||||||
Vrienden
|
|
||||||
</h4>
|
|
||||||
<ul class="nav-list">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Load file.
|
// Load file.
|
||||||
require_once("../queries/friendship.php");
|
require_once("../queries/friendship.php");
|
||||||
require_once("../queries/user.php");
|
require_once("../queries/user.php");
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get confirmed friends of the user and a random non-friend.
|
||||||
$friends = selectAllFriends($_SESSION["userID"]);
|
$friends = selectAllFriends($_SESSION["userID"])->fetchAll();
|
||||||
$i = 0;
|
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
// Print all the users.
|
if (sizeof($friends) == 0) {
|
||||||
while($friend = $friends->fetch(PDO::FETCH_ASSOC)) {
|
echo "
|
||||||
$i ++;
|
<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\">
|
||||||
|
";
|
||||||
|
|
||||||
// Set default values of a friend.
|
foreach ($friends as $i => $friend) {
|
||||||
$username = $friend["username"];
|
$username = $friend["username"];
|
||||||
$extraItem = "";
|
$extraItem = "";
|
||||||
$pf = "img/notbad.jpg";
|
$pf = $friend["profilepicture"];
|
||||||
|
|
||||||
// Change values if needed.
|
if ($i >= 5)
|
||||||
if (!empty($friend["profilepicture"]))
|
|
||||||
$pf = $friend["profilepicture"];
|
|
||||||
|
|
||||||
if ($i > 5)
|
|
||||||
$extraItem = "extra-menu-items";
|
$extraItem = "extra-menu-items";
|
||||||
|
|
||||||
// Echo the friend.
|
|
||||||
echo "
|
echo "
|
||||||
<li class='friend-item $extraItem'>
|
<li class='friend-item $extraItem'>
|
||||||
<form action='profile.php' method='get'>
|
<form action='profile.php' method='get'>
|
||||||
@@ -47,66 +57,45 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
$randomUser = selectRandomNotFriendUser($_SESSION["userID"])["username"];
|
if (sizeof($friends) > 5) {
|
||||||
|
|
||||||
echo "
|
|
||||||
<li class='friend-item'>
|
|
||||||
<form action='/profile' method='get'>
|
|
||||||
<button type='submit'
|
|
||||||
name='username'
|
|
||||||
value='$randomUser'>
|
|
||||||
<div class='friend'>
|
|
||||||
Klik hier voor een nieuw vriendje :)
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
";
|
|
||||||
if ($i > 5) {
|
|
||||||
$i -= 5;
|
|
||||||
echo "
|
echo "
|
||||||
<li class='more-item' id='more-friends-click'>
|
<li class='more-item' id='more-friends-click'>
|
||||||
En nog $i anderen...
|
Meer vrienden..
|
||||||
</li>
|
</li>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
|
||||||
</section>
|
</section>
|
||||||
<section id="groups-menu-section">
|
<section id="groups-menu-section">
|
||||||
<h4>
|
<?php
|
||||||
Groepen
|
|
||||||
</h4>
|
|
||||||
<ul class="nav-list">
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// Load file.
|
// Load file.
|
||||||
include_once("../queries/group_member.php");
|
require_once("../queries/group_member.php");
|
||||||
|
|
||||||
// Get all the friends of a user.
|
// Get all the friends of a user.
|
||||||
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
$groups = selectAllGroupsFromUser($_SESSION["userID"]);
|
||||||
$i = 0;
|
|
||||||
|
|
||||||
// Print all the users.
|
if (sizeof($groups) > 0) {
|
||||||
while($group = $groups->fetch(PDO::FETCH_ASSOC)) {
|
echo "
|
||||||
$i ++;
|
<h4>
|
||||||
|
Groepen
|
||||||
|
</h4>
|
||||||
|
<ul class=\"nav-list\">
|
||||||
|
";
|
||||||
|
|
||||||
|
foreach ($groups as $i => $group) {
|
||||||
// Set default values of a friend.
|
// Set default values of a friend.
|
||||||
$name = $group["name"];
|
$name = $group["name"];
|
||||||
$extraItem = "";
|
$extraItem = "";
|
||||||
$picture = "img/notbad.jpg";
|
$picture = $group["picture"];
|
||||||
|
|
||||||
// Change values if needed.
|
// Change values if needed.
|
||||||
if (!empty($group["picture"]))
|
|
||||||
$picture = $group["picture"];
|
|
||||||
|
|
||||||
if ($i > 3)
|
if ($i > 3)
|
||||||
$extraItem = "extra-menu-items";
|
$extraItem = "extra-menu-items";
|
||||||
|
|
||||||
// Echo the friend.
|
|
||||||
echo "
|
echo "
|
||||||
<li class='group-item'>
|
<li class='group-item $extraItem'>
|
||||||
<form action='group.php' method='get'>
|
<form action='group.php' method='get'>
|
||||||
<button type='submit'
|
<button type='submit'
|
||||||
name='groupname'
|
name='groupname'
|
||||||
@@ -121,27 +110,20 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($i == 0) {
|
if (sizeof($groups) > 3) {
|
||||||
echo "<li class='group-item'>
|
|
||||||
<div class='group'>
|
|
||||||
Je hoort nergens bij.
|
|
||||||
</div>
|
|
||||||
</li>";
|
|
||||||
} else if ($i > 3) {
|
|
||||||
$i -= 3;
|
|
||||||
echo "
|
echo "
|
||||||
<li class='more-item' id='more-groups-click'>
|
<li class='more-item' id='more-groups-click'>
|
||||||
En nog $i andere...
|
Meer groepen..
|
||||||
</li>
|
</li>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
?>
|
}
|
||||||
</ul>
|
?>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="more-item" id="menu-back">
|
<li class="more-item" id="menu-back">
|
||||||
Ga terug
|
Terug naar het overzicht
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user