slots.php
7.88 KB
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
<?php
session_start();
require_once 'classes/realops.php';
$get = new Get();
date_default_timezone_set('Australia/Sydney');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Flights</title>
<?php include 'sections/header.php'; ?>
</head>
<body>
<?php include 'sections/navbar.php'; ?>
<div class="container-fluid">
<div class="row">
<?php include 'sections/sidebar.php'; ?>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h2 class="sub-header">Available Flights</h2>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li<?php if(($_GET['deparr'] == "0" && $_GET['domint'] == "0") || (empty($_GET['deparr']) && empty($_GET['domint']))) echo " class=\"active\""; ?>><a href="slots.php?deparr=0&domint=0">Domestic Departures <span class="sr-only">(current)</span></a></li>
<li<?php if($_GET['deparr'] == "1" && $_GET['domint'] == "0") echo " class=\"active\""; ?>><a href="slots.php?deparr=1&domint=0">Domestic Arrivals</a></li>
<li<?php if($_GET['deparr'] == "0" && $_GET['domint'] == "1") echo " class=\"active\""; ?>><a href="slots.php?deparr=0&domint=1">International Departures</a></li>
<li<?php if($_GET['deparr'] == "1" && $_GET['domint'] == "1") echo " class=\"active\""; ?>><a href="slots.php?deparr=1&domint=1">International Arrivals</a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<form method="get" action="">
<input type="hidden" name="deparr" value="<?php echo $_GET['deparr'] ?>">
<input type="hidden" name="domint" value="<?php echo $_GET['domint'] ?>">
<div class="col-lg-3">
<select style="width:100%;" name="airport">
<option disabled selected>Arrival Airport</option>
<?php
foreach($get->scheduleAirports() as $row){
$row = explode(".", $row)
?>
<option value="<?php echo $row[0] ?>" <?php if($_GET['airport'] == $row[0]) echo "selected"; ?>><?php echo $row[1]; ?></option>
<?php } ?>
</select>
</div>
<div class="col-lg-3">
<select style="width:100%;" name="timeFrame">
<option disabled selected>Time Frame</option>
<option value="1400">14:00-15:00</option>
<option value="1500">15:00-16:00</option>
<option value="1600">16:00-17:00</option>
<option value="1700">17:00-18:00</option>
<option value="1800">18:00-19:00</option>
<option value="1900">19:00-20:00</option>
<option value="2000">20:00-21:00</option>
<option value="2100">21:00-CURFEW</option>
</select>
</div>
<div class="col-lg-3">
<select style="width:100%;" name="airline">
<option selected disabled>Airline</option>
<?php foreach($get->scheduleAirline() as $row)
{ ?>
<option value="<?php echo $row ?>" <?php if($_GET['airline'] == $row) echo "selected"; ?>><?php echo $row ?></option>
<?php } ?>
</select>
<a href="slots.php?deparr=<?php echo $_GET['deparr'] ?>&domint=<?php echo $_GET['domint'] ?>" class="btn btn-default" style="width:100%; margin-top:10px;">Clear Filter</a>
</div>
<div class="col-lg-3">
<select style="width:100%;" name="aircraft">
<option disabled selected>Aircraft</option>
<?php foreach($get->scheduleAircraft() as $row)
{
$row = explode(".", $row); ?>
<option value="<?php echo $row[0] ?>" <?php if($_GET['aircraft'] == $row[0]) echo "selected"; ?>><?php echo $row[1] ?></option>
<?php } ?>
</select><br />
<button type="submit" class="btn btn-primary" style="width:100%; margin-top:10px;">Sort</button>
</div>
</form>
<div class="table-responsive col-lg-12">
<table class="table table-striped">
<thead>
<tr>
<th>Flight Number</th>
<th>Departure</th>
<th>Arrival</th>
<th>Aircraft</th>
<th>Slot Time</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
$schedules = $get->schedules($_GET);
if(!empty($schedules)) {
foreach($schedules as $row)
{
?>
<tr>
<td style=""><img src="logos/<?php echo $row['airline']; ?>.png" /><br /><strong><?php echo $row['airline'] . $row['flightnum']; ?></strong>/<?php echo $row['fbnum'] ?></td>
<td><?php if($row['deparr'] == "0") echo "Sydney (YSSY)"; else echo $get->airport($row['icao'])['name'] . " (" . $row['icao'] . ")"; ?></td>
<td><?php if($row['deparr'] == "1") echo "Sydney (YSSY)"; else echo $get->airport($row['icao'])['name'] . " (" . $row['icao'] . ")"; ?></td>
<td><?php echo $get->aircraft($row['aircraft'])['name'] ?></td>
<td><?php echo date('H:i', strtotime($row['time'])); ?> LOC<br /><?php echo date('H:i', strtotime($row['time'])- 60 * 60 * Z); ?> UTC</td>
<td>
<?php if($_SESSION['authenticated'] != 1)
{ ?>
<a href="#fancyForm" class="btn btn-success loginButton" id="<?php echo $row['id']; ?>">Book Flight</a>
<?php }
else
{
?>
<button class="btn btn-success bookButton" id="flight<?php echo $row['id']; ?>">Book Flight</button> </td>
<?php } ?>
</tr>
<?php } }
else {
echo "<br /><div class=\"alert alert-danger\" role=\"alert\"><strong>No Flights Found.</strong> Please adjust your search and try again.</div>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php include 'sections/loginBox.php'; ?>
</div>
<?php include 'sections/footer.php'; ?>
</body>
</html>