-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewEvents.php
79 lines (77 loc) · 3.14 KB
/
viewEvents.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
<?php
require_once 'utils/functions.php';
require_once 'classes/User.php';
require_once 'classes/Event.php';
require_once 'classes/EventTableGateway.php';
require_once 'classes/Location.php';
require_once 'classes/LocationTableGateway.php';
require_once 'classes/Connection.php';
$connection = Connection::getInstance();
$gateway = new EventTableGateway($connection);
$statement = $gateway->getEvents();
start_session();
if (!is_logged_in()) {
header("Location: login_form.php");
}
$user = $_SESSION['user'];
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<?php require 'utils/styles.php'; ?>
<?php require 'utils/scripts.php'; ?>
</head>
<body>
<?php require 'utils/header.php'; ?>
<div class = "content">
<div class = "container">
<?php
if (isset($message)) {
echo '<p>'.$message.'</p>';
}
?>
<table class="table table-hover">
<thead>
<tr>
<th>Event ID</th>
<th>Title</th>
<th>Description</th>
<th>Start Date</th>
<th>End Date</th>
<th>Cost</th>
<th>Location</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$row = $statement->fetch(PDO::FETCH_ASSOC);
while ($row) {
echo '<tr>';
echo '<td>' . $row['EventID'] . '</td>';
echo '<td>' . $row['Title'] . '</td>';
echo '<td>' . $row['Description'] . '</td>';
echo '<td>' . $row['StartDate'] . '</td>';
echo '<td>' . $row['EndDate'] . '</td>';
echo '<td>' . $row['Cost'] . '</td>';
echo '<td>'
. '<a href="viewLocation.php?id='.$row['LocationID'].'">'.$row['name'].'</a> '
. '</td>';
echo '<td>'
. '<a href="viewEvent.php?id='.$row['EventID'].'">View</a> '
. '<a class="delete" href="deleteEvent.php?id='.$row['EventID'].'">Delete</a> '
. '</td>';
echo '</tr>';
$row = $statement->fetch(PDO::FETCH_ASSOC);
}
?>
</tbody>
</table>
<a class="btn btn-default" href = "createEventForm.php">Create Event</a><!--register button-->
</div>
</div>
<?php require 'utils/footer.php'; ?>
</body>
</html>