-
Notifications
You must be signed in to change notification settings - Fork 4
/
modifyGroups.php
243 lines (158 loc) · 6.77 KB
/
modifyGroups.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
// if(isset($_POST['groupNameAdmin']))
// {
// $groupId = $_POST['groupNameAdmin'];
// }
?>
<!DOCTYPE html>
<html>
<head>
<title>Group Invitation</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta charset='utf-8'>
<link rel='stylesheet' type='text/css' href='profilepage.css'>
<link rel='stylesheet' type='text/css' href='avatar.css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="profilepage.js"></script>
<script src="script.js"></script>
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'>
<style type="text/css">
#myInputTwo {
background-position: 10px 12px;
background-repeat: no-repeat;
width: 100%;
font-size: 16px;
padding: 12px 20px 12px 40px;
border: 1px solid #ddd;
margin-bottom: 12px;
}
#myUL {
list-style-type: none;
padding: 0;
margin: 0;
}
#myUL li a {
border: 1px solid #ddd;
margin-top: -1px; /* Prevent double borders */
background-color: #f6f6f6;
padding: 12px;
text-decoration: none;
font-size: 18px;
color: black;
display: block
}
#myUL li a:hover:not(.header) {
background-color: #eee;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<a href='mainpage.php'><i class='fa fa-arrow-left arrowLeft' aria-hidden='true' style = 'margin-top: 3%;'></i></a>
<div class = 'formDiv'>
<?php
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
include_once "./server/loginService.php";
include_once "./server/loginSQL.php";
$groupId = "";
if(isset($_POST['groupNameAdmin']))
{
$groupId = $_POST['groupNameAdmin'];
}
echo "<div style = 'float: left;' class =''>";
echo "<h2 style='margin-top: -3%;'> Add Users</h2>";
echo "<form id = 'adminAddUserForm'>";
echo "<input id = 'groupIdAdminAdd' type = 'hidden' value = '" . $groupId . "'>";
echo "<input type='text' id='addUserAdmin' onkeyup='myFunctionTwo()' placeholder='Search for public group names..' title='Type in a name'><button class = 'addUserAdminButton' >Add User to group</button><br/>";
echo "<h4> Invite non-member Users to group. </h4>";
$loginWebService = new loginWebService();
$listOfUsers = $loginWebService -> getAllUsers();
if(!empty($listOfUsers))
{
echo "<ul id='myUL'>";
foreach($listOfUsers as $i => $item) {
$userIsInGroup = $loginWebService->checkIfUserIsInGroup($listOfUsers[$i]['userIdAvail'], $groupId);
if($userIsInGroup == false && $listOfUsers[$i]['UserTypeAvail'] != 1)
{
echo "<li><a id = 'adminAddUserDisplay' href='#'>" . $listOfUsers[$i]['EmailAvail'] . "</a></li>";
echo "<input id = 'userIdToAdd' type = 'hidden' value = '" . $listOfUsers[$i]['userIdAvail'] . "'>";
}
}
echo "</ul>";
}
echo "</form>";
echo "</div>";
echo "<div style = 'float: right;' class =''>";
echo "<h2 style='margin-top: -3%;'> Remove Users</h2>";
echo "<form id = 'adminRemoveMemberForum'>";
echo "<input id = 'groupIdAdminRemove' type = 'hidden' value = '" . $groupId . "'>";
echo "<input type='text' id='removeUserAdmin' onkeyup='myFunctionThree()' placeholder='Search for users' title='Type in a name'><button class = 'removeUserAdminButton' >Remove User from group</button><br/>";
echo "<h4> Remove group member from group</h4>";
$loginWebService = new loginWebService();
$listOfUsers = $loginWebService -> getAllUsers();
if(!empty($listOfUsers))
{
echo "<ul id='myULTwo'>";
foreach($listOfUsers as $i => $item) {
$userIsInGroup = $loginWebService->checkIfUserIsInGroup($listOfUsers[$i]['userIdAvail'], $groupId);
if($userIsInGroup == true && $listOfUsers[$i]['UserTypeAvail'] != 1)
{
echo "<li><a id = 'adminRemoveUserDisplay' href='#'>" . $listOfUsers[$i]['EmailAvail'] . "</a></li>";
echo "<input id = 'userIdToRemove' type = 'hidden' value = '" . $listOfUsers[$i]['userIdAvail'] . "'>";
}
}
echo "</ul>";
}
echo "</form>";
echo "</div>";
// echo "<div style = 'float: right;' class =''>";
// echo "<h2 style='margin-top: -3%;'> Remove Users from group </h2>";
// echo "<form id = 'removeGroupMember'>";
// echo "<input type='text' id='' onkeyup='myFunctionTwo()' placeholder='Search for Users' title='Type in a name'><button class = 'removeGroupMemberButton' >Remove user from group</button><br/>";
// echo "<h4> remove users from group. </h4>";
// echo "</div>";
?>
</div>
<div class='container' style = 'height:100%; width:95%;'>
<div class = 'leftside' style='float:left;width: 70%;'>
<div class='clearfix'>
</div>
</div>
</div>
<script type="text/javascript">
function myFunctionTwo() {
var input, filter, ul, li, a, i;
input = document.getElementById("addUserAdmin");
filter = input.value.toUpperCase();
ul = document.getElementById("myUL");
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0];
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
function myFunctionThree() {
var input, filter, ul, li, a, i;
input = document.getElementById("removeUserAdmin");
filter = input.value.toUpperCase();
ul = document.getElementById("myULTwo");
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("a")[0];
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
</script>
</body>
</html>