setBlock.php
4.37 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
<?php
session_start();
require_once 'classes/realops.php';
$get = new Get();
$stats = new Stats();
date_default_timezone_set('Australia/Sydney');
/*
if(!$get->isATC($_SESSION['vatsimID']))
{
echo "Unauthorised";
die();
} */
?>
<!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">Set Block Time</h2>
<form method="get" action="setBlock.php" class="form-horizontal" >
<p class="help-block">If the callsign does not appear here, it has not been booked</p>
<div class="form-group">
<label class="col-sm-3 control-label">Select Flight:</label>
<div class="col-sm-6">
<select name="flight" class="form-control">
<option selected disabled>Select one...</option>
<?php foreach($get->bookings() as $row)
{?>
<option <?php if($_GET['flight'] == $row['id']) echo "selected"; ?> value="<?php echo $row['id']; ?>"><?php echo $row['airline'] . $row['flightnum']; ?> (<?php echo $row['pilotName'] ?>)</option>
<?php } ?>
</select>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Request</button>
</div>
</form>
<?php if(isset($_GET['flight']))
{
$bookings = $get->bookingFromFlightID($_GET['flight']);
$flight = $get->flight($_GET['flight']);
?>
<div class="well">
<h3><?php echo $flight['airline'] . $flight['flightnum']; ?></h3>
<h4>Scheduled <?php if($flight['deparr'] == 0) echo "Off"; else echo "On"; ?> Blocks: <?php echo date('Hi', strtotime($flight['time']) - 36000); ?>z</h4>
<form method="post" action="setBlock.php" class="form-horizontal" >
<div class="form-group">
<label class="col-sm-3 control-label">Block Out:</label>
<div class="col-sm-6">
<input type="text" <?php if($flight['deparr'] == 1) echo "readonly"; ?> class="form-control" name="blockOut" value="<?php echo $bookings['blockOut']; ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Block Off:</label>
<div class="col-sm-6">
<input type="text" <?php if($flight['deparr'] == 1) echo "readonly"; ?> class="form-control" name="blockOff" value="<?php echo $bookings['blockOff']; ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Block On:</label>
<div class="col-sm-6">
<input type="text" <?php if($flight['deparr'] == 0) echo "readonly"; ?> class="form-control" name="blockOn" value="<?php echo $bookings['blockOn']; ?>" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Block In:</label>
<div class="col-sm-6">
<input type="text" <?php if($flight['deparr'] == 0) echo "readonly"; ?> class="form-control" name="blockIn" value="<?php echo $bookings['blockIn']; ?>" />
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">Update/Save</button>
</div>
</form>
</div>
<?php } ?>
</article>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.wrapper -->
<?php include 'sections/footer.php'; ?>