-
Notifications
You must be signed in to change notification settings - Fork 0
/
backend_admin_clubedits.php
76 lines (71 loc) · 2.8 KB
/
backend_admin_clubedits.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
<?php
session_start();
require 'scripts/SQLUtils.php';
require 'scripts/index_utils.php';
require 'scripts/category_utils.php';
$conn = getSQLConnectionFromConfig();
$backendAdmins = array();
$result = $conn->query("SELECT username FROM taftclubs.clubadmins");
if($result->num_rows > 0) {
while($data = $result->fetch_assoc()) {
$backendAdmins[] = $data['username'];
}
}
/*General Unlogged in Person*/
if(!isset($_SESSION['user'])) {
exit();
}
/*authenticated person*/
$username = $_SESSION['user'];
if(array_search($username, $backendAdmins) === FALSE) {
exit();
}
?>
<table id="editClubsTable" border="2">
<thead>
<tr>
<th>Club Name</th>
<th>Editor</th>
<th>Type of Edit</th>
<th>Old Field</th>
<th>New Field</th>
<th>Approve?</th>
<th>Contact Editor</th>
</tr>
<thead>
<tbody>
<?php
$query = "SELECT club.id as cId, club.name as name, CONCAT(editor.preferred_name, ' ', editor.last_name) as editor, lookupTable.data as typeOfEdit, edit.oldField as oldField, edit.newField as newField, edit.id
FROM taftclubs.clubedits as edit
INNER JOIN taftclubs.club as club
ON edit.clubId = club.id
INNER JOIN sgstudents.seniors_data as editor
ON edit.personId = editor.id
INNER JOIN taftclubs.clubedits_lookup as lookupTable
ON edit.typeOfEdit = lookupTable.id
WHERE edit.approved = 0
ORDER BY edit.id";
$result = $conn->query($query);
if($result->num_rows > 0) {
while($data = $result->fetch_assoc()) {
if($data['typeOfEdit'] == "Modified Club Category") {
$data['oldField'] = idToCategory($data['oldField'], $conn);
$data['newField'] = idToCategory($data['newField'], $conn);
}
?>
<tr>
<td><a href="club.php?clubId=<?php echo $data['cId']; ?>"><?php echo $data['name']; ?></a></td>
<td><?php echo $data['editor']; ?></td>
<td><?php echo $data['typeOfEdit']; ?></td>
<td><?php echo $data['oldField']; ?></td>
<td><?php echo $data['newField']; ?></td>
<td data-index="<?php echo $data['id']; ?>"><a>✔</a> <a>✘</a></td>
<td><a>📧</a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php $conn->close(); ?>