Completed
Push — master ( d652ce...4d5be8 )
by Yannick
23:18
created
statistics.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 }
20 20
 
21 21
 if (!isset($filter_name)) $filter_name = '';
22
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
23 23
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
24 24
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	$title = _("Statistics");
35 35
 }
36 36
 
37
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
37
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
38
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
39 39
 
40 40
 require_once('header.php');
41 41
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			date_default_timezone_set('UTC');
63 63
 			$lastupdate = strtotime($last_update[0]['value']);
64 64
 			if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
65
-			print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
65
+			print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
66 66
 		}
67 67
 	}
68 68
 ?>
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
 <?php
77 77
 	if ($type == 'aircraft') {
78 78
 ?>
79
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
80
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
81
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
79
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
80
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
83 83
 	<?php
84
-	    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
84
+	    if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
85 85
 	?>
86
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
87
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
86
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
87
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
88 88
         <?php
89 89
     	    } else {
90 90
     	?>
91
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
92
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
91
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
92
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
93 93
     	<?php
94 94
     	    }
95 95
     	?>
96
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
98 98
         <?php
99 99
     		if ($airline_icao == '') {
100 100
     	?>
101
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
102
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
101
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
102
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
103 103
 	<?php
104 104
 		}
105 105
 	?>
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
108 108
 			if ($airline_icao == '' || $airline_icao == 'all') {
109 109
 	?>
110
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
111
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
110
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
111
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
112 112
 	<?php
113 113
 			}
114 114
 		}
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 <?php
117 117
 	} elseif ($type == 'marine') {
118 118
 ?>
119
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
120
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
119
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
120
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
121 121
 <?php
122 122
 	} elseif ($type == 'tracker') {
123 123
 ?>
124
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
125
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
124
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
125
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
126 126
 <?php
127 127
 	}
128 128
 ?>
129 129
     </p>
130
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
131 131
     <div class="specific-stats">
132 132
 <?php
