-
Notifications
You must be signed in to change notification settings - Fork 159
/
tv.php
213 lines (204 loc) · 7.52 KB
/
tv.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
require_once('require/class.Connection.php');
require_once('require/class.Spotter.php');
require_once('require/class.Language.php');
$Spotter = new Spotter();
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Spotter TV</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="<?php print $globalURL; ?>/favicon.ico">
<link rel="apple-touch-icon" href="<?php print $globalURL; ?>/images/touch-icon.png">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="<?php print $globalURL; ?>/css/style-tv.css?<?php print time(); ?>" />
</head>
<body>
<?php
if (isset($_GET['q']))
{
$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
$spotter_array = $Spotter->searchSpotterData($q, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "0,10", "", "");
} else {
$spotter_array = $Spotter->getLatestSpotterData("0,10", "");
}
print '<div class="table-responsive">';
print '<table id="table-tv">';
print '<tbody>';
foreach ($spotter_array as $spotter_item)
{
if (isset($globalTimezone)) {
date_default_timezone_set($globalTimezone);
} else {
date_default_timezone_set('UTC');
}
print '<tr>';
if (isset($_GET['image']) && $_GET['image'] == "true")
{
if ($spotter_item['image'] != "")
{
print '<td class="aircraft_image">';
print '<img src="'.$spotter_item['image'].'" alt="'._("Click to see more information about this flight").'" title="'._("Click to see more information about this flight").'" />';
print '</td>';
} else {
print '<td class="aircraft_image">';
print '<img src="'.$globalURL.'/images/placeholder.png" alt="'._("Click to see more information about this flight").'" title="'._("Click to see more information about this flight").'" />';
print '</td>';
}
}
if ($globalIVAO && (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.gif') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif')))
{
print '<td class="logo">';
print '<img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif" />';
print '</td>';
} elseif (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png'))
{
print '<td class="logo">';
print '<img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png" />';
print '</td>';
} else {
print '<td class="logo-no-image">';
if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != "")
{
print $spotter_item['airline_name'];
} else {
print 'N/A';
}
print '</td>';
}
print '<td class="info">';
print '<div class="flight">';
print $spotter_item['departure_airport_city'].' ('.$spotter_item['departure_airport'].') <i class="fa fa-arrow-right"></i> '.$spotter_item['arrival_airport_city'].' ('.$spotter_item['arrival_airport'].')';
print '</div>';
print '<div class="other1">';
if ($spotter_item['registration'] != "")
{
print '<span><i class="fa fa-align-justify"></i> '.$spotter_item['registration'].'</span>';
}
if ($spotter_item['aircraft_name'] != "")
{
print '<span><i class="fa fa-plane"></i> '.$spotter_item['aircraft_name'].'</span>';
} else {
if ($spotter_item['aircraft_type'] != "")
{
print '<span><i class="fa fa-plane"></i> '.$spotter_item['aircraft_type'].'</span>';
}
}
print '<span><i class="fa fa-calendar"></i> '.date("r", strtotime($spotter_item['date_iso_8601'])).'</span>';
print '</div>';
print '<div class="other2">';
print '<span><i class="fa fa-arrow-up"></i> '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'];
if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') {
print ' ('.$spotter_item['departure_airport_time'].')';
}
print '</span>';
print '<span><i class="fa fa-arrow-down"></i> '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'];
if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != '') {
print ' ('.$spotter_item['arrival_airport_time'].')';
}
print '</span>';
print '</div>';
print '<div class="other3">';
if ($spotter_item['ident'] != "")
{
print '<span><i class="fa fa-th-list"></i> '.$spotter_item['ident'].'</span>';
}
if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != "")
{
print '<span><i class="fa fa-align-justify"></i> '.$spotter_item['airline_name'].'</span>';
}
if ($spotter_item['airline_country'] != "")
{
print '<span><i class="fa fa-globe"></i> '.$spotter_item['airline_country'].'</span>';
}
print '</div>';
print '</td>';
print '</tr>';
}
print '<tbody>';
print '</table>';
print '</div>';
?>
<script>
$( document ).ready(function() {
//loads the notification system every 16 seconds
setInterval( getNewDataTV, 16000 );
//changes the information every 10 seconds
setInterval( changeInformation, 10000 );
});
function getNewDataTV()
{
<?php
if (isset($_GET['image']) && isset($_GET['q'])) {
$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
?>
$.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>&q=<?php print $q; ?>", function( data ) {
<?php
} elseif (isset($_GET['image'])) {
$image = filter_input(INPUT_GET,'image',FILTER_SANITIZE_STRING);
?>
$.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&image=<?php print $image; ?>", function( data ) {
<?php
} elseif (isset($_GET['q'])) {
$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
?>
$.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"&q=<?php print $q; ?>", function( data ) {
<?php
} else {
?>
$.getJSON( "<?php print $globalURL; ?>/getLatestData-tv.php?other_i="+other_i+"", function( data ) {
<?php
}
?>
$.each(data.flights, function(i, item) {
if (item.html != "")
{
$('#table-tv').prepend(item.html);
$('#table-tr-'+item.flight_id).fadeIn();
$('#table-tv tr:last').remove();
}
});
});
}
var other_i = 1;
$('.other2').hide();
$('.other3').hide();
function changeInformation()
{
if (other_i == 1)
{
$('.other3').hide();
$('.other1').fadeOut( "slow", function() {
$('.other2').fadeIn();
});
other_i = 2;
} else if (other_i == 2)
{
$('.other1').hide();
$('.other2').fadeOut( "slow", function() {
$('.other3').fadeIn();
});
other_i = 3;
} else if (other_i == 3)
{
$('.other2').hide();
$('.other3').fadeOut( "slow", function() {
$('.other1').fadeIn();
});
other_i = 1;
}
}
</script>
</body>
</html>