@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | |
14 | 18 | require_once('header.php'); |
15 | 19 | include('statistics-sub-menu.php'); |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft Manufacturer"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | |
14 | 18 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Busiest Time of the Day"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | |
14 | 18 | require_once('header.php'); |
15 | 19 | include('statistics-sub-menu.php'); |
@@ -4,7 +4,13 @@ discard block |
||
4 | 4 | <div class="stats_airline"> |
5 | 5 | |
6 | 6 | <form id="changedate" method="post"> |
7 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
7 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
8 | + echo $year.'-'; |
|
9 | +} |
|
10 | +?><?php if (isset($month) && $month != '') { |
|
11 | + echo $month; |
|
12 | +} |
|
13 | +?>" /> |
|
8 | 14 | </form> |
9 | 15 | |
10 | 16 | <form id="changeairline" method="post"> |
@@ -13,7 +19,9 @@ discard block |
||
13 | 19 | <?php |
14 | 20 | require_once('require/class.Stats.php'); |
15 | 21 | $Stats = new Stats(); |
16 | - if (!isset($filter_name)) $filter_name = ''; |
|
22 | + if (!isset($filter_name)) { |
|
23 | + $filter_name = ''; |
|
24 | + } |
|
17 | 25 | $airlines = $Stats->getAllAirlineNames($filter_name); |
18 | 26 | if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) { |
19 | 27 | print '<option value="all" selected>All</option>'; |
@@ -41,10 +49,22 @@ discard block |
||
41 | 49 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
42 | 50 | </a> |
43 | 51 | <ul class="dropdown-menu"> |
44 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
45 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li> |
|
46 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
47 | - <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li> |
|
52 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
53 | + echo '/'.$airline_icao; |
|
54 | +} |
|
55 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
56 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
57 | + echo '/'.$airline_icao; |
|
58 | +} |
|
59 | +?>"><?php echo _("Registration"); ?></a></li> |
|
60 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
61 | + echo '/'.$airline_icao; |
|
62 | +} |
|
63 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
64 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
65 | + echo '/'.$airline_icao; |
|
66 | +} |
|
67 | +?>"><?php echo _("Country"); ?></a></li> |
|
48 | 68 | </ul> |
49 | 69 | </li> |
50 | 70 | <li class="dropdown"> |
@@ -52,9 +72,18 @@ discard block |
||
52 | 72 | <?php echo _("Airline"); ?> <span class="caret"></span> |
53 | 73 | </a> |
54 | 74 | <ul class="dropdown-menu" role="menu"> |
55 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li> |
|
56 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
57 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li> |
|
75 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
76 | + echo '/'.$airline_icao; |
|
77 | +} |
|
78 | +?>"><?php echo _("Airline"); ?></a></li> |
|
79 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
80 | + echo '/'.$airline_icao; |
|
81 | +} |
|
82 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
83 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
84 | + echo '/'.$airline_icao; |
|
85 | +} |
|
86 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
58 | 87 | </ul> |
59 | 88 | </li> |
60 | 89 | <li class="dropdown"> |
@@ -62,10 +91,22 @@ discard block |
||
62 | 91 | <?php echo _("Airport"); ?> <span class="caret"></span> |
63 | 92 | </a> |
64 | 93 | <ul class="dropdown-menu" role="menu"> |
65 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
66 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
67 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
68 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
94 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
95 | + echo '/'.$airline_icao; |
|
96 | +} |
|
97 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
98 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
99 | + echo '/'.$airline_icao; |
|
100 | +} |
|
101 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
102 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
103 | + echo '/'.$airline_icao; |
|
104 | +} |
|
105 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
106 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
107 | + echo '/'.$airline_icao; |
|
108 | +} |
|
109 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
69 | 110 | </ul> |
70 | 111 | </li> |
71 | 112 | <li class="dropdown"> |
@@ -73,8 +114,14 @@ discard block |
||
73 | 114 | <?php echo _("Route"); ?> <span class="caret"></span> |
74 | 115 | </a> |
75 | 116 | <ul class="dropdown-menu" role="menu"> |
76 | - <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li> |
|
77 | - <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
117 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
118 | + echo '/'.$airline_icao; |
|
119 | +} |
|
120 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
121 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
122 | + echo '/'.$airline_icao; |
|
123 | +} |
|
124 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
78 | 125 | </ul> |
79 | 126 | </li> |
80 | 127 | <li class="dropdown"> |
@@ -82,8 +129,14 @@ discard block |
||
82 | 129 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
83 | 130 | </a> |
84 | 131 | <ul class="dropdown-menu" role="menu"> |
85 | - <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li> |
|
86 | - <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li> |
|
132 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
133 | + echo '/'.$airline_icao; |
|
134 | +} |
|
135 | +?>"><?php echo _("Date"); ?></a></li> |
|
136 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
137 | + echo '/'.$airline_icao; |
|
138 | +} |
|
139 | +?>"><?php echo _("Time"); ?></a></li> |
|
87 | 140 | </ul> |
88 | 141 | </li> |
89 | 142 | <?php |
@@ -113,9 +166,18 @@ discard block |
||
113 | 166 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
114 | 167 | </a> |
115 | 168 | <ul class="dropdown-menu"> |
116 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
117 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
118 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
169 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
170 | + echo '/'.$airline_icao; |
|
171 | +} |
|
172 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
173 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
174 | + echo '/'.$airline_icao; |
|
175 | +} |
|
176 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
177 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
178 | + echo '/'.$airline_icao; |
|
179 | +} |
|
180 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
119 | 181 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
120 | 182 | </ul> |
121 | 183 | </li> |
@@ -124,9 +186,18 @@ discard block |
||
124 | 186 | <?php echo _("Airline"); ?> <span class="caret"></span> |
125 | 187 | </a> |
126 | 188 | <ul class="dropdown-menu" role="menu"> |
127 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
128 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
129 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
189 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
190 | + echo '/'.$airline_icao; |
|
191 | +} |
|
192 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
193 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
194 | + echo '/'.$airline_icao; |
|
195 | +} |
|
196 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
197 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
198 | + echo '/'.$airline_icao; |
|
199 | +} |
|
200 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
130 | 201 | </ul> |
131 | 202 | </li> |
132 | 203 | <li class="dropdown"> |
@@ -134,10 +205,22 @@ discard block |
||
134 | 205 | <?php echo _("Airport"); ?> <span class="caret"></span> |
135 | 206 | </a> |
136 | 207 | <ul class="dropdown-menu" role="menu"> |
137 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
138 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
139 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
140 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
208 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
209 | + echo '/'.$airline_icao; |
|
210 | +} |
|
211 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
212 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
213 | + echo '/'.$airline_icao; |
|
214 | +} |
|
215 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
216 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
217 | + echo '/'.$airline_icao; |
|
218 | +} |
|
219 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
220 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
221 | + echo '/'.$airline_icao; |
|
222 | +} |
|
223 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
141 | 224 | </ul> |
142 | 225 | </li> |
143 | 226 | <!-- |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
14 | 18 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -59,8 +59,11 @@ discard block |
||
59 | 59 | } |
60 | 60 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
61 | 61 | $sth->closeCursor(); |
62 | - if ($row['nb'] > 0) return false; |
|
63 | - else return true; |
|
62 | + if ($row['nb'] > 0) { |
|
63 | + return false; |
|
64 | + } else { |
|
65 | + return true; |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | |
66 | 69 | public static function insert_last_update() { |
@@ -84,9 +87,14 @@ discard block |
||
84 | 87 | //$pieces = explode(' ',$data); |
85 | 88 | $pieces = preg_split('/\s/',$data); |
86 | 89 | $pos = 0; |
87 | - if ($pieces[0] == 'METAR') $pos++; |
|
88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | + if ($pieces[0] == 'METAR') { |
|
91 | + $pos++; |
|
92 | + } elseif ($pieces[0] == 'SPECI') { |
|
93 | + $pos++; |
|
94 | + } |
|
95 | + if (strlen($pieces[$pos]) != 4) { |
|
96 | + $pos++; |
|
97 | + } |
|
90 | 98 | $result = array(); |
91 | 99 | $result['location'] = $pieces[$pos]; |
92 | 100 | $pos++; |
@@ -95,16 +103,26 @@ discard block |
||
95 | 103 | $c = count($pieces); |
96 | 104 | for($pos++; $pos < $c; $pos++) { |
97 | 105 | $piece = $pieces[$pos]; |
98 | - if ($piece == 'RMK') break; |
|
99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | - if ($piece == 'COR') $result['correction'] = true; |
|
106 | + if ($piece == 'RMK') { |
|
107 | + break; |
|
108 | + } |
|
109 | + if ($piece == 'AUTO') { |
|
110 | + $result['auto'] = true; |
|
111 | + } |
|
112 | + if ($piece == 'COR') { |
|
113 | + $result['correction'] = true; |
|
114 | + } |
|
101 | 115 | // Wind Speed |
102 | 116 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
103 | 117 | $result['wind']['direction'] = (float)$matches[1]; |
104 | 118 | $result['wind']['unit'] = $matches[4]; |
105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
119 | + if ($result['wind']['unit'] == 'KT') { |
|
120 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
121 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
122 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
123 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
124 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
125 | + } |
|
108 | 126 | $result['wind']['gust'] = (float)$matches[3]; |
109 | 127 | $result['wind']['unit'] = $matches[4]; |
110 | 128 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -186,14 +204,23 @@ discard block |
||
186 | 204 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
187 | 205 | $type = $matches[1]; |
188 | 206 | $cloud = array(); |
189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
207 | + if ($type == 'SKC') { |
|
208 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
209 | + } elseif ($type == 'CLR') { |
|
210 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
211 | + } elseif ($type == 'NSC') { |
|
212 | + $cloud['type'] = 'No significant cloud'; |
|
213 | + } elseif ($type == 'FEW') { |
|
214 | + $cloud['type'] = 'Few'; |
|
215 | + } elseif ($type == 'SCT') { |
|
216 | + $cloud['type'] = 'Scattered'; |
|
217 | + } elseif ($type == 'BKN') { |
|
218 | + $cloud['type'] = 'Broken'; |
|
219 | + } elseif ($type == 'OVC') { |
|
220 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
221 | + } elseif ($type == 'VV') { |
|
222 | + $cloud['type'] = 'Vertical visibility'; |
|
223 | + } |
|
197 | 224 | $cloud['type_code'] = $type; |
198 | 225 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
199 | 226 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
@@ -223,8 +250,11 @@ discard block |
||
223 | 250 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
224 | 251 | //echo $piece; |
225 | 252 | //print_r($matches); |
226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
253 | + if (isset($matches[5])) { |
|
254 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
255 | + } else { |
|
256 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
257 | + } |
|
228 | 258 | if (isset($matches[3])) { |
229 | 259 | $range = Array( |
230 | 260 | 'from' => (float)$matches[2], |
@@ -257,8 +287,11 @@ discard block |
||
257 | 287 | if (isset($matches[3])) { |
258 | 288 | $text[] = $this->texts[$matches[3]]; |
259 | 289 | } |
260 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
261 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
290 | + if (!isset($result['weather'])) { |
|
291 | + $result['weather'] = implode(' ', $text); |
|
292 | + } else { |
|
293 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
294 | + } |
|
262 | 295 | } |
263 | 296 | } |
264 | 297 | return $result; |
@@ -270,8 +303,11 @@ discard block |
||
270 | 303 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
271 | 304 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
272 | 305 | } else { |
273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
306 | + if ($globalDBdriver == 'mysql') { |
|
307 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
308 | + } else { |
|
309 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
310 | + } |
|
275 | 311 | } |
276 | 312 | $query_values = array(':icao' => $icao); |
277 | 313 | try { |
@@ -326,7 +362,9 @@ discard block |
||
326 | 362 | |
327 | 363 | public function addMETARCycle() { |
328 | 364 | global $globalDebug, $globalIVAO, $globalTransaction; |
329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
365 | + if (isset($globalDebug) && $globalDebug) { |
|
366 | + echo "Downloading METAR cycle..."; |
|
367 | + } |
|
330 | 368 | date_default_timezone_set("UTC"); |
331 | 369 | $Common = new Common(); |
332 | 370 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -339,33 +377,49 @@ discard block |
||
339 | 377 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
340 | 378 | } |
341 | 379 | if ($handle) { |
342 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
380 | + if (isset($globalDebug) && $globalDebug) { |
|
381 | + echo "Done - Updating DB..."; |
|
382 | + } |
|
343 | 383 | $date = ''; |
344 | 384 | //foreach(explode("\n",$cycle) as $line) { |
345 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
385 | + if ($globalTransaction) { |
|
386 | + $this->db->beginTransaction(); |
|
387 | + } |
|
346 | 388 | while(($line = fgets($handle,4096)) !== false) { |
347 | 389 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
348 | 390 | $date = $line; |
349 | 391 | } elseif ($line != '') { |
350 | 392 | //$this->parse($line); |
351 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
393 | + if ($date == '') { |
|
394 | + $date = date('Y/m/d H:m'); |
|
395 | + } |
|
352 | 396 | $pos = 0; |
353 | 397 | $pieces = preg_split('/\s/',$line); |
354 | - if ($pieces[0] == 'METAR') $pos++; |
|
355 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
398 | + if ($pieces[0] == 'METAR') { |
|
399 | + $pos++; |
|
400 | + } |
|
401 | + if (strlen($pieces[$pos]) != 4) { |
|
402 | + $pos++; |
|
403 | + } |
|
356 | 404 | $location = $pieces[$pos]; |
357 | 405 | echo $this->addMETAR($location,$line,$date); |
358 | 406 | } |
359 | 407 | } |
360 | 408 | fclose($handle); |
361 | - if ($globalTransaction) $this->db->commit(); |
|
409 | + if ($globalTransaction) { |
|
410 | + $this->db->commit(); |
|
411 | + } |
|
412 | + } |
|
413 | + if (isset($globalDebug) && $globalDebug) { |
|
414 | + echo "Done\n"; |
|
362 | 415 | } |
363 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
364 | 416 | |
365 | 417 | } |
366 | 418 | public function downloadMETAR($icao) { |
367 | 419 | global $globalMETARurl; |
368 | - if ($globalMETARurl == '') return array(); |
|
420 | + if ($globalMETARurl == '') { |
|
421 | + return array(); |
|
422 | + } |
|
369 | 423 | date_default_timezone_set("UTC"); |
370 | 424 | $Common = new Common(); |
371 | 425 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -379,16 +433,24 @@ discard block |
||
379 | 433 | if ($line != '') { |
380 | 434 | //$this->parse($line); |
381 | 435 | //echo $line; |
382 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
436 | + if ($date == '') { |
|
437 | + $date = date('Y/m/d H:m'); |
|
438 | + } |
|
383 | 439 | $pos = 0; |
384 | 440 | $pieces = preg_split('/\s/',$line); |
385 | - if ($pieces[0] == 'METAR') $pos++; |
|
386 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
441 | + if ($pieces[0] == 'METAR') { |
|
442 | + $pos++; |
|
443 | + } |
|
444 | + if (strlen($pieces[$pos]) != 4) { |
|
445 | + $pos++; |
|
446 | + } |
|
387 | 447 | $location = $pieces[$pos]; |
388 | 448 | if (strlen($location == 4)) { |
389 | 449 | $this->addMETAR($location,$line,$date); |
390 | 450 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
391 | - } else return array(); |
|
451 | + } else { |
|
452 | + return array(); |
|
453 | + } |
|
392 | 454 | } |
393 | 455 | //echo $line."\n"; |
394 | 456 | } |
@@ -23,7 +23,9 @@ discard block |
||
23 | 23 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
24 | 24 | } |
25 | 25 | } |
26 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
26 | + if (is_array($globalFilter)) { |
|
27 | + $filter = array_merge($filter,$globalFilter); |
|
28 | + } |
|
27 | 29 | $filter_query_join = ''; |
28 | 30 | $filter_query_where = ''; |
29 | 31 | foreach($filters as $flt) { |
@@ -74,8 +76,11 @@ discard block |
||
74 | 76 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
75 | 77 | } |
76 | 78 | } |
77 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
78 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
79 | + if ($filter_query_where == '' && $where) { |
|
80 | + $filter_query_where = ' WHERE'; |
|
81 | + } elseif ($filter_query_where != '' && $and) { |
|
82 | + $filter_query_where .= ' AND'; |
|
83 | + } |
|
79 | 84 | $filter_query = $filter_query_join.$filter_query_where; |
80 | 85 | return $filter_query; |
81 | 86 | } |
@@ -86,10 +91,17 @@ discard block |
||
86 | 91 | if ($over_country == '') { |
87 | 92 | $Spotter = new Spotter($this->db); |
88 | 93 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
89 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
90 | - else $country = ''; |
|
91 | - } else $country = $over_country; |
|
92 | - if ($airline_type === NULL) $airline_type =''; |
|
94 | + if (!empty($data_country)) { |
|
95 | + $country = $data_country['iso2']; |
|
96 | + } else { |
|
97 | + $country = ''; |
|
98 | + } |
|
99 | + } else { |
|
100 | + $country = $over_country; |
|
101 | + } |
|
102 | + if ($airline_type === NULL) { |
|
103 | + $airline_type =''; |
|
104 | + } |
|
93 | 105 | |
94 | 106 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
95 | 107 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -592,7 +604,9 @@ discard block |
||
592 | 604 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
593 | 605 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
594 | 606 | $translate = $Translation->ident2icao($q_item); |
595 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
607 | + if ($translate != $q_item) { |
|
608 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
609 | + } |
|
596 | 610 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
597 | 611 | $additional_query .= ")"; |
598 | 612 | } |
@@ -810,7 +824,9 @@ discard block |
||
810 | 824 | date_default_timezone_set($globalTimezone); |
811 | 825 | $datetime = new DateTime(); |
812 | 826 | $offset = $datetime->format('P'); |
813 | - } else $offset = '+00:00'; |
|
827 | + } else { |
|
828 | + $offset = '+00:00'; |
|
829 | + } |
|
814 | 830 | |
815 | 831 | |
816 | 832 | if ($date_array[1] != "") |
@@ -1084,9 +1100,13 @@ discard block |
||
1084 | 1100 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1085 | 1101 | } |
1086 | 1102 | } |
1087 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1103 | + if ($sincedate != '') { |
|
1104 | + $query .= "AND date > '".$sincedate."' "; |
|
1105 | + } |
|
1088 | 1106 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1089 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1107 | + if ($limit) { |
|
1108 | + $query .= " LIMIT 0,10"; |
|
1109 | + } |
|
1090 | 1110 | |
1091 | 1111 | |
1092 | 1112 | $sth = $this->db->prepare($query); |
@@ -1130,9 +1150,13 @@ discard block |
||
1130 | 1150 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1131 | 1151 | } |
1132 | 1152 | } |
1133 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1153 | + if ($sincedate != '') { |
|
1154 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1155 | + } |
|
1134 | 1156 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1135 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1157 | + if ($limit) { |
|
1158 | + $query .= " LIMIT 0,10"; |
|
1159 | + } |
|
1136 | 1160 | |
1137 | 1161 | |
1138 | 1162 | $sth = $this->db->prepare($query); |
@@ -6,11 +6,15 @@ discard block |
||
6 | 6 | $beginpage = microtime(true); |
7 | 7 | $Stats = new Stats(); |
8 | 8 | |
9 | -if (!isset($filter_name)) $filter_name = ''; |
|
9 | +if (!isset($filter_name)) { |
|
10 | + $filter_name = ''; |
|
11 | +} |
|
10 | 12 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
11 | 13 | if ($airline_icao == '' && isset($globalFilter)) { |
12 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
13 | -} |
|
14 | + if (isset($globalFilter['airline'])) { |
|
15 | + $airline_icao = $globalFilter['airline'][0]; |
|
16 | + } |
|
17 | + } |
|
14 | 18 | if ($airline_icao != '' && $airline_icao != 'all') { |
15 | 19 | $Spotter = new Spotter(); |
16 | 20 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -36,14 +40,21 @@ discard block |
||
36 | 40 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/justgage.js"></script> |
37 | 41 | <div class="column"> |
38 | 42 | <div class="info"> |
39 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
43 | + <h1><?php if (isset($airline_name)) { |
|
44 | + echo _("Statistics for ").$airline_name; |
|
45 | +} else { |
|
46 | + echo _("Statistics"); |
|
47 | +} |
|
48 | +?></h1> |
|
40 | 49 | <?php |
41 | 50 | $last_update = $Stats->getLastStatsUpdate(); |
42 | 51 | //if (isset($last_update[0]['value'])) print '<!-- Last update : '.$last_update[0]['value'].' -->'; |
43 | 52 | if (isset($last_update[0]['value'])) { |
44 | 53 | date_default_timezone_set('UTC'); |
45 | 54 | $lastupdate = strtotime($last_update[0]['value']); |
46 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
55 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
56 | + date_default_timezone_set($globalTimezone); |
|
57 | + } |
|
47 | 58 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
48 | 59 | } |
49 | 60 | ?> |
@@ -95,8 +106,9 @@ discard block |
||
95 | 106 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
96 | 107 | <?php |
97 | 108 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
98 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
99 | - else { |
|
109 | + if (count($aircraft_array) == 0) { |
|
110 | + print _("No data available"); |
|
111 | + } else { |
|
100 | 112 | |
101 | 113 | print '<div id="chart1" class="chart" width="100%"></div> |
102 | 114 | <script> |
@@ -133,11 +145,17 @@ discard block |
||
133 | 145 | <?php |
134 | 146 | if ($year != '' && $month != '') { |
135 | 147 | ?> |
136 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
148 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
149 | + echo '/'.$airline_icao; |
|
150 | +} |
|
151 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
137 | 152 | <?php |
138 | 153 | } else { |
139 | 154 | ?> |
140 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
155 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
156 | + echo '/'.$airline_icao; |
|
157 | +} |
|
158 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
141 | 159 | <?php |
142 | 160 | } |
143 | 161 | ?> |
@@ -182,11 +200,15 @@ discard block |
||
182 | 200 | </script>'; |
183 | 201 | if ($year != '' && $month != '') { |
184 | 202 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
185 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
203 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
204 | + echo '/'.$airline_icao; |
|
205 | + } |
|
186 | 206 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
187 | 207 | } else { |
188 | 208 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
189 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
209 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
210 | + echo '/'.$airline_icao; |
|
211 | + } |
|
190 | 212 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
191 | 213 | } |
192 | 214 | print '</div>'; |
@@ -210,8 +232,9 @@ discard block |
||
210 | 232 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
211 | 233 | <?php |
212 | 234 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
213 | - if (count($pilot_array) == 0) print _("No data available"); |
|
214 | - else { |
|
235 | + if (count($pilot_array) == 0) { |
|
236 | + print _("No data available"); |
|
237 | + } else { |
|
215 | 238 | print '<div id="chart7" class="chart" width="100%"></div> |
216 | 239 | <script> |
217 | 240 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -244,7 +267,9 @@ discard block |
||
244 | 267 | } |
245 | 268 | print '<div class="more">'; |
246 | 269 | print '<a href="'.$globalURL.'/statistics/pilot'; |
247 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
270 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
271 | + echo '/'.$airline_icao; |
|
272 | + } |
|
248 | 273 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
249 | 274 | print '</div>'; |
250 | 275 | ?> |
@@ -258,8 +283,9 @@ discard block |
||
258 | 283 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
259 | 284 | <?php |
260 | 285 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
261 | - if (count($owner_array) == 0) print _("No data available"); |
|
262 | - else { |
|
286 | + if (count($owner_array) == 0) { |
|
287 | + print _("No data available"); |
|
288 | + } else { |
|
263 | 289 | print '<div id="chart7" class="chart" width="100%"></div> |
264 | 290 | <script> |
265 | 291 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -292,7 +318,10 @@ discard block |
||
292 | 318 | } |
293 | 319 | ?> |
294 | 320 | <div class="more"> |
295 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
321 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
322 | + echo '/'.$airline_icao; |
|
323 | +} |
|
324 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
296 | 325 | </div> |
297 | 326 | </div> |
298 | 327 | |
@@ -305,8 +334,9 @@ discard block |
||
305 | 334 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
306 | 335 | <?php |
307 | 336 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
308 | - if (count($flightover_array) == 0) print _("No data available"); |
|
309 | - else { |
|
337 | + if (count($flightover_array) == 0) { |
|
338 | + print _("No data available"); |
|
339 | + } else { |
|
310 | 340 | print '<div id="chart10" class="chart" width="100%"></div> |
311 | 341 | <script> |
312 | 342 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -341,7 +371,10 @@ discard block |
||
341 | 371 | } |
342 | 372 | ?> |
343 | 373 | <div class="more"> |
344 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
374 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
375 | + echo '/'.$airline_icao; |
|
376 | +} |
|
377 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
345 | 378 | </div> |
346 | 379 | </div> |
347 | 380 | <?php |
@@ -394,7 +427,9 @@ discard block |
||
394 | 427 | } |
395 | 428 | </script>'; |
396 | 429 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
397 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
430 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
431 | + echo '/'.$airline_icao; |
|
432 | + } |
|
398 | 433 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
399 | 434 | } |
400 | 435 | ?> |
@@ -441,7 +476,9 @@ discard block |
||
441 | 476 | } |
442 | 477 | </script>'; |
443 | 478 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
444 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
479 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
480 | + echo '/'.$airline_icao; |
|
481 | + } |
|
445 | 482 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
446 | 483 | } |
447 | 484 | ?> |
@@ -456,8 +493,9 @@ discard block |
||
456 | 493 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
457 | 494 | <?php |
458 | 495 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
459 | - if (count($year_array) == 0) print _("No data available"); |
|
460 | - else { |
|
496 | + if (count($year_array) == 0) { |
|
497 | + print _("No data available"); |
|
498 | + } else { |
|
461 | 499 | print '<div id="chart8" class="chart" width="100%"></div> |
462 | 500 | <script> |
463 | 501 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -493,7 +531,10 @@ discard block |
||
493 | 531 | } |
494 | 532 | ?> |
495 | 533 | <div class="more"> |
496 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
534 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
535 | + echo '/'.$airline_icao; |
|
536 | +} |
|
537 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
497 | 538 | </div> |
498 | 539 | </div> |
499 | 540 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -501,8 +542,9 @@ discard block |
||
501 | 542 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
502 | 543 | <?php |
503 | 544 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
504 | - if (count($month_array) == 0) print _("No data available"); |
|
505 | - else { |
|
545 | + if (count($month_array) == 0) { |
|
546 | + print _("No data available"); |
|
547 | + } else { |
|
506 | 548 | print '<div id="chart9" class="chart" width="100%"></div> |
507 | 549 | <script> |
508 | 550 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -538,7 +580,10 @@ discard block |
||
538 | 580 | } |
539 | 581 | ?> |
540 | 582 | <div class="more"> |
541 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
583 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
584 | + echo '/'.$airline_icao; |
|
585 | +} |
|
586 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
542 | 587 | </div> |
543 | 588 | </div> |
544 | 589 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -547,8 +592,9 @@ discard block |
||
547 | 592 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
548 | 593 | <?php |
549 | 594 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
550 | - if (empty($date_array)) print _("No data available"); |
|
551 | - else { |
|
595 | + if (empty($date_array)) { |
|
596 | + print _("No data available"); |
|
597 | + } else { |
|
552 | 598 | print '<div id="chart5" class="chart" width="100%"></div> |
553 | 599 | <script> |
554 | 600 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -585,7 +631,10 @@ discard block |
||
585 | 631 | } |
586 | 632 | ?> |
587 | 633 | <div class="more"> |
588 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
634 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
635 | + echo '/'.$airline_icao; |
|
636 | +} |
|
637 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
589 | 638 | </div> |
590 | 639 | </div> |
591 | 640 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -593,8 +642,9 @@ discard block |
||
593 | 642 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
594 | 643 | <?php |
595 | 644 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
596 | - if (empty($hour_array)) print _("No data available"); |
|
597 | - else { |
|
645 | + if (empty($hour_array)) { |
|
646 | + print _("No data available"); |
|
647 | + } else { |
|
598 | 648 | |
599 | 649 | print '<div id="chart6" class="chart" width="100%"></div> |
600 | 650 | <script> |
@@ -631,7 +681,10 @@ discard block |
||
631 | 681 | } |
632 | 682 | ?> |
633 | 683 | <div class="more"> |
634 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
684 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
685 | + echo '/'.$airline_icao; |
|
686 | +} |
|
687 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
635 | 688 | </div> |
636 | 689 | </div> |
637 | 690 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -650,8 +703,9 @@ discard block |
||
650 | 703 | require_once('require/class.Accident.php'); |
651 | 704 | $Accident = new Accident(); |
652 | 705 | $year_array = $Accident->countFatalitiesByYear($filter_name); |
653 | - if (count($year_array) == 0) print _("No data available"); |
|
654 | - else { |
|
706 | + if (count($year_array) == 0) { |
|
707 | + print _("No data available"); |
|
708 | + } else { |
|
655 | 709 | print '<div id="chart32" class="chart" width="100%"></div> |
656 | 710 | <script> |
657 | 711 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -699,8 +753,9 @@ discard block |
||
699 | 753 | require_once('require/class.Accident.php'); |
700 | 754 | $Accident = new Accident(); |
701 | 755 | $year_array = $Accident->countFatalitiesLast12Months($filter_name); |
702 | - if (count($year_array) == 0) print _("No data available"); |
|
703 | - else { |
|
756 | + if (count($year_array) == 0) { |
|
757 | + print _("No data available"); |
|
758 | + } else { |
|
704 | 759 | print '<div id="chart33" class="chart" width="100%"></div> |
705 | 760 | <script> |
706 | 761 | google.load("visualization", "1", {packages:["corechart"]}); |
@@ -776,8 +831,11 @@ discard block |
||
776 | 831 | $distance = $distance; |
777 | 832 | $unit = 'km'; |
778 | 833 | } |
779 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
780 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
834 | + if (!isset($polar_data)) { |
|
835 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
836 | + } else { |
|
837 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
838 | + } |
|
781 | 839 | } |
782 | 840 | ?> |
783 | 841 | <div class="col-md-6"> |
@@ -829,8 +887,11 @@ discard block |
||
829 | 887 | foreach ($msg as $eachmsg) { |
830 | 888 | //$eachmsg = $msg[0]; |
831 | 889 | $data = $eachmsg['source_data']; |
832 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
833 | - else $max = 500; |
|
890 | + if ($data > 500) { |
|
891 | + $max = (round(($data+100)/100))*100; |
|
892 | + } else { |
|
893 | + $max = 500; |
|
894 | + } |
|
834 | 895 | ?> |
835 | 896 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
836 | 897 | <script> |
@@ -12,7 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct($dbc = null) { |
14 | 14 | global $globalFilterName; |
15 | - if (isset($globalFilterName)) $this->filter_name = $globalFilterName; |
|
15 | + if (isset($globalFilterName)) { |
|
16 | + $this->filter_name = $globalFilterName; |
|
17 | + } |
|
16 | 18 | $Connection = new Connection($dbc); |
17 | 19 | $this->db = $Connection->db(); |
18 | 20 | } |
@@ -77,7 +79,9 @@ discard block |
||
77 | 79 | } |
78 | 80 | } |
79 | 81 | public function getAllAirlineNames($filter_name = '') { |
80 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
82 | + if ($filter_name == '') { |
|
83 | + $filter_name = $this->filter_name; |
|
84 | + } |
|
81 | 85 | $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
82 | 86 | try { |
83 | 87 | $sth = $this->db->prepare($query); |
@@ -89,7 +93,9 @@ discard block |
||
89 | 93 | return $all; |
90 | 94 | } |
91 | 95 | public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
92 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
96 | + if ($filter_name == '') { |
|
97 | + $filter_name = $this->filter_name; |
|
98 | + } |
|
93 | 99 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
94 | 100 | try { |
95 | 101 | $sth = $this->db->prepare($query); |
@@ -101,7 +107,9 @@ discard block |
||
101 | 107 | return $all; |
102 | 108 | } |
103 | 109 | public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
104 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
110 | + if ($filter_name == '') { |
|
111 | + $filter_name = $this->filter_name; |
|
112 | + } |
|
105 | 113 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
106 | 114 | try { |
107 | 115 | $sth = $this->db->prepare($query); |
@@ -113,7 +121,9 @@ discard block |
||
113 | 121 | return $all; |
114 | 122 | } |
115 | 123 | public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
116 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
124 | + if ($filter_name == '') { |
|
125 | + $filter_name = $this->filter_name; |
|
126 | + } |
|
117 | 127 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
118 | 128 | try { |
119 | 129 | $sth = $this->db->prepare($query); |
@@ -126,7 +136,9 @@ discard block |
||
126 | 136 | } |
127 | 137 | |
128 | 138 | public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
129 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
139 | + if ($filter_name == '') { |
|
140 | + $filter_name = $this->filter_name; |
|
141 | + } |
|
130 | 142 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
131 | 143 | try { |
132 | 144 | $sth = $this->db->prepare($query); |
@@ -139,7 +151,9 @@ discard block |
||
139 | 151 | } |
140 | 152 | |
141 | 153 | public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
142 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
154 | + if ($filter_name == '') { |
|
155 | + $filter_name = $this->filter_name; |
|
156 | + } |
|
143 | 157 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
144 | 158 | try { |
145 | 159 | $sth = $this->db->prepare($query); |
@@ -154,10 +168,15 @@ discard block |
||
154 | 168 | |
155 | 169 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
156 | 170 | global $globalStatsFilters; |
157 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
171 | + if ($filter_name == '') { |
|
172 | + $filter_name = $this->filter_name; |
|
173 | + } |
|
158 | 174 | if ($year == '' && $month == '') { |
159 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
160 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
175 | + if ($limit) { |
|
176 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
177 | + } else { |
|
178 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
179 | + } |
|
161 | 180 | try { |
162 | 181 | $sth = $this->db->prepare($query); |
163 | 182 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -165,7 +184,9 @@ discard block |
||
165 | 184 | echo "error : ".$e->getMessage(); |
166 | 185 | } |
167 | 186 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
168 | - } else $all = array(); |
|
187 | + } else { |
|
188 | + $all = array(); |
|
189 | + } |
|
169 | 190 | if (empty($all)) { |
170 | 191 | $filters = array('airlines' => array($stats_airline)); |
171 | 192 | if ($filter_name != '') { |
@@ -178,10 +199,15 @@ discard block |
||
178 | 199 | } |
179 | 200 | public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
180 | 201 | global $globalStatsFilters; |
181 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
202 | + if ($filter_name == '') { |
|
203 | + $filter_name = $this->filter_name; |
|
204 | + } |
|
182 | 205 | if ($year == '' && $month == '') { |
183 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
184 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
206 | + if ($limit) { |
|
207 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
208 | + } else { |
|
209 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
210 | + } |
|
185 | 211 | try { |
186 | 212 | $sth = $this->db->prepare($query); |
187 | 213 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -189,7 +215,9 @@ discard block |
||
189 | 215 | echo "error : ".$e->getMessage(); |
190 | 216 | } |
191 | 217 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
192 | - } else $all = array(); |
|
218 | + } else { |
|
219 | + $all = array(); |
|
220 | + } |
|
193 | 221 | if (empty($all)) { |
194 | 222 | $Spotter = new Spotter($this->db); |
195 | 223 | $filters = array(); |
@@ -202,10 +230,15 @@ discard block |
||
202 | 230 | } |
203 | 231 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
204 | 232 | global $globalStatsFilters; |
205 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
233 | + if ($filter_name == '') { |
|
234 | + $filter_name = $this->filter_name; |
|
235 | + } |
|
206 | 236 | if ($year == '' && $month == '') { |
207 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
208 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
237 | + if ($limit) { |
|
238 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
239 | + } else { |
|
240 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
241 | + } |
|
209 | 242 | try { |
210 | 243 | $sth = $this->db->prepare($query); |
211 | 244 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -213,7 +246,9 @@ discard block |
||
213 | 246 | echo "error : ".$e->getMessage(); |
214 | 247 | } |
215 | 248 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
216 | - } else $all = array(); |
|
249 | + } else { |
|
250 | + $all = array(); |
|
251 | + } |
|
217 | 252 | if (empty($all)) { |
218 | 253 | $filters = array('airlines' => array($stats_airline)); |
219 | 254 | if ($filter_name != '') { |
@@ -227,10 +262,15 @@ discard block |
||
227 | 262 | |
228 | 263 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
229 | 264 | global $globalStatsFilters; |
230 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
265 | + if ($filter_name == '') { |
|
266 | + $filter_name = $this->filter_name; |
|
267 | + } |
|
231 | 268 | if ($year == '' && $month == '') { |
232 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
233 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
269 | + if ($limit) { |
|
270 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
271 | + } else { |
|
272 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
273 | + } |
|
234 | 274 | try { |
235 | 275 | $sth = $this->db->prepare($query); |
236 | 276 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -238,7 +278,9 @@ discard block |
||
238 | 278 | echo "error : ".$e->getMessage(); |
239 | 279 | } |
240 | 280 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
241 | - } else $all = array(); |
|
281 | + } else { |
|
282 | + $all = array(); |
|
283 | + } |
|
242 | 284 | if (empty($all)) { |
243 | 285 | $filters = array('airlines' => array($stats_airline)); |
244 | 286 | if ($filter_name != '') { |
@@ -251,9 +293,14 @@ discard block |
||
251 | 293 | } |
252 | 294 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
253 | 295 | global $globalStatsFilters; |
254 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
255 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
256 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
296 | + if ($filter_name == '') { |
|
297 | + $filter_name = $this->filter_name; |
|
298 | + } |
|
299 | + if ($limit) { |
|
300 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
301 | + } else { |
|
302 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
303 | + } |
|
257 | 304 | try { |
258 | 305 | $sth = $this->db->prepare($query); |
259 | 306 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -274,10 +321,15 @@ discard block |
||
274 | 321 | |
275 | 322 | public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
276 | 323 | global $globalStatsFilters; |
277 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
324 | + if ($filter_name == '') { |
|
325 | + $filter_name = $this->filter_name; |
|
326 | + } |
|
278 | 327 | if ($year == '' && $month == '') { |
279 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
280 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
328 | + if ($limit) { |
|
329 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
330 | + } else { |
|
331 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
332 | + } |
|
281 | 333 | try { |
282 | 334 | $sth = $this->db->prepare($query); |
283 | 335 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -285,7 +337,9 @@ discard block |
||
285 | 337 | echo "error : ".$e->getMessage(); |
286 | 338 | } |
287 | 339 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
288 | - } else $all = array(); |
|
340 | + } else { |
|
341 | + $all = array(); |
|
342 | + } |
|
289 | 343 | if (empty($all)) { |
290 | 344 | $Spotter = new Spotter($this->db); |
291 | 345 | $filters = array(); |
@@ -299,10 +353,15 @@ discard block |
||
299 | 353 | } |
300 | 354 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
301 | 355 | global $globalStatsFilters; |
302 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
356 | + if ($filter_name == '') { |
|
357 | + $filter_name = $this->filter_name; |
|
358 | + } |
|
303 | 359 | if ($year == '' && $month == '') { |
304 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
305 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
360 | + if ($limit) { |
|
361 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
362 | + } else { |
|
363 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
364 | + } |
|
306 | 365 | try { |
307 | 366 | $sth = $this->db->prepare($query); |
308 | 367 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -310,7 +369,9 @@ discard block |
||
310 | 369 | echo "error : ".$e->getMessage(); |
311 | 370 | } |
312 | 371 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
313 | - } else $all = array(); |
|
372 | + } else { |
|
373 | + $all = array(); |
|
374 | + } |
|
314 | 375 | if (empty($all)) { |
315 | 376 | $filters = array('airlines' => array($stats_airline)); |
316 | 377 | if ($filter_name != '') { |
@@ -323,10 +384,15 @@ discard block |
||
323 | 384 | } |
324 | 385 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
325 | 386 | global $globalStatsFilters; |
326 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
387 | + if ($filter_name == '') { |
|
388 | + $filter_name = $this->filter_name; |
|
389 | + } |
|
327 | 390 | if ($year == '' && $month == '') { |
328 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
329 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
391 | + if ($limit) { |
|
392 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
393 | + } else { |
|
394 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
395 | + } |
|
330 | 396 | try { |
331 | 397 | $sth = $this->db->prepare($query); |
332 | 398 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -334,7 +400,9 @@ discard block |
||
334 | 400 | echo "error : ".$e->getMessage(); |
335 | 401 | } |
336 | 402 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
337 | - } else $all = array(); |
|
403 | + } else { |
|
404 | + $all = array(); |
|
405 | + } |
|
338 | 406 | if (empty($all)) { |
339 | 407 | $filters = array('airlines' => array($stats_airline)); |
340 | 408 | if ($filter_name != '') { |
@@ -347,11 +415,16 @@ discard block |
||
347 | 415 | } |
348 | 416 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
349 | 417 | $Connection = new Connection(); |
350 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
418 | + if ($filter_name == '') { |
|
419 | + $filter_name = $this->filter_name; |
|
420 | + } |
|
351 | 421 | if ($Connection->tableExists('countries')) { |
352 | 422 | if ($year == '' && $month == '') { |
353 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
354 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
423 | + if ($limit) { |
|
424 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
425 | + } else { |
|
426 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
427 | + } |
|
355 | 428 | try { |
356 | 429 | $sth = $this->db->prepare($query); |
357 | 430 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -366,17 +439,24 @@ discard block |
||
366 | 439 | } |
367 | 440 | */ |
368 | 441 | return $all; |
369 | - } else return array(); |
|
442 | + } else { |
|
443 | + return array(); |
|
444 | + } |
|
370 | 445 | } else { |
371 | 446 | return array(); |
372 | 447 | } |
373 | 448 | } |
374 | 449 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
375 | 450 | global $globalStatsFilters; |
376 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
451 | + if ($filter_name == '') { |
|
452 | + $filter_name = $this->filter_name; |
|
453 | + } |
|
377 | 454 | if ($year == '' && $month == '') { |
378 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
379 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
455 | + if ($limit) { |
|
456 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
457 | + } else { |
|
458 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
459 | + } |
|
380 | 460 | try { |
381 | 461 | $sth = $this->db->prepare($query); |
382 | 462 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -384,7 +464,9 @@ discard block |
||
384 | 464 | echo "error : ".$e->getMessage(); |
385 | 465 | } |
386 | 466 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
387 | - } else $all = array(); |
|
467 | + } else { |
|
468 | + $all = array(); |
|
469 | + } |
|
388 | 470 | if (empty($all)) { |
389 | 471 | $filters = array('airlines' => array($stats_airline)); |
390 | 472 | if ($filter_name != '') { |
@@ -398,10 +480,15 @@ discard block |
||
398 | 480 | |
399 | 481 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
400 | 482 | global $globalStatsFilters; |
401 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
483 | + if ($filter_name == '') { |
|
484 | + $filter_name = $this->filter_name; |
|
485 | + } |
|
402 | 486 | if ($year == '' && $month == '') { |
403 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
404 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
487 | + if ($limit) { |
|
488 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
489 | + } else { |
|
490 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
491 | + } |
|
405 | 492 | try { |
406 | 493 | $sth = $this->db->prepare($query); |
407 | 494 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -409,7 +496,9 @@ discard block |
||
409 | 496 | echo "error : ".$e->getMessage(); |
410 | 497 | } |
411 | 498 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
412 | - } else $all = array(); |
|
499 | + } else { |
|
500 | + $all = array(); |
|
501 | + } |
|
413 | 502 | if (empty($all)) { |
414 | 503 | $filters = array('airlines' => array($stats_airline)); |
415 | 504 | if ($filter_name != '') { |
@@ -422,10 +511,15 @@ discard block |
||
422 | 511 | } |
423 | 512 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
424 | 513 | global $globalStatsFilters; |
425 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
514 | + if ($filter_name == '') { |
|
515 | + $filter_name = $this->filter_name; |
|
516 | + } |
|
426 | 517 | if ($year == '' && $month == '') { |
427 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
428 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
518 | + if ($limit) { |
|
519 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
520 | + } else { |
|
521 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
522 | + } |
|
429 | 523 | try { |
430 | 524 | $sth = $this->db->prepare($query); |
431 | 525 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -433,7 +527,9 @@ discard block |
||
433 | 527 | echo "error : ".$e->getMessage(); |
434 | 528 | } |
435 | 529 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
436 | - } else $all = array(); |
|
530 | + } else { |
|
531 | + $all = array(); |
|
532 | + } |
|
437 | 533 | if (empty($all)) { |
438 | 534 | $filters = array('airlines' => array($stats_airline)); |
439 | 535 | if ($filter_name != '') { |
@@ -452,7 +548,9 @@ discard block |
||
452 | 548 | $icao = $value['airport_departure_icao']; |
453 | 549 | if (isset($all[$icao])) { |
454 | 550 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
455 | - } else $all[$icao] = $value; |
|
551 | + } else { |
|
552 | + $all[$icao] = $value; |
|
553 | + } |
|
456 | 554 | } |
457 | 555 | $count = array(); |
458 | 556 | foreach ($all as $key => $row) { |
@@ -464,10 +562,15 @@ discard block |
||
464 | 562 | } |
465 | 563 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
466 | 564 | global $globalStatsFilters; |
467 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
565 | + if ($filter_name == '') { |
|
566 | + $filter_name = $this->filter_name; |
|
567 | + } |
|
468 | 568 | if ($year == '' && $month == '') { |
469 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
470 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
569 | + if ($limit) { |
|
570 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
571 | + } else { |
|
572 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
573 | + } |
|
471 | 574 | try { |
472 | 575 | $sth = $this->db->prepare($query); |
473 | 576 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -475,7 +578,9 @@ discard block |
||
475 | 578 | echo "error : ".$e->getMessage(); |
476 | 579 | } |
477 | 580 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
478 | - } else $all = array(); |
|
581 | + } else { |
|
582 | + $all = array(); |
|
583 | + } |
|
479 | 584 | if (empty($all)) { |
480 | 585 | $filters = array('airlines' => array($stats_airline)); |
481 | 586 | if ($filter_name != '') { |
@@ -494,7 +599,9 @@ discard block |
||
494 | 599 | $icao = $value['airport_arrival_icao']; |
495 | 600 | if (isset($all[$icao])) { |
496 | 601 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
497 | - } else $all[$icao] = $value; |
|
602 | + } else { |
|
603 | + $all[$icao] = $value; |
|
604 | + } |
|
498 | 605 | } |
499 | 606 | $count = array(); |
500 | 607 | foreach ($all as $key => $row) { |
@@ -507,13 +614,21 @@ discard block |
||
507 | 614 | } |
508 | 615 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
509 | 616 | global $globalDBdriver, $globalStatsFilters; |
510 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
617 | + if ($filter_name == '') { |
|
618 | + $filter_name = $this->filter_name; |
|
619 | + } |
|
511 | 620 | if ($globalDBdriver == 'mysql') { |
512 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
513 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
621 | + if ($limit) { |
|
622 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
623 | + } else { |
|
624 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
625 | + } |
|
514 | 626 | } else { |
515 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
516 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
627 | + if ($limit) { |
|
628 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
629 | + } else { |
|
630 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
631 | + } |
|
517 | 632 | } |
518 | 633 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
519 | 634 | try { |
@@ -537,7 +652,9 @@ discard block |
||
537 | 652 | |
538 | 653 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
539 | 654 | global $globalStatsFilters; |
540 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
655 | + if ($filter_name == '') { |
|
656 | + $filter_name = $this->filter_name; |
|
657 | + } |
|
541 | 658 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
542 | 659 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
543 | 660 | try { |
@@ -559,7 +676,9 @@ discard block |
||
559 | 676 | } |
560 | 677 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
561 | 678 | global $globalDBdriver, $globalStatsFilters; |
562 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
679 | + if ($filter_name == '') { |
|
680 | + $filter_name = $this->filter_name; |
|
681 | + } |
|
563 | 682 | if ($globalDBdriver == 'mysql') { |
564 | 683 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
565 | 684 | } else { |
@@ -585,7 +704,9 @@ discard block |
||
585 | 704 | } |
586 | 705 | public function countAllDates($stats_airline = '',$filter_name = '') { |
587 | 706 | global $globalStatsFilters; |
588 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
707 | + if ($filter_name == '') { |
|
708 | + $filter_name = $this->filter_name; |
|
709 | + } |
|
589 | 710 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
590 | 711 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
591 | 712 | try { |
@@ -607,7 +728,9 @@ discard block |
||
607 | 728 | } |
608 | 729 | public function countAllDatesByAirlines($filter_name = '') { |
609 | 730 | global $globalStatsFilters; |
610 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
731 | + if ($filter_name == '') { |
|
732 | + $filter_name = $this->filter_name; |
|
733 | + } |
|
611 | 734 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
612 | 735 | $query_data = array('filter_name' => $filter_name); |
613 | 736 | try { |
@@ -629,7 +752,9 @@ discard block |
||
629 | 752 | } |
630 | 753 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
631 | 754 | global $globalStatsFilters; |
632 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
755 | + if ($filter_name == '') { |
|
756 | + $filter_name = $this->filter_name; |
|
757 | + } |
|
633 | 758 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
634 | 759 | try { |
635 | 760 | $sth = $this->db->prepare($query); |
@@ -652,7 +777,9 @@ discard block |
||
652 | 777 | } |
653 | 778 | public function countAllMilitaryMonths($filter_name = '') { |
654 | 779 | global $globalStatsFilters; |
655 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
780 | + if ($filter_name == '') { |
|
781 | + $filter_name = $this->filter_name; |
|
782 | + } |
|
656 | 783 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name"; |
657 | 784 | try { |
658 | 785 | $sth = $this->db->prepare($query); |
@@ -673,9 +800,14 @@ discard block |
||
673 | 800 | } |
674 | 801 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
675 | 802 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
676 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
677 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
678 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
803 | + if ($filter_name == '') { |
|
804 | + $filter_name = $this->filter_name; |
|
805 | + } |
|
806 | + if ($limit) { |
|
807 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
808 | + } else { |
|
809 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
810 | + } |
|
679 | 811 | if ($orderby == 'hour') { |
680 | 812 | /* |
681 | 813 | if ($globalDBdriver == 'mysql') { |
@@ -684,7 +816,9 @@ discard block |
||
684 | 816 | */ |
685 | 817 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
686 | 818 | } |
687 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
819 | + if ($orderby == 'count') { |
|
820 | + $query .= " ORDER BY hour_count DESC"; |
|
821 | + } |
|
688 | 822 | try { |
689 | 823 | $sth = $this->db->prepare($query); |
690 | 824 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -705,8 +839,12 @@ discard block |
||
705 | 839 | |
706 | 840 | public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
707 | 841 | global $globalStatsFilters; |
708 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
709 | - if ($year == '') $year = date('Y'); |
|
842 | + if ($filter_name == '') { |
|
843 | + $filter_name = $this->filter_name; |
|
844 | + } |
|
845 | + if ($year == '') { |
|
846 | + $year = date('Y'); |
|
847 | + } |
|
710 | 848 | $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
711 | 849 | if (empty($all)) { |
712 | 850 | $filters = array('airlines' => array($stats_airline)); |
@@ -720,8 +858,12 @@ discard block |
||
720 | 858 | } |
721 | 859 | public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
722 | 860 | global $globalStatsFilters; |
723 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
724 | - if ($year == '') $year = date('Y'); |
|
861 | + if ($filter_name == '') { |
|
862 | + $filter_name = $this->filter_name; |
|
863 | + } |
|
864 | + if ($year == '') { |
|
865 | + $year = date('Y'); |
|
866 | + } |
|
725 | 867 | $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
726 | 868 | if (empty($all)) { |
727 | 869 | $filters = array(); |
@@ -735,8 +877,12 @@ discard block |
||
735 | 877 | } |
736 | 878 | public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
737 | 879 | global $globalStatsFilters; |
738 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
739 | - if ($year == '') $year = date('Y'); |
|
880 | + if ($filter_name == '') { |
|
881 | + $filter_name = $this->filter_name; |
|
882 | + } |
|
883 | + if ($year == '') { |
|
884 | + $year = date('Y'); |
|
885 | + } |
|
740 | 886 | $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
741 | 887 | if (empty($all)) { |
742 | 888 | $filters = array('airlines' => array($stats_airline)); |
@@ -750,7 +896,9 @@ discard block |
||
750 | 896 | } |
751 | 897 | public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
752 | 898 | global $globalStatsFilters; |
753 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
899 | + if ($filter_name == '') { |
|
900 | + $filter_name = $this->filter_name; |
|
901 | + } |
|
754 | 902 | if ($year == '' && $month == '') { |
755 | 903 | $query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
756 | 904 | try { |
@@ -761,7 +909,9 @@ discard block |
||
761 | 909 | } |
762 | 910 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
763 | 911 | $all = $result[0]['nb']; |
764 | - } else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
912 | + } else { |
|
913 | + $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
914 | + } |
|
765 | 915 | if (empty($all)) { |
766 | 916 | $filters = array('airlines' => array($stats_airline)); |
767 | 917 | if ($filter_name != '') { |
@@ -774,7 +924,9 @@ discard block |
||
774 | 924 | } |
775 | 925 | public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
776 | 926 | global $globalStatsFilters; |
777 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
927 | + if ($filter_name == '') { |
|
928 | + $filter_name = $this->filter_name; |
|
929 | + } |
|
778 | 930 | if ($year == '' && $month == '') { |
779 | 931 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
780 | 932 | try { |
@@ -785,7 +937,9 @@ discard block |
||
785 | 937 | } |
786 | 938 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
787 | 939 | $all = $result[0]['nb_airline']; |
788 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
940 | + } else { |
|
941 | + $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
942 | + } |
|
789 | 943 | if (empty($all)) { |
790 | 944 | $filters = array(); |
791 | 945 | if ($filter_name != '') { |
@@ -798,7 +952,9 @@ discard block |
||
798 | 952 | } |
799 | 953 | public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
800 | 954 | global $globalStatsFilters; |
801 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
955 | + if ($filter_name == '') { |
|
956 | + $filter_name = $this->filter_name; |
|
957 | + } |
|
802 | 958 | if ($year == '' && $month == '') { |
803 | 959 | $query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
804 | 960 | $query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
@@ -825,7 +981,9 @@ discard block |
||
825 | 981 | } |
826 | 982 | public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
827 | 983 | global $globalStatsFilters; |
828 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
984 | + if ($filter_name == '') { |
|
985 | + $filter_name = $this->filter_name; |
|
986 | + } |
|
829 | 987 | //if ($year == '') $year = date('Y'); |
830 | 988 | if ($year == '' && $month == '') { |
831 | 989 | $query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -853,7 +1011,9 @@ discard block |
||
853 | 1011 | } |
854 | 1012 | |
855 | 1013 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
856 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1014 | + if ($filter_name == '') { |
|
1015 | + $filter_name = $this->filter_name; |
|
1016 | + } |
|
857 | 1017 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
858 | 1018 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
859 | 1019 | try { |
@@ -866,7 +1026,9 @@ discard block |
||
866 | 1026 | return $all; |
867 | 1027 | } |
868 | 1028 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
869 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1029 | + if ($filter_name == '') { |
|
1030 | + $filter_name = $this->filter_name; |
|
1031 | + } |
|
870 | 1032 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
871 | 1033 | $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
872 | 1034 | try { |
@@ -879,7 +1041,9 @@ discard block |
||
879 | 1041 | return $all; |
880 | 1042 | } |
881 | 1043 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
882 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1044 | + if ($filter_name == '') { |
|
1045 | + $filter_name = $this->filter_name; |
|
1046 | + } |
|
883 | 1047 | global $globalArchiveMonths, $globalDBdriver; |
884 | 1048 | if ($globalDBdriver == 'mysql') { |
885 | 1049 | if ($month == '') { |
@@ -909,7 +1073,9 @@ discard block |
||
909 | 1073 | } |
910 | 1074 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
911 | 1075 | global $globalArchiveMonths, $globalDBdriver; |
912 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1076 | + if ($filter_name == '') { |
|
1077 | + $filter_name = $this->filter_name; |
|
1078 | + } |
|
913 | 1079 | if ($globalDBdriver == 'mysql') { |
914 | 1080 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
915 | 1081 | } else { |
@@ -927,7 +1093,9 @@ discard block |
||
927 | 1093 | } |
928 | 1094 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
929 | 1095 | global $globalArchiveMonths, $globalDBdriver; |
930 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1096 | + if ($filter_name == '') { |
|
1097 | + $filter_name = $this->filter_name; |
|
1098 | + } |
|
931 | 1099 | if ($globalDBdriver == 'mysql') { |
932 | 1100 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
933 | 1101 | } else { |
@@ -944,7 +1112,9 @@ discard block |
||
944 | 1112 | } |
945 | 1113 | public function getStatsAirlineTotal($filter_name = '') { |
946 | 1114 | global $globalArchiveMonths, $globalDBdriver; |
947 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1115 | + if ($filter_name == '') { |
|
1116 | + $filter_name = $this->filter_name; |
|
1117 | + } |
|
948 | 1118 | if ($globalDBdriver == 'mysql') { |
949 | 1119 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
950 | 1120 | } else { |
@@ -961,7 +1131,9 @@ discard block |
||
961 | 1131 | } |
962 | 1132 | public function getStatsOwnerTotal($filter_name = '') { |
963 | 1133 | global $globalArchiveMonths, $globalDBdriver; |
964 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1134 | + if ($filter_name == '') { |
|
1135 | + $filter_name = $this->filter_name; |
|
1136 | + } |
|
965 | 1137 | if ($globalDBdriver == 'mysql') { |
966 | 1138 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
967 | 1139 | } else { |
@@ -978,7 +1150,9 @@ discard block |
||
978 | 1150 | } |
979 | 1151 | public function getStatsOwner($owner_name,$filter_name = '') { |
980 | 1152 | global $globalArchiveMonths, $globalDBdriver; |
981 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1153 | + if ($filter_name == '') { |
|
1154 | + $filter_name = $this->filter_name; |
|
1155 | + } |
|
982 | 1156 | $query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name"; |
983 | 1157 | try { |
984 | 1158 | $sth = $this->db->prepare($query); |
@@ -987,12 +1161,17 @@ discard block |
||
987 | 1161 | echo "error : ".$e->getMessage(); |
988 | 1162 | } |
989 | 1163 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
990 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
991 | - else return 0; |
|
1164 | + if (isset($all[0]['cnt'])) { |
|
1165 | + return $all[0]['cnt']; |
|
1166 | + } else { |
|
1167 | + return 0; |
|
1168 | + } |
|
992 | 1169 | } |
993 | 1170 | public function getStatsPilotTotal($filter_name = '') { |
994 | 1171 | global $globalArchiveMonths, $globalDBdriver; |
995 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1172 | + if ($filter_name == '') { |
|
1173 | + $filter_name = $this->filter_name; |
|
1174 | + } |
|
996 | 1175 | if ($globalDBdriver == 'mysql') { |
997 | 1176 | $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
998 | 1177 | } else { |
@@ -1009,7 +1188,9 @@ discard block |
||
1009 | 1188 | } |
1010 | 1189 | public function getStatsPilot($pilot,$filter_name = '') { |
1011 | 1190 | global $globalArchiveMonths, $globalDBdriver; |
1012 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1191 | + if ($filter_name == '') { |
|
1192 | + $filter_name = $this->filter_name; |
|
1193 | + } |
|
1013 | 1194 | $query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)"; |
1014 | 1195 | try { |
1015 | 1196 | $sth = $this->db->prepare($query); |
@@ -1018,13 +1199,18 @@ discard block |
||
1018 | 1199 | echo "error : ".$e->getMessage(); |
1019 | 1200 | } |
1020 | 1201 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1021 | - if (isset($all[0]['cnt'])) return $all[0]['cnt']; |
|
1022 | - else return 0; |
|
1202 | + if (isset($all[0]['cnt'])) { |
|
1203 | + return $all[0]['cnt']; |
|
1204 | + } else { |
|
1205 | + return 0; |
|
1206 | + } |
|
1023 | 1207 | } |
1024 | 1208 | |
1025 | 1209 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1026 | 1210 | global $globalDBdriver; |
1027 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1211 | + if ($filter_name == '') { |
|
1212 | + $filter_name = $this->filter_name; |
|
1213 | + } |
|
1028 | 1214 | if ($globalDBdriver == 'mysql') { |
1029 | 1215 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
1030 | 1216 | } else { |
@@ -1040,7 +1226,9 @@ discard block |
||
1040 | 1226 | } |
1041 | 1227 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
1042 | 1228 | global $globalDBdriver; |
1043 | - if ($filter_name == '') $filter_name = $this->filter_name; |
|
1229 | + if ($filter_name == '') { |
|
1230 | + $filter_name = $this->filter_name; |
|
1231 | + } |
|
1044 | 1232 | if ($globalDBdriver == 'mysql') { |
1045 | 1233 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
1046 | 1234 | } else { |
@@ -1426,10 +1614,14 @@ discard block |
||
1426 | 1614 | $Connection = new Connection(); |
1427 | 1615 | date_default_timezone_set('UTC'); |
1428 | 1616 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
1429 | - if ($globalDebug) echo 'Update stats !'."\n"; |
|
1617 | + if ($globalDebug) { |
|
1618 | + echo 'Update stats !'."\n"; |
|
1619 | + } |
|
1430 | 1620 | if (isset($last_update[0]['value'])) { |
1431 | 1621 | $last_update_day = $last_update[0]['value']; |
1432 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
1622 | + } else { |
|
1623 | + $last_update_day = '2012-12-12 12:12:12'; |
|
1624 | + } |
|
1433 | 1625 | $reset = false; |
1434 | 1626 | if ($globalStatsResetYear) { |
1435 | 1627 | $reset = true; |
@@ -1437,42 +1629,60 @@ discard block |
||
1437 | 1629 | } |
1438 | 1630 | $Spotter = new Spotter($this->db); |
1439 | 1631 | |
1440 | - if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
|
1632 | + if ($globalDebug) { |
|
1633 | + echo 'Count all aircraft types...'."\n"; |
|
1634 | + } |
|
1441 | 1635 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1442 | 1636 | foreach ($alldata as $number) { |
1443 | 1637 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
1444 | 1638 | } |
1445 | - if ($globalDebug) echo 'Count all airlines...'."\n"; |
|
1639 | + if ($globalDebug) { |
|
1640 | + echo 'Count all airlines...'."\n"; |
|
1641 | + } |
|
1446 | 1642 | $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
1447 | 1643 | foreach ($alldata as $number) { |
1448 | 1644 | $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
1449 | 1645 | } |
1450 | - if ($globalDebug) echo 'Count all registrations...'."\n"; |
|
1646 | + if ($globalDebug) { |
|
1647 | + echo 'Count all registrations...'."\n"; |
|
1648 | + } |
|
1451 | 1649 | $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
1452 | 1650 | foreach ($alldata as $number) { |
1453 | 1651 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
1454 | 1652 | } |
1455 | - if ($globalDebug) echo 'Count all callsigns...'."\n"; |
|
1653 | + if ($globalDebug) { |
|
1654 | + echo 'Count all callsigns...'."\n"; |
|
1655 | + } |
|
1456 | 1656 | $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
1457 | 1657 | foreach ($alldata as $number) { |
1458 | 1658 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
1459 | 1659 | } |
1460 | - if ($globalDebug) echo 'Count all owners...'."\n"; |
|
1660 | + if ($globalDebug) { |
|
1661 | + echo 'Count all owners...'."\n"; |
|
1662 | + } |
|
1461 | 1663 | $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
1462 | 1664 | foreach ($alldata as $number) { |
1463 | 1665 | $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
1464 | 1666 | } |
1465 | - if ($globalDebug) echo 'Count all pilots...'."\n"; |
|
1667 | + if ($globalDebug) { |
|
1668 | + echo 'Count all pilots...'."\n"; |
|
1669 | + } |
|
1466 | 1670 | $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
1467 | 1671 | foreach ($alldata as $number) { |
1468 | 1672 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
1469 | 1673 | } |
1470 | 1674 | |
1471 | - if ($globalDebug) echo 'Count all departure airports...'."\n"; |
|
1675 | + if ($globalDebug) { |
|
1676 | + echo 'Count all departure airports...'."\n"; |
|
1677 | + } |
|
1472 | 1678 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
1473 | - if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
|
1679 | + if ($globalDebug) { |
|
1680 | + echo 'Count all detected departure airports...'."\n"; |
|
1681 | + } |
|
1474 | 1682 | $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
1475 | - if ($globalDebug) echo 'Order departure airports...'."\n"; |
|
1683 | + if ($globalDebug) { |
|
1684 | + echo 'Order departure airports...'."\n"; |
|
1685 | + } |
|
1476 | 1686 | $alldata = array(); |
1477 | 1687 | |
1478 | 1688 | foreach ($pall as $value) { |
@@ -1483,7 +1693,9 @@ discard block |
||
1483 | 1693 | $icao = $value['airport_departure_icao']; |
1484 | 1694 | if (isset($alldata[$icao])) { |
1485 | 1695 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1486 | - } else $alldata[$icao] = $value; |
|
1696 | + } else { |
|
1697 | + $alldata[$icao] = $value; |
|
1698 | + } |
|
1487 | 1699 | } |
1488 | 1700 | $count = array(); |
1489 | 1701 | foreach ($alldata as $key => $row) { |
@@ -1493,11 +1705,17 @@ discard block |
||
1493 | 1705 | foreach ($alldata as $number) { |
1494 | 1706 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
1495 | 1707 | } |
1496 | - if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
|
1708 | + if ($globalDebug) { |
|
1709 | + echo 'Count all arrival airports...'."\n"; |
|
1710 | + } |
|
1497 | 1711 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
1498 | - if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
|
1712 | + if ($globalDebug) { |
|
1713 | + echo 'Count all detected arrival airports...'."\n"; |
|
1714 | + } |
|
1499 | 1715 | $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
1500 | - if ($globalDebug) echo 'Order arrival airports...'."\n"; |
|
1716 | + if ($globalDebug) { |
|
1717 | + echo 'Order arrival airports...'."\n"; |
|
1718 | + } |
|
1501 | 1719 | $alldata = array(); |
1502 | 1720 | foreach ($pall as $value) { |
1503 | 1721 | $icao = $value['airport_arrival_icao']; |
@@ -1507,7 +1725,9 @@ discard block |
||
1507 | 1725 | $icao = $value['airport_arrival_icao']; |
1508 | 1726 | if (isset($alldata[$icao])) { |
1509 | 1727 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1510 | - } else $alldata[$icao] = $value; |
|
1728 | + } else { |
|
1729 | + $alldata[$icao] = $value; |
|
1730 | + } |
|
1511 | 1731 | } |
1512 | 1732 | $count = array(); |
1513 | 1733 | foreach ($alldata as $key => $row) { |
@@ -1518,7 +1738,9 @@ discard block |
||
1518 | 1738 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
1519 | 1739 | } |
1520 | 1740 | if ($Connection->tableExists('countries')) { |
1521 | - if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
|
1741 | + if ($globalDebug) { |
|
1742 | + echo 'Count all flights by countries...'."\n"; |
|
1743 | + } |
|
1522 | 1744 | $SpotterArchive = new SpotterArchive(); |
1523 | 1745 | $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
1524 | 1746 | foreach ($alldata as $number) { |
@@ -1530,46 +1752,66 @@ discard block |
||
1530 | 1752 | // Add by month using getstat if month finish... |
1531 | 1753 | |
1532 | 1754 | //if (date('m',strtotime($last_update_day)) != date('m')) { |
1533 | - if ($globalDebug) echo 'Count all flights by months...'."\n"; |
|
1755 | + if ($globalDebug) { |
|
1756 | + echo 'Count all flights by months...'."\n"; |
|
1757 | + } |
|
1534 | 1758 | $Spotter = new Spotter($this->db); |
1535 | 1759 | $alldata = $Spotter->countAllMonths(); |
1536 | 1760 | $lastyear = false; |
1537 | 1761 | foreach ($alldata as $number) { |
1538 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1762 | + if ($number['year_name'] != date('Y')) { |
|
1763 | + $lastyear = true; |
|
1764 | + } |
|
1539 | 1765 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1540 | 1766 | } |
1541 | - if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
|
1767 | + if ($globalDebug) { |
|
1768 | + echo 'Count all military flights by months...'."\n"; |
|
1769 | + } |
|
1542 | 1770 | $alldata = $Spotter->countAllMilitaryMonths(); |
1543 | 1771 | foreach ($alldata as $number) { |
1544 | 1772 | $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1545 | 1773 | } |
1546 | - if ($globalDebug) echo 'Count all owners by months...'."\n"; |
|
1774 | + if ($globalDebug) { |
|
1775 | + echo 'Count all owners by months...'."\n"; |
|
1776 | + } |
|
1547 | 1777 | $alldata = $Spotter->countAllMonthsOwners(); |
1548 | 1778 | foreach ($alldata as $number) { |
1549 | 1779 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1550 | 1780 | } |
1551 | - if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
|
1781 | + if ($globalDebug) { |
|
1782 | + echo 'Count all pilots by months...'."\n"; |
|
1783 | + } |
|
1552 | 1784 | $alldata = $Spotter->countAllMonthsPilots(); |
1553 | 1785 | foreach ($alldata as $number) { |
1554 | 1786 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1555 | 1787 | } |
1556 | - if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
|
1788 | + if ($globalDebug) { |
|
1789 | + echo 'Count all airlines by months...'."\n"; |
|
1790 | + } |
|
1557 | 1791 | $alldata = $Spotter->countAllMonthsAirlines(); |
1558 | 1792 | foreach ($alldata as $number) { |
1559 | 1793 | $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1560 | 1794 | } |
1561 | - if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
|
1795 | + if ($globalDebug) { |
|
1796 | + echo 'Count all aircrafts by months...'."\n"; |
|
1797 | + } |
|
1562 | 1798 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1563 | 1799 | foreach ($alldata as $number) { |
1564 | 1800 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1565 | 1801 | } |
1566 | - if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
|
1802 | + if ($globalDebug) { |
|
1803 | + echo 'Count all real arrivals by months...'."\n"; |
|
1804 | + } |
|
1567 | 1805 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1568 | 1806 | foreach ($alldata as $number) { |
1569 | 1807 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1570 | 1808 | } |
1571 | - if ($globalDebug) echo 'Airports data...'."\n"; |
|
1572 | - if ($globalDebug) echo '...Departure'."\n"; |
|
1809 | + if ($globalDebug) { |
|
1810 | + echo 'Airports data...'."\n"; |
|
1811 | + } |
|
1812 | + if ($globalDebug) { |
|
1813 | + echo '...Departure'."\n"; |
|
1814 | + } |
|
1573 | 1815 | $this->deleteStatAirport('daily'); |
1574 | 1816 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1575 | 1817 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
@@ -1690,44 +1932,62 @@ discard block |
||
1690 | 1932 | // Count by airlines |
1691 | 1933 | echo '--- Stats by airlines ---'."\n"; |
1692 | 1934 | if ($Connection->tableExists('countries')) { |
1693 | - if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n"; |
|
1935 | + if ($globalDebug) { |
|
1936 | + echo 'Count all flights by countries by airlines...'."\n"; |
|
1937 | + } |
|
1694 | 1938 | $SpotterArchive = new SpotterArchive(); |
1695 | 1939 | $alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day); |
1696 | 1940 | foreach ($alldata as $number) { |
1697 | 1941 | $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset); |
1698 | 1942 | } |
1699 | 1943 | } |
1700 | - if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
|
1944 | + if ($globalDebug) { |
|
1945 | + echo 'Count all aircraft types by airlines...'."\n"; |
|
1946 | + } |
|
1701 | 1947 | $Spotter = new Spotter($this->db); |
1702 | 1948 | $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
1703 | 1949 | foreach ($alldata as $number) { |
1704 | 1950 | $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
1705 | 1951 | } |
1706 | - if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
|
1952 | + if ($globalDebug) { |
|
1953 | + echo 'Count all aircraft registrations by airlines...'."\n"; |
|
1954 | + } |
|
1707 | 1955 | $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
1708 | 1956 | foreach ($alldata as $number) { |
1709 | 1957 | $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
1710 | 1958 | } |
1711 | - if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
|
1959 | + if ($globalDebug) { |
|
1960 | + echo 'Count all callsigns by airlines...'."\n"; |
|
1961 | + } |
|
1712 | 1962 | $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
1713 | 1963 | foreach ($alldata as $number) { |
1714 | 1964 | $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
1715 | 1965 | } |
1716 | - if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
|
1966 | + if ($globalDebug) { |
|
1967 | + echo 'Count all owners by airlines...'."\n"; |
|
1968 | + } |
|
1717 | 1969 | $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
1718 | 1970 | foreach ($alldata as $number) { |
1719 | 1971 | $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
1720 | 1972 | } |
1721 | - if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
|
1973 | + if ($globalDebug) { |
|
1974 | + echo 'Count all pilots by airlines...'."\n"; |
|
1975 | + } |
|
1722 | 1976 | $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
1723 | 1977 | foreach ($alldata as $number) { |
1724 | 1978 | $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
1725 | 1979 | } |
1726 | - if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
|
1980 | + if ($globalDebug) { |
|
1981 | + echo 'Count all departure airports by airlines...'."\n"; |
|
1982 | + } |
|
1727 | 1983 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
1728 | - if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
|
1984 | + if ($globalDebug) { |
|
1985 | + echo 'Count all detected departure airports by airlines...'."\n"; |
|
1986 | + } |
|
1729 | 1987 | $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
1730 | - if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
|
1988 | + if ($globalDebug) { |
|
1989 | + echo 'Order detected departure airports by airlines...'."\n"; |
|
1990 | + } |
|
1731 | 1991 | //$alldata = array(); |
1732 | 1992 | foreach ($dall as $value) { |
1733 | 1993 | $icao = $value['airport_departure_icao']; |
@@ -1748,11 +2008,17 @@ discard block |
||
1748 | 2008 | foreach ($alldata as $number) { |
1749 | 2009 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
1750 | 2010 | } |
1751 | - if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
|
2011 | + if ($globalDebug) { |
|
2012 | + echo 'Count all arrival airports by airlines...'."\n"; |
|
2013 | + } |
|
1752 | 2014 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
1753 | - if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2015 | + if ($globalDebug) { |
|
2016 | + echo 'Count all detected arrival airports by airlines...'."\n"; |
|
2017 | + } |
|
1754 | 2018 | $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
1755 | - if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
|
2019 | + if ($globalDebug) { |
|
2020 | + echo 'Order arrival airports by airlines...'."\n"; |
|
2021 | + } |
|
1756 | 2022 | //$alldata = array(); |
1757 | 2023 | foreach ($dall as $value) { |
1758 | 2024 | $icao = $value['airport_arrival_icao']; |
@@ -1771,37 +2037,53 @@ discard block |
||
1771 | 2037 | } |
1772 | 2038 | $alldata = $pall; |
1773 | 2039 | foreach ($alldata as $number) { |
1774 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2040 | + if ($number['airline_icao'] != '') { |
|
2041 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
2042 | + } |
|
2043 | + } |
|
2044 | + if ($globalDebug) { |
|
2045 | + echo 'Count all flights by months by airlines...'."\n"; |
|
1775 | 2046 | } |
1776 | - if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
|
1777 | 2047 | $Spotter = new Spotter($this->db); |
1778 | 2048 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1779 | 2049 | $lastyear = false; |
1780 | 2050 | foreach ($alldata as $number) { |
1781 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2051 | + if ($number['year_name'] != date('Y')) { |
|
2052 | + $lastyear = true; |
|
2053 | + } |
|
1782 | 2054 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1783 | 2055 | } |
1784 | - if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
|
2056 | + if ($globalDebug) { |
|
2057 | + echo 'Count all owners by months by airlines...'."\n"; |
|
2058 | + } |
|
1785 | 2059 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1786 | 2060 | foreach ($alldata as $number) { |
1787 | 2061 | $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1788 | 2062 | } |
1789 | - if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
|
2063 | + if ($globalDebug) { |
|
2064 | + echo 'Count all pilots by months by airlines...'."\n"; |
|
2065 | + } |
|
1790 | 2066 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1791 | 2067 | foreach ($alldata as $number) { |
1792 | 2068 | $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1793 | 2069 | } |
1794 | - if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2070 | + if ($globalDebug) { |
|
2071 | + echo 'Count all aircrafts by months by airlines...'."\n"; |
|
2072 | + } |
|
1795 | 2073 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1796 | 2074 | foreach ($alldata as $number) { |
1797 | 2075 | $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1798 | 2076 | } |
1799 | - if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2077 | + if ($globalDebug) { |
|
2078 | + echo 'Count all real arrivals by months by airlines...'."\n"; |
|
2079 | + } |
|
1800 | 2080 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1801 | 2081 | foreach ($alldata as $number) { |
1802 | 2082 | $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1803 | 2083 | } |
1804 | - if ($globalDebug) echo '...Departure'."\n"; |
|
2084 | + if ($globalDebug) { |
|
2085 | + echo '...Departure'."\n"; |
|
2086 | + } |
|
1805 | 2087 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
1806 | 2088 | $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
1807 | 2089 | foreach ($dall as $value) { |
@@ -1824,7 +2106,9 @@ discard block |
||
1824 | 2106 | foreach ($alldata as $number) { |
1825 | 2107 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
1826 | 2108 | } |
1827 | - if ($globalDebug) echo '...Arrival'."\n"; |
|
2109 | + if ($globalDebug) { |
|
2110 | + echo '...Arrival'."\n"; |
|
2111 | + } |
|
1828 | 2112 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
1829 | 2113 | $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
1830 | 2114 | foreach ($dall as $value) { |
@@ -1848,13 +2132,19 @@ discard block |
||
1848 | 2132 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
1849 | 2133 | } |
1850 | 2134 | |
1851 | - if ($globalDebug) echo 'Flights data...'."\n"; |
|
1852 | - if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
|
2135 | + if ($globalDebug) { |
|
2136 | + echo 'Flights data...'."\n"; |
|
2137 | + } |
|
2138 | + if ($globalDebug) { |
|
2139 | + echo '-> countAllDatesLastMonth...'."\n"; |
|
2140 | + } |
|
1853 | 2141 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1854 | 2142 | foreach ($alldata as $number) { |
1855 | 2143 | $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
1856 | 2144 | } |
1857 | - if ($globalDebug) echo '-> countAllDates...'."\n"; |
|
2145 | + if ($globalDebug) { |
|
2146 | + echo '-> countAllDates...'."\n"; |
|
2147 | + } |
|
1858 | 2148 | //$previousdata = $this->countAllDatesByAirlines(); |
1859 | 2149 | $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
1860 | 2150 | $values = array(); |
@@ -1867,7 +2157,9 @@ discard block |
||
1867 | 2157 | $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
1868 | 2158 | } |
1869 | 2159 | |
1870 | - if ($globalDebug) echo '-> countAllHours...'."\n"; |
|
2160 | + if ($globalDebug) { |
|
2161 | + echo '-> countAllHours...'."\n"; |
|
2162 | + } |
|
1871 | 2163 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1872 | 2164 | foreach ($alldata as $number) { |
1873 | 2165 | $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
@@ -1875,7 +2167,9 @@ discard block |
||
1875 | 2167 | |
1876 | 2168 | |
1877 | 2169 | // Stats by filters |
1878 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
2170 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
2171 | + $globalStatsFilters = array(); |
|
2172 | + } |
|
1879 | 2173 | foreach ($globalStatsFilters as $name => $filter) { |
1880 | 2174 | //$filter_name = $filter['name']; |
1881 | 2175 | $filter_name = $name; |
@@ -1883,11 +2177,15 @@ discard block |
||
1883 | 2177 | $last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name); |
1884 | 2178 | if (isset($last_update[0]['value'])) { |
1885 | 2179 | $last_update_day = $last_update[0]['value']; |
1886 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
2180 | + } else { |
|
2181 | + $last_update_day = '2012-12-12 12:12:12'; |
|
2182 | + } |
|
1887 | 2183 | $reset = false; |
1888 | 2184 | |
1889 | 2185 | // Count by filter |
1890 | - if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2186 | + if ($globalDebug) { |
|
2187 | + echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
|
2188 | + } |
|
1891 | 2189 | $Spotter = new Spotter($this->db); |
1892 | 2190 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
1893 | 2191 | foreach ($alldata as $number) { |
@@ -1924,7 +2222,9 @@ discard block |
||
1924 | 2222 | $icao = $value['airport_departure_icao']; |
1925 | 2223 | if (isset($alldata[$icao])) { |
1926 | 2224 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1927 | - } else $alldata[$icao] = $value; |
|
2225 | + } else { |
|
2226 | + $alldata[$icao] = $value; |
|
2227 | + } |
|
1928 | 2228 | } |
1929 | 2229 | $count = array(); |
1930 | 2230 | foreach ($alldata as $key => $row) { |
@@ -1945,7 +2245,9 @@ discard block |
||
1945 | 2245 | $icao = $value['airport_arrival_icao']; |
1946 | 2246 | if (isset($alldata[$icao])) { |
1947 | 2247 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1948 | - } else $alldata[$icao] = $value; |
|
2248 | + } else { |
|
2249 | + $alldata[$icao] = $value; |
|
2250 | + } |
|
1949 | 2251 | } |
1950 | 2252 | $count = array(); |
1951 | 2253 | foreach ($alldata as $key => $row) { |
@@ -1959,7 +2261,9 @@ discard block |
||
1959 | 2261 | $alldata = $Spotter->countAllMonths($filter); |
1960 | 2262 | $lastyear = false; |
1961 | 2263 | foreach ($alldata as $number) { |
1962 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
2264 | + if ($number['year_name'] != date('Y')) { |
|
2265 | + $lastyear = true; |
|
2266 | + } |
|
1963 | 2267 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
1964 | 2268 | } |
1965 | 2269 | $alldata = $Spotter->countAllMonthsOwners($filter); |