-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglider_status_log.php
100 lines (84 loc) · 3.44 KB
/
glider_status_log.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<? /* Copyright (C) 1995-2020 John Murtari
This file is part of FLY flight management software
FLY is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FLY is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FLY. If not, see <https://www.gnu.org/licenses/>. */ ?>
<?
require("./php_includes.inc");
require("./lib/header.inc");
$tailNum = script_param('tailNum');
$GliderID = script_param('GliderID');
$msg='';
if (!$super) {
$msg="<b><font color='red'>NOTE: You don't have access to edit aircraft status info, only history info is available.</font></b>";
}
// Show status info on Gliders limited to members
?>
<div id="divContent">
<h3><span style="font-size: 24px;">Aircraft Status Log for Tail # <?=$tailNum?></span></h3>
<p><?=$msg?></p><p>Complete log history follows.
<a href="edit_glider_status.php?GliderID=<?=$GliderID?>&tailNum=<?=$tailNum?>">Return to edit this glider</a>
<a href="glider_status.php">Return to the aircraft status page</a>
</p>
<table cellspacing="0" cellpadding="3" border="0">
<tbody>
<tr>
<th>Model</th>
<th>Tail #</th>
<th>Registration<br />Expires</th>
<th>Annual<br />Expires</th>
<th>Notes</th>
<th>Status As Of</th>
<th>By</th>
</tr>
<?
$sql = "SELECT * FROM Glider g, GliderStatusLog l, Members m WHERE g.GliderID = l.GliderID AND l.updatedBy = m.MemberID AND l.tailNum='$tailNum' ORDER BY l.updated DESC";
if ($msg = DB_Query($Conn, $sql, $results)) {
DisplayMessage("Display aircraft status", "query failed ($msg)");
}
$lastModel = '';
$colArray = array('model', 'tailNum', 'regExpire', 'annualExpire', 'mxNotes', 'updated');
foreach ($results as $row) {
$model = $row['model'];
if ($model != $lastModel) {
$lastModel = $model;
}
$status = $row['status'];
$bgStyle = ''; // nothing by default
if ($status == 'RED') {
$bgStyle = 'style="background-color: #ff3300"';
} else if ($status == 'ORANGE') {
$bgStyle = 'style="background-color: #ff9900"';
}
echo "<tr $bgStyle>\n";
foreach ($colArray as $col) {
$value = $row[$col];
if ($col == 'model') {
$value = "<b>$value</b>";
} else if ($col == 'tailNum') {
$value = "<a href=edit_glider_status.php?tailNum=$value&GliderID=$row[GliderID]>$value</a>";
}
echo "<td>$value</td>\n";
}
// add the updateBy name
echo "<td>" . $row['lastName'] . "<br /> " . $row['firstName'] . "</td>\n";
echo "</tr>\n";
echo "<tr><td colspan=7><hr /></td></tr>\n";
} // end for all aircraft
?>
</tbody>
</table>
</table>
</div>
<!-- ------------------ Content ends here ---------------------------------- -->
<?php
require 'footer.inc';
?>