-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetEventsTable.php
74 lines (58 loc) · 1.65 KB
/
getEventsTable.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
<?php
require_once("api.php");
$api = new AprilInstituteScheduler_API();
$api -> connect();
$sql = "SELECT events.*
FROM events, xref_users_events
WHERE events.id = xref_users_events.event_id
AND xref_users_events.user_id = ?
AND events.date >= CURDATE()";
$statement = $api -> conn -> prepare($sql);
if(!$statement) {
throw new Exception($statement -> error);
}
$statement -> bind_param("i", $_SESSION['uid']);
$statement -> execute();
$result = $statement -> get_result();
echo "<table class=\"highlight responsive-table\">
<thead>
<tr>
<th>Name</th>
<th>Date & Time</th>
<th>Type</th>
<th>Scheduled with</th>
<th>Location</th>
<th>Description</th>";
echo "</tr>
</thead>";
echo "<tbody>";
while($row = $result -> fetch_assoc()) {
$type = $api -> getTypeFromTypeID($row['type_id']);
echo "<tr>";
if($row['type_id'] == 1) {
echo "<td>Appointment</td>";
}
else echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['date'] . "</td>";
echo "<td>" . $type['type'] . "</td>";
if($type['type'] === "Appointment") {
$scheduled_with = $api -> getScheduledWith($row['id']);
echo "<td>" . $scheduled_with['last_name'] . ', ' . $scheduled_with['first_name'] . "</td>";
}
else {
echo "<td>N/A</td>";
}
if($row['is_virtual'] > 0) {
echo "<td><a href=" . $row['address'] . ">Zoom</a></td>";
}
else {
echo "<td>" . $row['address'] . "</td>";
}
echo "<td>" . $row['description'] . "</td>";
}
echo "</tbody>";
echo "</table>";
$api -> disconnect();
// exit();
return;
?>