Completed
Push — master ( e0ac49...7ff500 )
by Yannick
08:01
created
statistics.php 1 patch
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40 40
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 41
 	}
42
-    ?>
42
+	?>
43 43
     </div>
44 44
     <?php    
45 45
 	// print_r($Stats->getAllAirlineNames()); 
46
-    ?>
46
+	?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <div class="row global-stats">
49 49
         <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> 
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> 
52 52
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53 53
 	<?php
54
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
54
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56 56
     	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> 
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> 
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> 
67 67
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
68 68
         <?php
69
-    		if ($airline_icao == '') {
70
-    	?>
69
+			if ($airline_icao == '') {
70
+		?>
71 71
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div>
72 72
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
73 73
 	<?php
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
91
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
+			if (count($aircraft_array) == 0) print _("No data available");
93
+			else {
94 94
 
95
-                    print '<div id="chart1" class="chart" width="100%"></div>
95
+					print '<div id="chart1" class="chart" width="100%"></div>
96 96
                     <script> 
97 97
                         google.load("visualization", "1", {packages:["corechart"]});
98 98
                       google.setOnLoadCallback(drawChart1);
99 99
                       function drawChart1() {
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102
-                            $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
104
-                                    {
105
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
-                                    }
107
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
108
-                                    print $aircraft_data;
109
-                        print ']);
102
+							$aircraft_data = '';
103
+						  foreach($aircraft_array as $aircraft_item)
104
+									{
105
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
+									}
107
+									$aircraft_data = substr($aircraft_data, 0, -1);
108
+									print $aircraft_data;
109
+						print ']);
110 110
 
111 111
                         var options = {
112 112
                             chartArea: {"width": "80%", "height": "60%"},
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                               drawChart1();
122 122
                             });
123 123
                   </script>';
124
-                  }
125
-                  ?>
124
+				  }
125
+				  ?>
126 126
                 <div class="more">
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133
-    if ($airline_icao == '' || $airline_icao == 'all') {
133
+	if ($airline_icao == '' || $airline_icao == 'all') {
134 134
 ?>
135 135
             <div class="col-md-6">
136 136
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 137
                  <?php
138
-                  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
-		    if (count($airline_array) == 0) print _("No data available");
140
-		    else {
138
+				  $airline_array = $Stats->countAllAirlines(true,$filter_name);
139
+			if (count($airline_array) == 0) print _("No data available");
140
+			else {
141 141
 
142
-                  print '<div id="chart2" class="chart" width="100%"></div>
142
+				  print '<div id="chart2" class="chart" width="100%"></div>
143 143
                     <script> 
144 144
                         google.load("visualization", "1", {packages:["corechart"]});
145 145
                       google.setOnLoadCallback(drawChart2);
146 146
                       function drawChart2() {
147 147
                         var data = google.visualization.arrayToDataTable([
148 148
                             ["'._("Airline").'", "'._("# of times").'"], ';
149
-                            $airline_data = '';
150
-                          foreach($airline_array as $airline_item)
151
-                                    {
152
-                                            $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
-                                    }
154
-                                    $airline_data = substr($airline_data, 0, -1);
155
-                                    print $airline_data;
156
-                        print ']);
149
+							$airline_data = '';
150
+						  foreach($airline_array as $airline_item)
151
+									{
152
+											$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153
+									}
154
+									$airline_data = substr($airline_data, 0, -1);
155
+									print $airline_data;
156
+						print ']);
157 157
 
158 158
                         var options = {
159 159
                             chartArea: {"width": "80%", "height": "60%"},
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
                               drawChart2();
169 169
                             });
170 170
                   </script>';
171
-                  }
172
-                  ?>
171
+				  }
172
+				  ?>
173 173
                 <div class="more">
174 174
                     <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
175 175
                 </div>
@@ -177,44 +177,44 @@  discard block
 block discarded – undo
177 177
         </div>
178 178
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
179 179
 <?php
180
-    }
180
+	}
181 181
 ?>
182 182
         <div class="row column">
183 183
 
184 184
 	    <?php
185
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
185
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
186 186
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
187
-		    if (empty($flightover_array)) {
188
-	    ?>
187
+			if (empty($flightover_array)) {
188
+		?>
189 189
             <div class="col-md-12">
190 190
             <?php
191
-        	    } else {
192
-            ?>
191
+				} else {
192
+			?>
193 193
             <div class="col-md-6">
194 194
             <?php
195
-            	    }
196
-            ?>
195
+					}
196
+			?>
197 197
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 198
                  <?php
199
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
-		    if (count($pilot_array) == 0) print _("No data available");
201
-		    else {
199
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
200
+			if (count($pilot_array) == 0) print _("No data available");
201
+			else {
202 202
 
203
-                  print '<div id="chart7" class="chart" width="100%"></div>
203
+				  print '<div id="chart7" class="chart" width="100%"></div>
204 204
                     <script> 
205 205
                         google.load("visualization", "1", {packages:["corechart"]});
206 206
                       google.setOnLoadCallback(drawChart7);
207 207
                       function drawChart7() {
208 208
                         var data = google.visualization.arrayToDataTable([
209 209
                             ["'._("Pilots").'", "'._("# of times").'"], ';
210
-                            $pilot_data = '';
211
-                          foreach($pilot_array as $pilot_item)
212
-                                    {
213
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
-                                    }
215
-                                    $pilot_data = substr($pilot_data, 0, -1);
216
-                                    print $pilot_data;
217
-                        print ']);
210
+							$pilot_data = '';
211
+						  foreach($pilot_array as $pilot_item)
212
+									{
213
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214
+									}
215
+									$pilot_data = substr($pilot_data, 0, -1);
216
+									print $pilot_data;
217
+						print ']);
218 218
 
219 219
                         var options = {
220 220
                             chartArea: {"width": "80%", "height": "60%"},
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
                               drawChart7();
230 230
                             });
231 231
                   </script>';
232
-                  }
233
-                  ?>
232
+				  }
233
+				  ?>
234 234
                 <div class="more">
235 235
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
236 236
                 </div>
@@ -238,30 +238,30 @@  discard block
 block discarded – undo
238 238
         
239 239
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
240 240
         <?php
241
-    	    } else {
242
-    	?>
241
+			} else {
242
+		?>
243 243
             <div class="col-md-6">
244 244
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 245
                  <?php
246
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
-		    if (count($owner_array) == 0) print _("No data available");
248
-		    else {
246
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
247
+			if (count($owner_array) == 0) print _("No data available");
248
+			else {
249 249
 
250
-                  print '<div id="chart7" class="chart" width="100%"></div>
250
+				  print '<div id="chart7" class="chart" width="100%"></div>
251 251
                     <script> 
252 252
                         google.load("visualization", "1", {packages:["corechart"]});
253 253
                       google.setOnLoadCallback(drawChart7);
254 254
                       function drawChart7() {
255 255
                         var data = google.visualization.arrayToDataTable([
256 256
                             ["'._("Owner").'", "'._("# of times").'"], ';
257
-                            $owner_data = '';
258
-                          foreach($owner_array as $owner_item)
259
-                                    {
260
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
-                                    }
262
-                                    $owner_data = substr($owner_data, 0, -1);
263
-                                    print $owner_data;
264
-                        print ']);
257
+							$owner_data = '';
258
+						  foreach($owner_array as $owner_item)
259
+									{
260
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261
+									}
262
+									$owner_data = substr($owner_data, 0, -1);
263
+									print $owner_data;
264
+						print ']);
265 265
 
266 266
                         var options = {
267 267
                             chartArea: {"width": "80%", "height": "60%"},
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
                               drawChart7();
277 277
                             });
278 278
                   </script>';
279
-                  }
280
-                  ?>
279
+				  }
280
+				  ?>
281 281
                 <div class="more">
282 282
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
283 283
                 </div>
@@ -285,32 +285,32 @@  discard block
 block discarded – undo
285 285
         
286 286
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
287 287
         <?php
288
-    	    }
289
-    	    if (!empty($flightover_array)) {
290
-    	?>
288
+			}
289
+			if (!empty($flightover_array)) {
290
+		?>
291 291
     	
292 292
             <div class="col-md-6">
293 293
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
294 294
                  <?php
295
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
296
-		    if (count($flightover_array) == 0) print _("No data available");
297
-		    else {
295
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
296
+			if (count($flightover_array) == 0) print _("No data available");
297
+			else {
298 298
 
299
-                  print '<div id="chart10" class="chart" width="100%"></div>
299
+				  print '<div id="chart10" class="chart" width="100%"></div>
300 300
                     <script> 
301 301
                         google.load("visualization", "1", {packages:["corechart"]});
302 302
                       google.setOnLoadCallback(drawChart10);
303 303
                       function drawChart10() {
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306
-                            $flightover_data = '';
307
-                          foreach($flightover_array as $flightover_item)
308
-                                    {
309
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
-                                    }
311
-                                    $flightover_data = substr($flightover_data, 0, -1);
312
-                                    print $flightover_data;
313
-                        print ']);
306
+							$flightover_data = '';
307
+						  foreach($flightover_array as $flightover_item)
308
+									{
309
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
+									}
311
+									$flightover_data = substr($flightover_data, 0, -1);
312
+									print $flightover_data;
313
+						print ']);
314 314
 
315 315
                         var options = {
316 316
                             chartArea: {"width": "80%", "height": "60%"},
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
                               drawChart10();
328 328
                             });
329 329
                   </script>';
330
-                  }
331
-                  ?>
330
+				  }
331
+				  ?>
332 332
                 <div class="more">
333 333
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
334 334
                 </div>
335 335
             </div>
336 336
         <?php
337
-            }
338
-        ?>
337
+			}
338
+		?>
339 339
         </div>
340 340
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
341 341
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
             <div class="col-md-6">
346 346
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 347
                 <?php
348
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
-		    if (count($airport_airport_array) == 0) print _("No data available");
350
-		    else {
348
+				$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
349
+			if (count($airport_airport_array) == 0) print _("No data available");
350
+			else {
351 351
 
352
-                 print '<div id="chart3" class="chart" width="100%"></div>
352
+				 print '<div id="chart3" class="chart" width="100%"></div>
353 353
                 <script>
354 354
                 google.load("visualization", "1", {packages:["geochart"]});
355 355
                 google.setOnLoadCallback(drawCharts3);
@@ -360,17 +360,17 @@  discard block
 block discarded – undo
360 360
 
361 361
                 var data = google.visualization.arrayToDataTable([ 
362 362
                     ["'._("Airport").'", "'._("# of times").'"],';
363
-                    $airport_data = '';
364
-                  foreach($airport_airport_array as $airport_item)
365
-                        {
366
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
-                            $name = str_replace("'", "", $name);
368
-                            $name = str_replace('"', "", $name);
369
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
-                        }
371
-                        $airport_data = substr($airport_data, 0, -1);
372
-                        print $airport_data;
373
-                print ']);
363
+					$airport_data = '';
364
+				  foreach($airport_airport_array as $airport_item)
365
+						{
366
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367
+							$name = str_replace("'", "", $name);
368
+							$name = str_replace('"', "", $name);
369
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
370
+						}
371
+						$airport_data = substr($airport_data, 0, -1);
372
+						print $airport_data;
373
+				print ']);
374 374
 
375 375
                 var options = {
376 376
                     legend: {position: "none"},
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
                 chart.draw(data, options);
385 385
               }
386 386
                 </script>';
387
-                }
388
-              ?>
387
+				}
388
+			  ?>
389 389
               <div class="more">
390 390
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
391 391
               </div>
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
             <div class="col-md-6">
396 396
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 397
                 <?php
398
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
-		    if (count($airport_airport_array2) == 0) print _("No data available");
400
-		    else {
398
+				$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
399
+			if (count($airport_airport_array2) == 0) print _("No data available");
400
+			else {
401 401
 
402
-                print '<div id="chart4" class="chart" width="100%"></div>
402
+				print '<div id="chart4" class="chart" width="100%"></div>
403 403
                 <script>
404 404
                 google.load("visualization", "1", {packages:["geochart"]});
405 405
                 google.setOnLoadCallback(drawCharts4);
@@ -410,17 +410,17 @@  discard block
 block discarded – undo
410 410
 
411 411
                 var data = google.visualization.arrayToDataTable([ 
412 412
                     ["'._("Airport").'", "'._("# of times").'"],';
413
-                    $airport_data2 = '';
414
-                  foreach($airport_airport_array2 as $airport_item2)
415
-                        {
416
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
-                            $name2 = str_replace("'", "", $name2);
418
-                            $name2 = str_replace('"', "", $name2);
419
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
-                        }
421
-                        $airport_data2 = substr($airport_data2, 0, -1);
422
-                        print $airport_data2;
423
-                print ']);
413
+					$airport_data2 = '';
414
+				  foreach($airport_airport_array2 as $airport_item2)
415
+						{
416
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417
+							$name2 = str_replace("'", "", $name2);
418
+							$name2 = str_replace('"', "", $name2);
419
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
420
+						}
421
+						$airport_data2 = substr($airport_data2, 0, -1);
422
+						print $airport_data2;
423
+				print ']);
424 424
 
425 425
                 var options = {
426 426
                     legend: {position: "none"},
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
                 chart.draw(data, options);
435 435
               }
436 436
                 </script>';
437
-                }
438
-              ?>
437
+				}
438
+			  ?>
439 439
               <div class="more">
440 440
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
441 441
               </div>
@@ -447,24 +447,24 @@  discard block
 block discarded – undo
447 447
             <div class="col-md-6">
448 448
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 449
                 <?php
450
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
-		    if (count($year_array) == 0) print _("No data available");
452
-		    else {
453
-                  print '<div id="chart8" class="chart" width="100%"></div>
450
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
451
+			if (count($year_array) == 0) print _("No data available");
452
+			else {
453
+				  print '<div id="chart8" class="chart" width="100%"></div>
454 454
                     <script> 
455 455
                         google.load("visualization", "1", {packages:["corechart"]});
456 456
                       google.setOnLoadCallback(drawChart8);
457 457
                       function drawChart8() {
458 458
                         var data = google.visualization.arrayToDataTable([
459 459
                             ["'._("Month").'", "'._("# of Flights").'"], ';
460
-                            $year_data = '';
461
-                          foreach($year_array as $year_item)
462
-                                    {
463
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
-                                    }
465
-                                    $year_data = substr($year_data, 0, -1);
466
-                                    print $year_data;
467
-                        print ']);
460
+							$year_data = '';
461
+						  foreach($year_array as $year_item)
462
+									{
463
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464
+									}
465
+									$year_data = substr($year_data, 0, -1);
466
+									print $year_data;
467
+						print ']);
468 468
 
469 469
                         var options = {
470 470
                             legend: {position: "none"},
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
                               drawChart8();
483 483
                             });
484 484
                   </script>';
485
-                  }
486
-                  ?>
485
+				  }
486
+				  ?>
487 487
                 <div class="more">
488 488
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
489 489
                 </div>
@@ -493,24 +493,24 @@  discard block
 block discarded – undo
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 495
                 <?php
496
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
-		    if (count($month_array) == 0) print _("No data available");
498
-		    else {
499
-                  print '<div id="chart9" class="chart" width="100%"></div>
496
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
497
+			if (count($month_array) == 0) print _("No data available");
498
+			else {
499
+				  print '<div id="chart9" class="chart" width="100%"></div>
500 500
                     <script> 
501 501
                         google.load("visualization", "1", {packages:["corechart"]});
502 502
                       google.setOnLoadCallback(drawChart9);
503 503
                       function drawChart9() {
504 504
                         var data = google.visualization.arrayToDataTable([
505 505
                             ["'._("Day").'", "'._("# of Flights").'"], ';
506
-                            $month_data = '';
507
-                          foreach($month_array as $month_item)
508
-                                    {
509
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
-                                    }
511
-                                    $month_data = substr($month_data, 0, -1);
512
-                                    print $month_data;
513
-                        print ']);
506
+							$month_data = '';
507
+						  foreach($month_array as $month_item)
508
+									{
509
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510
+									}
511
+									$month_data = substr($month_data, 0, -1);
512
+									print $month_data;
513
+						print ']);
514 514
 
515 515
                         var options = {
516 516
                             legend: {position: "none"},
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
                               drawChart9();
529 529
                             });
530 530
                   </script>';
531
-                  }
532
-                  ?>
531
+				  }
532
+				  ?>
533 533
                 <div class="more">
534 534
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
535 535
                 </div>
@@ -539,25 +539,25 @@  discard block
 block discarded – undo
539 539
             <div class="col-md-6">
540 540
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 541
                 <?php
542
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
-		    if (empty($date_array)) print _("No data available");
544
-		    else {
545
-                  print '<div id="chart5" class="chart" width="100%"></div>
542
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
543
+			if (empty($date_array)) print _("No data available");
544
+			else {
545
+				  print '<div id="chart5" class="chart" width="100%"></div>
546 546
                     <script> 
547 547
                         google.load("visualization", "1", {packages:["corechart"]});
548 548
                       google.setOnLoadCallback(drawChart5);
549 549
                       function drawChart5() {
550 550
                         var data = google.visualization.arrayToDataTable([
551 551
                             ["'._("Date").'", "'._("# of Flights").'"], ';
552
-                            $date_data = '';
552
+							$date_data = '';
553 553
                         
554
-                          foreach($date_array as $date_item)
555
-                                    {
556
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
-                                    }
558
-                                    $date_data = substr($date_data, 0, -1);
559
-                                    print $date_data;
560
-                        print ']);
554
+						  foreach($date_array as $date_item)
555
+									{
556
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557
+									}
558
+									$date_data = substr($date_data, 0, -1);
559
+									print $date_data;
560
+						print ']);
561 561
 
562 562
                         var options = {
563 563
                             legend: {position: "none"},
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
                               drawChart5();
576 576
                             });
577 577
                   </script>';
578
-                  }
579
-                  ?>
578
+				  }
579
+				  ?>
580 580
                 <div class="more">
581 581
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582 582
                 </div>
@@ -586,25 +586,25 @@  discard block
 block discarded – undo
586 586
             <div class="col-md-6">
587 587
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 588
                 <?php
589
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
-		    if (empty($hour_array)) print _("No data available");
591
-		    else {
589
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
590
+			if (empty($hour_array)) print _("No data available");
591
+			else {
592 592
 
593
-                  print '<div id="chart6" class="chart" width="100%"></div>
593
+				  print '<div id="chart6" class="chart" width="100%"></div>
594 594
                     <script> 
595 595
                         google.load("visualization", "1", {packages:["corechart"]});
596 596
                       google.setOnLoadCallback(drawChart6);
597 597
                       function drawChart6() {
598 598
                         var data = google.visualization.arrayToDataTable([
599 599
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
600
-                            $hour_data = '';
601
-                          foreach($hour_array as $hour_item)
602
-                                    {
603
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
-                                    }
605
-                                    $hour_data = substr($hour_data, 0, -1);
606
-                                    print $hour_data;
607
-                        print ']);
600
+							$hour_data = '';
601
+						  foreach($hour_array as $hour_item)
602
+									{
603
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604
+									}
605
+									$hour_data = substr($hour_data, 0, -1);
606
+									print $hour_data;
607
+						print ']);
608 608
 
609 609
                         var options = {
610 610
                             legend: {position: "none"},
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
                               drawChart6();
623 623
                             });
624 624
                   </script>';
625
-                  }
626
-                ?>
625
+				  }
626
+				?>
627 627
                 <div class="more">
628 628
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
629 629
                 </div>
@@ -631,21 +631,21 @@  discard block
 block discarded – undo
631 631
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
632 632
         </div>
633 633
 <?php
634
-    if ($airline_icao == '' && $filter_name == '') {
634
+	if ($airline_icao == '' && $filter_name == '') {
635 635
 ?>
636 636
         <div class="row column">
637 637
         	<?php
638
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
-        	    if (!empty($polar)) {
640
-            		print '<h2>'._("Coverage pattern").'</h2>';
641
-        		foreach ($polar as $eachpolar) {
642
-        		    unset($polar_data);
643
-	        	    $Spotter = new Spotter();
644
-        		    $data = json_decode($eachpolar['source_data']);
645
-        		    foreach($data as $value => $key) {
646
-        			$direction = $Spotter->parseDirection(($value*22.5));
647
-        			$distance = $key;
648
-        			$unit = 'km';
638
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
639
+				if (!empty($polar)) {
640
+					print '<h2>'._("Coverage pattern").'</h2>';
641
+				foreach ($polar as $eachpolar) {
642
+					unset($polar_data);
643
+					$Spotter = new Spotter();
644
+					$data = json_decode($eachpolar['source_data']);
645
+					foreach($data as $value => $key) {
646
+					$direction = $Spotter->parseDirection(($value*22.5));
647
+					$distance = $key;
648
+					$unit = 'km';
649 649
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
650 650
 					$distance = round($distance*0.539957);
651 651
 					$unit = 'nm';
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
 					$distance = $distance;
657 657
 					$unit = 'km';
658 658
 				}
659
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
-        		    }
662
-        	?>
659
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
660
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
661
+					}
662
+			?>
663 663
             <div class="col-md-6">
664 664
                 <h4><?php print $eachpolar['source_name']; ?></h4>
665 665
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -691,22 +691,22 @@  discard block
 block discarded – undo
691 691
 		</script>
692 692
             </div>
693 693
             <?php
694
-        	    }
695
-        	}
696
-            ?>
694
+				}
695
+			}
696
+			?>
697 697
         </div>
698 698
         <div class="row column">
699 699
             <div class="col-md-6">
700 700
         	<?php
701
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
-        	    if (!empty($msg)) {
703
-            		print '<h2>'._("Messages received").'</h2>';
704
-        		foreach ($msg as $eachmsg) {
705
-        		    //$eachmsg = $msg[0];
706
-        		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
708
-        		    else $max = 500;
709
-        	?>
701
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
702
+				if (!empty($msg)) {
703
+					print '<h2>'._("Messages received").'</h2>';
704
+				foreach ($msg as $eachmsg) {
705
+					//$eachmsg = $msg[0];
706
+					$data = $eachmsg['source_data'];
707
+					if ($data > 500) $max = (round(($data+100)/100))*100;
708
+					else $max = 500;
709
+			?>
710 710
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 711
         	<script>
712 712
 		      var g = new JustGage({
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
 			  });
723 723
 		</script>
724 724
             <?php
725
-        	   }
726
-        	}
727
-            ?>
725
+			   }
726
+			}
727
+			?>
728 728
             </div>
729 729
         </div>
730 730
         <div class="row column">
@@ -751,19 +751,19 @@  discard block
 block discarded – undo
751 751
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
752 752
 			}
753 753
 			$hist_data = substr($hist_data, 0, -1);
754
-            ?>
754
+			?>
755 755
             <div class="col-md-6">
756 756
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
757 757
                 <?php
758
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
758
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
759 759
                     <script> 
760 760
                         google.load("visualization", "1", {packages:["corechart"]});
761 761
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
762 762
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
763 763
                         var data = google.visualization.arrayToDataTable([
764 764
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
765
-                            print $hist_data;
766
-                        print ']);
765
+							print $hist_data;
766
+						print ']);
767 767
 
768 768
                         var options = {
769 769
                             legend: {position: "none"},
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
782 782
                             });
783 783
                   </script>';
784
-        	?>
784
+			?>
785 785
     	    </div>
786 786
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
787 787
         	<?php
788
-                  }
789
-                ?>
788
+				  }
789
+				?>
790 790
         </div>
791 791
 <?php
792
-    }
792
+	}
793 793
 ?>
794 794
     </div>
795 795
 </div>  
Please login to merge, or discard this patch.