-
Notifications
You must be signed in to change notification settings - Fork 0
/
club_events.php
54 lines (50 loc) · 1.65 KB
/
club_events.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
<?php
if(!isset($_GET['clubId'])) {
exit();
}
require 'scripts/SQLUtils.php';
require 'scripts/club_utils.php';
$clubId = sanatizeInput($_GET['clubId']);
$conn = getSQLConnectionFromConfig();
$events = getClubEvents($clubId, $conn);
?>
<h2>Events: </h2>
<table border="5" id="events">
<thead>
<tr>
<th><strong>What</strong></th>
<th><strong>Where</strong></th>
<th><strong>When</strong></th>
<th><strong>Time</strong></th>
<th><strong>RSVP %</strong></th>
<th><strong>RSVP</strong></th>
</tr>
</thead>
<?php
foreach($events as $event) {
if($event['description'] == '') {break;}
$splits = explode(" ", $event['date']);
$eventName = $event['description'];
$eventTime = $splits[1];
$eventDate = $splits[0];
$eventLoc = $event['location'];
$rsvpCount = $event['rsvpCount'];
$memberCount = $event['memberCount'];
$eventId = $event['id'];
$percentRSVP = bcdiv(intval($rsvpCount), intval($memberCount), 3) * 100;
?>
<tr data-index="<?php echo $eventId; ?>">
<td><?php echo $eventName; ?></td>
<td><?php echo $eventLoc; ?></td>
<td><?php echo $eventDate; ?></td>
<td><?php echo $eventTime; ?></td>
<td><?php echo $percentRSVP; ?></td>
<td><input data-index="<?php echo $eventId; ?>" type="button" class="rsvpBut" value="RSVP"></td>
</tr>
<?php
}
?>
</table>
<?php
$conn->close();
?>