slots.php
8.07 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
<?php
session_start();
require_once 'classes/realops.php';
$get = new Get();
date_default_timezone_set('Australia/Sydney');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'sections/header.php'; ?>
</head>
<body>
<div class="wrapper">
<?php include 'sections/navbar.php' ?>
<div class="container" id="realops-container">
<div class="row">
<article class="col-sm-12 panel panel-default" id="realops-body">
<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><?php if($_GET['deparr'] == 1) echo "Departure"; else echo "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="14" <?php if($_GET['timeFrame'] == 14) echo "selected"?>>14:00-15:00</option>
<option value="15" <?php if($_GET['timeFrame'] == 15) echo "selected"?>>15:00-16:00</option>
<option value="16" <?php if($_GET['timeFrame'] == 16) echo "selected"?>>16:00-17:00</option>
<option value="17" <?php if($_GET['timeFrame'] == 17) echo "selected"?>>17:00-18:00</option>
<option value="18" <?php if($_GET['timeFrame'] == 18) echo "selected"?>>18:00-19:00</option>
<option value="19" <?php if($_GET['timeFrame'] == 19) echo "selected"?>>19:00-20:00</option>
<option value="20" <?php if($_GET['timeFrame'] == 20) echo "selected"?>>20:00-21:00</option>
<option value="21" <?php if($_GET['timeFrame'] == 21) echo "selected"?>>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>
</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 />
</div>
<div class="col-lg-9">
<button type="submit" class="btn btn-primary" style="width:100%; margin-top:10px;">Sort</button>
</div>
<div class="col-lg-3">
<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>
</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 * 10); ?> UTC</td>
<td>
<?php if(empty($_SESSION['firstName']))
{ ?>
<a href="sso/index.php?redirect=<?php echo $_SERVER['PHP_SELF'] ;?>" class="btn btn-info loginButton" id="<?php echo $row['id']; ?>" data-toggle="modal" data-target="#realops-login-info">Login to Book</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>
</article>
</div>
</div>
</div>
<?php include 'sections/footer.php'; ?>