133 133
 	if ($type == 'aircraft') {
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
             <div class="col-md-6">
137 137
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 138
                  <?php
139
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
139
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
140 140
 		    if (count($aircraft_array) == 0) print _("No data available");
141 141
 		    else {
142 142
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
143 143
                     $aircraft_data = '';
144
-                    foreach($aircraft_array as $aircraft_item)
144
+                    foreach ($aircraft_array as $aircraft_item)
145 145
                     {
146 146
                         $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147 147
                     }
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
             	    ?>
171 171
                 </div>
172 172
             </div>
173
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
173
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
174 174
 <?php
175 175
 //    echo $airline_icao;
176 176
 		if ($airline_icao == '' || $airline_icao == 'all') {
177
-			$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
177
+			$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
178 178
 			if (count($airline_array) > 0) {
179 179
 				print '<div class="col-md-6">';
180 180
 				print '<h2>'._("Top 10 Most Common Airline").'</h2>';
181 181
 				print '<div id="chart2" class="chart" width="100%"></div><script>';
182 182
 				$airline_data = '';
183
-				foreach($airline_array as $airline_item)
183
+				foreach ($airline_array as $airline_item)
184 184
 				{
185 185
 					$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
186 186
 				}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			}
207 207
 ?>
208 208
         </div>
209
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
209
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
210 210
 <?php
211 211
 		}
212 212
 ?>
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 ?>
219 219
         <div class="row column">
220 220
 <?php
221
-		$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
222
-		if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
221
+		$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
222
+		if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
223 223
 			if (empty($flightover_array)) {
224 224
 				print '<div class="col-md-12">';
225 225
 			} else {
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
 ?>
229 229
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
230 230
 <?php
231
-			$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
231
+			$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
232 232
 			if (count($pilot_array) == 0) print _("No data available");
233 233
 			else {
234 234
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
235 235
 				$pilot_data = '';
236
-				foreach($pilot_array as $pilot_item)
236
+				foreach ($pilot_array as $pilot_item)
237 237
 				{
238 238
 					$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
239 239
 				}
@@ -255,19 +255,19 @@  discard block
 block discarded – undo
255 255
 ?>
256 256
             </div>
257 257
         
258
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
258
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
259 259
 <?php
260 260
 		} else {
261 261
 ?>
262 262
             <div class="col-md-6">
263 263
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
264 264
 <?php
265
-			$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
265
+			$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
266 266
 			if (count($owner_array) == 0) print _("No data available");
267 267
 			else {
268 268
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
269 269
 				$owner_data = '';
270
-				foreach($owner_array as $owner_item)
270
+				foreach ($owner_array as $owner_item)
271 271
 				{
272 272
 					$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
273 273
 				}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
                 </div>
288 288
             </div>
289 289
         
290
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
290
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
291 291
 <?php
292 292
 		}
293 293
 		if (!empty($flightover_array)) {
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 				print '<div id="chart10" class="chart" width="100%"></div><script>';
302 302
 				print 'var series = [';
303 303
 				$flightover_data = '';
304
-				foreach($flightover_array as $flightover_item)
304
+				foreach ($flightover_array as $flightover_item)
305 305
 				{
306 306
 					$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
307 307
 				}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		}
348 348
 ?>
349 349
         </div>
350
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
350
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
351 351
 
352 352
     	
353 353
         </div>
@@ -358,14 +358,14 @@  discard block
 block discarded – undo
358 358
         <div class="row column">
359 359
             <div class="col-md-6">
360 360
 <?php
361
-		$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
361
+		$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
362 362
 		if (count($airport_airport_array) > 0) {
363 363
 			print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
364 364
 			print '<div id="chart3" class="chart" width="100%"></div><script>';
365 365
 			print "\n";
366 366
 			print 'var series = [';
367 367
 			$airport_data = '';
368
-			foreach($airport_airport_array as $airport_item)
368
+			foreach ($airport_airport_array as $airport_item)
369 369
 			{
370 370
 				$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
371 371
 			}
@@ -416,18 +416,18 @@  discard block
 block discarded – undo
416 416
 		}
417 417
 ?>
418 418
             </div>
419
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
419
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
420 420
 
421 421
             <div class="col-md-6">
422 422
 <?php
423
-		$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
423
+		$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
424 424
 		if (count($airport_airport_array2) > 0) {
425 425
 			print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
426 426
 			print '<div id="chart4" class="chart" width="100%"></div><script>';
427 427
 			print "\n";
428 428
 			print 'var series = [';
429 429
 			$airport_data = '';
430
-			foreach($airport_airport_array2 as $airport_item)
430
+			foreach ($airport_airport_array2 as $airport_item)
431 431
 			{
432 432
 				$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
433 433
 			}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 ?>
480 480
             </div>
481 481
         </div>
482
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
482
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
483 483
 <?php 
484 484
 	}
485 485
 ?>
@@ -493,19 +493,19 @@  discard block
 block discarded – undo
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
495 495
 <?php
496
-			$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
496
+			$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
497 497
 			if (count($year_array) == 0) print _("No data available");
498 498
 			else {
499 499
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
500 500
 				$year_data = '';
501 501
 				$year_cnt = '';
502
-				foreach($year_array as $year_item)
502
+				foreach ($year_array as $year_item)
503 503
 				{
504 504
 					$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
505 505
 					$year_cnt .= $year_item['date_count'].',';
506 506
 				}
507 507
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
508
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
508
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
509 509
 				print 'c3.generate({
510 510
 				    bindto: "#chart8",
511 511
 				    data: { x: "x",
@@ -518,23 +518,23 @@  discard block
 block discarded – undo
518 518
                     <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"); ?>&raquo;</a>
519 519
                 </div>
520 520
             </div>
521
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
521
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
522 522
             <div class="col-md-6">
523 523
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
524 524
 <?php
525
-			$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
525
+			$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
526 526
 			if (count($month_array) == 0) print _("No data available");
527 527
 			else {
528 528
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
529 529
 				$month_data = '';
530 530
 				$month_cnt = '';
531
-				foreach($month_array as $month_item)
531
+				foreach ($month_array as $month_item)
532 532
 				{
533 533
 					$month_data .= '"'.$month_item['date_name'].'",';
534 534
 					$month_cnt .= $month_item['date_count'].',';
535 535
 				}
536 536
 				$month_data = "['x',".substr($month_data, 0, -1)."]";
537
-				$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
537
+				$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
538 538
 				print 'c3.generate({
539 539
 				    bindto: "#chart9",
540 540
 				    data: { x: "x",
@@ -547,24 +547,24 @@  discard block
 block discarded – undo
547 547
                     <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"); ?>&raquo;</a>
548 548
                 </div>
549 549
             </div>
550
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
550
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
551 551
 
552 552
             <div class="col-md-6">
553 553
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
554 554
 <?php
555
-			$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
555
+			$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
556 556
 			if (empty($date_array)) print _("No data available");
557 557
 			else {
558 558
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
559 559
 				$date_data = '';
560 560
 				$date_cnt = '';
561
-				foreach($date_array as $date_item)
561
+				foreach ($date_array as $date_item)
562 562
 				{
563 563
 					$date_data .= '"'.$date_item['date_name'].'",';
564 564
 					$date_cnt .= $date_item['date_count'].',';
565 565
 				}
566 566
 				$date_data = "['x',".substr($date_data, 0, -1)."]";
567
-				$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
567
+				$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
568 568
 				print 'c3.generate({
569 569
 				    bindto: "#chart5",
570 570
 				    data: { x: "x",
@@ -577,23 +577,23 @@  discard block
 block discarded – undo
577 577
                     <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"); ?>&raquo;</a>
578 578
                 </div>
579 579
             </div>
580
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
580
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
581 581
             <div class="col-md-6">
582 582
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
583 583
 <?php
584
-			$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
584
+			$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
585 585
 			if (empty($hour_array)) print _("No data available");
586 586
 			else {
587 587
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
588 588
 				$hour_data = '';
589 589
 				$hour_cnt = '';
590
-				foreach($hour_array as $hour_item)
590
+				foreach ($hour_array as $hour_item)
591 591
 				{
592 592
 					$hour_data .= '"'.$hour_item['hour_name'].':00",';
593 593
 					$hour_cnt .= $hour_item['hour_count'].',';
594 594
 				}
595 595
 				$hour_data = "[".substr($hour_data, 0, -1)."]";
596
-				$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
596
+				$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
597 597
 				print 'c3.generate({
598 598
 				    bindto: "#chart6",
599 599
 				    data: {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
                     <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"); ?>&raquo;</a>
607 607
                 </div>
608 608
             </div>
609
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
609
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
610 610
         </div>
611 611
 <?php
612 612
 		}
@@ -630,13 +630,13 @@  discard block
 block discarded – undo
630 630
 				print '<div id="chart32" class="chart" width="100%"></div><script>';
631 631
 				$year_data = '';
632 632
 				$year_cnt = '';
633
-				foreach($year_array as $year_item)
633
+				foreach ($year_array as $year_item)
634 634
 				{
635 635
 					$year_data .= '"'.$year_item['year'].'-01-01",';
636 636
 					$year_cnt .= $year_item['count'].',';
637 637
 				}
638 638
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
639
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
639
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
640 640
 				print 'c3.generate({
641 641
 				    bindto: "#chart32",
642 642
 				    data: { x: "x",
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
650 650
                 </div>
651 651
             </div>
652
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
652
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
653 653
 
654 654
         <div class="row column">
655 655
             <div class="col-md-6">
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
 				print '<div id="chart33" class="chart" width="100%"></div><script>';
662 662
 				$year_data = '';
663 663
 				$year_cnt = '';
664
-				foreach($year_array as $year_item)
664
+				foreach ($year_array as $year_item)
665 665
 				{
666 666
 					$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
667 667
 					$year_cnt .= $year_item['count'].',';
668 668
 				}
669 669
 				$year_data = "['x',".substr($year_data, 0, -1)."]";
670
-				$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
670
+				$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
671 671
 				print 'c3.generate({
672 672
 				    bindto: "#chart33",
673 673
 				    data: { x: "x",
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
681 681
                 </div>
682 682
             </div>
683
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
683
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
684 684
 <br/>
685 685
 <?php
686 686
 		}
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 <?php
699 699
 			//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
700 700
 			if ($year == '' && $month == '') {
701
-				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
701
+				$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
702 702
 			} else {
703
-				$polar = $Stats->getStatsSource('polar',$year,$month);
703
+				$polar = $Stats->getStatsSource('polar', $year, $month);
704 704
 			}
705 705
 			if (!empty($polar)) {
706 706
 				print '<h2>'._("Coverage pattern").'</h2>';
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 					unset($polar_data);
709 709
 					$Spotter = new Spotter();
710 710
 					$data = json_decode($eachpolar['source_data']);
711
-					foreach($data as $value => $key) {
711
+					foreach ($data as $value => $key) {
712 712
 						$direction = $Spotter->parseDirection(($value*22.5));
713 713
 						$distance = $key;
714 714
 						$unit = 'km';
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 ?>
729 729
             <div class="col-md-6">
730 730
                 <h4><?php print $eachpolar['source_name']; ?></h4>
731
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
731
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
732 732
         	<script>
733 733
         	    (function() {
734 734
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 		      color: color,
753 753
 		      unit: '<?php echo $unit; ?>'
754 754
 		    };
755
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
755
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
756 756
 		    })();
757 757
 		</script>
758 758
             </div>
@@ -766,22 +766,22 @@  discard block
 block discarded – undo
766 766
 <?php
767 767
 			//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
768 768
 			if ($year == '' && $month == '') {
769
-				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
769
+				$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
770 770
 			} else {
771
-				$msg = $Stats->getStatsSource('msg',$year,$month);
771
+				$msg = $Stats->getStatsSource('msg', $year, $month);
772 772
 			}
773 773
 			if (!empty($msg)) {
774 774
 				print '<h2>'._("Messages received").'</h2>';
775 775
 				foreach ($msg as $eachmsg) {
776 776
 					//$eachmsg = $msg[0];
777 777
 					$data = $eachmsg['source_data'];
778
-					if ($data > 500) $max = (round(($data+100)/100))*100;
778
+					if ($data > 500) $max = (round(($data + 100)/100))*100;
779 779
 					else $max = 500;
780 780
 ?>
781
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
781
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
782 782
         	<script>
783 783
 		      var g = new JustGage({
784
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
784
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
785 785
 			    value: <?php echo $data; ?>,
786 786
 			    min: 0,
787 787
 			    max: <?php print $max; ?>,
@@ -802,9 +802,9 @@  discard block
 block discarded – undo
802 802
 <?php
803 803
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
804 804
 			if ($year == '' && $month == '') {
805
-				$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
805
+				$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
806 806
 			} else {
807
-				$hist = $Stats->getStatsSource('hist',$year,$month);
807
+				$hist = $Stats->getStatsSource('hist', $year, $month);
808 808
 			}
809 809
 			foreach ($hist as $hists) {
810 810
 				//$hist_data = '';
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 				$source = $hists['source_name'];
814 814
 				$hist_array = json_decode($hists['source_data']);
815 815
 				$unit = 'km';
816
-				foreach($hist_array as $distance => $nb)
816
+				foreach ($hist_array as $distance => $nb)
817 817
 				{
818 818
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
819 819
 						$distance = round($distance*0.539957);
@@ -834,18 +834,18 @@  discard block
 block discarded – undo
834 834
 				$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
835 835
 ?>
836 836
             <div class="col-md-6">
837
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
837
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
838 838
 <?php
839
-				print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
839
+				print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
840 840
 				print 'c3.generate({
841
-				    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
841
+				    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
842 842
 				    data: { x: "x",
843 843
 				    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
844 844
 				    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
845 845
 				print '</script>';
846 846
 ?>
847 847
     	    </div>
848
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
848
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
849 849
 <?php
850 850
 			}
851 851
 ?>
Please login to merge, or discard this patch.