-
Notifications
You must be signed in to change notification settings - Fork 158
/
aircraft.php
60 lines (57 loc) · 2.09 KB
/
aircraft.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
<?php
require_once('require/class.Connection.php');
require_once('require/class.Spotter.php');
require_once('require/class.Language.php');
require_once('require/class.Stats.php');
if (isset($_POST['aircraft_type']))
{
header('Location: '.$globalURL.'/aircraft/'.$_POST['aircraft_type']);
} else {
$Spotter = new Spotter();
$Stats = new Stats();
$title = _("Aircraft Types");
require_once('header.php');
print '<div class="column">';
print '<h1>'._("Aircraft Types").'</h1>';
$aircraft_types = $Stats->getAllAircraftTypes();
if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
$previous = null;
print '<div class="alphabet-legend">';
foreach($aircraft_types as $value) {
//$firstLetter = substr($value['aircraft_name'], 0, 1);
$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
{
if ($previous !== null) print ' | ';
print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
}
if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
}
print '</div>';
$previous = null;
foreach($aircraft_types as $value) {
//$firstLetter = substr($value['aircraft_name'], 0, 1);
$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
if ($firstLetter != "")
{
if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
{
if ($previous !== null) print '</div>';
print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
}
if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
print '<div class="alphabet-item">';
print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">';
if ($value['aircraft_name'] == '') {
print strtoupper($value['aircraft_manufacturer']).' '.$value['aircraft_icao'];
} else {
print strtoupper($value['aircraft_manufacturer']).' '.$value['aircraft_name'];
}
print '</a>';
print '</div>';
}
}
print '</div>';
require_once('footer.php');
}
?>