Filter on search page
It also works with jquery now
This commit is contained in:
28
website/public/API/searchGroups.php
Normal file
28
website/public/API/searchGroups.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
session_start();
|
||||
|
||||
require_once ("../../queries/connect.php");
|
||||
require_once ("../../queries/checkInput.php");
|
||||
require_once ("../../queries/group_member.php");
|
||||
require_once ("../../queries/group_page.php");
|
||||
|
||||
$n = 0;
|
||||
if (isset($_POST["n"])) {
|
||||
$n = (int) test_input($_POST["n"]);
|
||||
}
|
||||
$m = 20;
|
||||
if (isset($_POST["m"])) {
|
||||
$m = (int) test_input($_POST["m"]);
|
||||
}
|
||||
$search = "";
|
||||
if (isset($_POST["search"])) {
|
||||
$search = test_input($_POST["search"]);
|
||||
}
|
||||
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||
echo searchSomeOwnGroups($n, $m, $search);
|
||||
} else {
|
||||
echo searchSomeGroups($n, $m, $search);
|
||||
}
|
||||
27
website/public/API/searchUsers.php
Normal file
27
website/public/API/searchUsers.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
require_once ("../../queries/connect.php");
|
||||
require_once ("../../queries/checkInput.php");
|
||||
require_once ("../../queries/friendship.php");
|
||||
require_once ("../../queries/user.php");
|
||||
|
||||
$n = 0;
|
||||
if (isset($_POST["n"])) {
|
||||
$n = (int) test_input($_POST["n"]);
|
||||
}
|
||||
$m = 20;
|
||||
if (isset($_POST["m"])) {
|
||||
$m = (int) test_input($_POST["m"]);
|
||||
}
|
||||
$search = "";
|
||||
if (isset($_POST["search"])) {
|
||||
$search = test_input($_POST["search"]);
|
||||
}
|
||||
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == "personal") {
|
||||
echo searchSomeFriends($n, $m, $search);
|
||||
} else {
|
||||
echo searchSomeUsers($n, $m, $search);
|
||||
}
|
||||
@@ -4,12 +4,6 @@ session_start();
|
||||
|
||||
include_once ("../../queries/friendship.php");
|
||||
|
||||
if (isset($_POST["limit"])) {
|
||||
$limit = $_POST["limit"];
|
||||
} else {
|
||||
$limit = 5;
|
||||
}
|
||||
|
||||
if (isset($_POST["action"])) {
|
||||
$action = $_POST["action"];
|
||||
} else {
|
||||
@@ -26,11 +20,6 @@ $friends = json_decode($_POST["friends"]);
|
||||
|
||||
foreach($friends as $i => $friend) {
|
||||
$friendshipStatus = getFriendshipStatus($friend->userID);
|
||||
|
||||
if ($limit != 0 && $i >= $limit)
|
||||
$extra = "extra-friend-item";
|
||||
else
|
||||
$extra = "";
|
||||
?>
|
||||
<li class='friend-item <?= $extra ?>'>
|
||||
<form action='<?= $action ?>' method='<?= $actionType ?>'>
|
||||
@@ -60,15 +49,13 @@ foreach($friends as $i => $friend) {
|
||||
</form>
|
||||
<?php
|
||||
if ($friendshipStatus > 1) {
|
||||
if ($friendshipStatus == 2) {
|
||||
$denyName = "Annuleer";
|
||||
} else {
|
||||
$denyName = "Weiger";
|
||||
}
|
||||
?>
|
||||
<div class='notification-options'>
|
||||
<input type='hidden' name='userID' value='' />
|
||||
<button name='delete'
|
||||
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
|
||||
class='deny-notification'
|
||||
value='1'>
|
||||
<i class='fa fa-times'></i>
|
||||
</button>
|
||||
<div class='notification-options'>
|
||||
<?php
|
||||
if ($friendshipStatus == 3) {
|
||||
?>
|
||||
@@ -76,11 +63,19 @@ foreach($friends as $i => $friend) {
|
||||
onclick="editFriendship('<?= $friend->userID ?>', 'accept')"
|
||||
class='accept-notification'
|
||||
value='1'>
|
||||
<i class='fa fa-check'></i>
|
||||
<i class='fa fa-check'></i>Accepteer
|
||||
</button>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<input type='hidden' name='userID' value='' />
|
||||
<button name='delete'
|
||||
onclick="editFriendship('<?= $friend->userID ?>', 'delete')"
|
||||
class='deny-notification'
|
||||
value='1'>
|
||||
<i class='fa fa-times'></i> <?= $denyName ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -89,13 +84,6 @@ foreach($friends as $i => $friend) {
|
||||
<?php
|
||||
}
|
||||
|
||||
if (sizeof($friends) > $limit) {
|
||||
?>
|
||||
<li class='more-item'>
|
||||
Meer vrienden...
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -22,17 +22,3 @@ foreach($groups as $i => $group) {
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<form action="search.php" method="get">
|
||||
<input type="hidden"
|
||||
name="search"
|
||||
value="" />
|
||||
<input type="hidden"
|
||||
name="filter"
|
||||
value="groups" />
|
||||
<button type="submit">
|
||||
Alle groepen...
|
||||
</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
@@ -252,16 +252,20 @@ div[data-title]:hover:after {
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.friend {
|
||||
|
||||
}
|
||||
|
||||
|
||||
.friend-item, .group-item {
|
||||
cursor: pointer;
|
||||
transition-duration: 250ms;
|
||||
}
|
||||
|
||||
.friend-item button, .group-item button {
|
||||
background: none;
|
||||
color: inherit;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.friend-item:hover, .group-item:hover {
|
||||
background: #FBC02D;
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
||||
|
||||
@@ -34,15 +34,6 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.menu button {
|
||||
background: none;
|
||||
color: inherit;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#notification-center {
|
||||
left: auto;
|
||||
width: 236px;
|
||||
@@ -67,7 +58,6 @@
|
||||
|
||||
.notification-options {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -87,4 +77,13 @@
|
||||
|
||||
.friend-item:hover .notification-options {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.menu button {
|
||||
background: none;
|
||||
color: inherit;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
text-align: left;
|
||||
}
|
||||
Reference in New Issue
Block a user