Completed
Push — master ( 4b9caf...faaa5e )
by Yannick
06:40
created
statistics.php 1 patch
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
54 54
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
55 55
 	}
56
-    ?>
56
+	?>
57 57
     </div>
58 58
     <?php include('statistics-sub-menu.php'); ?>
59 59
     <p class="global-stats">
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
63 63
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
64 64
 	<?php
65
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
65
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
66 66
 	?>
67 67
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
68 68
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
69 69
         <?php
70
-    	    } else {
71
-    	?>
70
+			} else {
71
+		?>
72 72
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
73 73
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
74 74
     	<?php
75
-    	    }
76
-    	?>
75
+			}
76
+		?>
77 77
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
78 78
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
79 79
         <?php
80
-    		if ($airline_icao == '') {
81
-    	?>
80
+			if ($airline_icao == '') {
81
+		?>
82 82
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
83 83
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
84 84
 	<?php
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
             <div class="col-md-6">
102 102
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
103 103
                  <?php
104
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
105
-		    if (count($aircraft_array) == 0) print _("No data available");
106
-		    else {
104
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
105
+			if (count($aircraft_array) == 0) print _("No data available");
106
+			else {
107 107
 
108
-                    print '<div id="chart1" class="chart" width="100%"></div>
108
+					print '<div id="chart1" class="chart" width="100%"></div>
109 109
                     <script> 
110 110
                         google.load("visualization", "1", {packages:["corechart"]});
111 111
                       google.setOnLoadCallback(drawChart1);
112 112
                       function drawChart1() {
113 113
                         var data = google.visualization.arrayToDataTable([
114 114
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
115
-                            $aircraft_data = '';
116
-                          foreach($aircraft_array as $aircraft_item)
117
-                                    {
118
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
119
-                                    }
120
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
121
-                                    print $aircraft_data;
122
-                        print ']);
115
+							$aircraft_data = '';
116
+						  foreach($aircraft_array as $aircraft_item)
117
+									{
118
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
119
+									}
120
+									$aircraft_data = substr($aircraft_data, 0, -1);
121
+									print $aircraft_data;
122
+						print ']);
123 123
 
124 124
                         var options = {
125 125
                             chartArea: {"width": "80%", "height": "60%"},
@@ -134,45 +134,45 @@  discard block
 block discarded – undo
134 134
                               drawChart1();
135 135
                             });
136 136
                   </script>';
137
-                  }
138
-                  ?>
137
+				  }
138
+				  ?>
139 139
                 <div class="more">
140 140
             	    <?php
141
-            		if ($year != '' && $month != '') {
142
-            	    ?>
141
+					if ($year != '' && $month != '') {
142
+					?>
143 143
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
144 144
             	    <?php
145
-            		} else {
146
-            	    ?>
145
+					} else {
146
+					?>
147 147
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
148 148
             	    <?php
149
-            		}
150
-            	    ?>
149
+					}
150
+					?>
151 151
                 </div>
152 152
             </div>
153 153
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
154 154
 <?php
155 155
 //    echo $airline_icao;
156
-    if ($airline_icao == '' || $airline_icao == 'all') {
156
+	if ($airline_icao == '' || $airline_icao == 'all') {
157 157
 	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
158 158
 	if (count($airline_array) > 0) {
159
-            print '<div class="col-md-6">';
160
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
161
-	    print '<div id="chart2" class="chart" width="100%"></div>
159
+			print '<div class="col-md-6">';
160
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
161
+		print '<div id="chart2" class="chart" width="100%"></div>
162 162
                     <script> 
163 163
                         google.load("visualization", "1", {packages:["corechart"]});
164 164
                       google.setOnLoadCallback(drawChart2);
165 165
                       function drawChart2() {
166 166
                         var data = google.visualization.arrayToDataTable([
167 167
                             ["'._("Airline").'", "'._("# of times").'"], ';
168
-	    $airline_data = '';
169
-	    foreach($airline_array as $airline_item)
170
-	    {
168
+		$airline_data = '';
169
+		foreach($airline_array as $airline_item)
170
+		{
171 171
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
172
-	    }
173
-	    $airline_data = substr($airline_data, 0, -1);
174
-	    print $airline_data;
175
-	    print ']);
172
+		}
173
+		$airline_data = substr($airline_data, 0, -1);
174
+		print $airline_data;
175
+		print ']);
176 176
 
177 177
                         var options = {
178 178
                             chartArea: {"width": "80%", "height": "60%"},
@@ -187,27 +187,27 @@  discard block
 block discarded – undo
187 187
                               drawChart2();
188 188
                             });
189 189
                   </script>';
190
-	    if ($year != '' && $month != '') {
190
+		if ($year != '' && $month != '') {
191 191
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
192
-	    } else {
192
+		} else {
193 193
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
194
-	    }
195
-    	    print '</div>';
194
+		}
195
+			print '</div>';
196 196
 	}
197 197
 ?>
198 198
         </div>
199 199
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
200 200
 <?php
201
-    }
201
+	}
202 202
 ?>
203 203
         <div class="row column">
204 204
 <?php
205
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
206
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
205
+	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
206
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
207 207
 	if (empty($flightover_array)) {
208
-	    print '<div class="col-md-12">';
208
+		print '<div class="col-md-12">';
209 209
 	} else {
210
-            print '<div class="col-md-6">';
210
+			print '<div class="col-md-6">';
211 211
 	}
212 212
 ?>
213 213
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -215,21 +215,21 @@  discard block
 block discarded – undo
215 215
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
216 216
 	if (count($pilot_array) == 0) print _("No data available");
217 217
 	else {
218
-	    print '<div id="chart7" class="chart" width="100%"></div>
218
+		print '<div id="chart7" class="chart" width="100%"></div>
219 219
                     <script> 
220 220
                         google.load("visualization", "1", {packages:["corechart"]});
221 221
                       google.setOnLoadCallback(drawChart7);
222 222
                       function drawChart7() {
223 223
                         var data = google.visualization.arrayToDataTable([
224 224
                             ["'._("Pilots").'", "'._("# of times").'"], ';
225
-	    $pilot_data = '';
226
-	    foreach($pilot_array as $pilot_item)
227
-	    {
225
+		$pilot_data = '';
226
+		foreach($pilot_array as $pilot_item)
227
+		{
228 228
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
229
-	    }
230
-	    $pilot_data = substr($pilot_data, 0, -1);
231
-	    print $pilot_data;
232
-	    print ']);
229
+		}
230
+		$pilot_data = substr($pilot_data, 0, -1);
231
+		print $pilot_data;
232
+		print ']);
233 233
 
234 234
                         var options = {
235 235
                             chartArea: {"width": "80%", "height": "60%"},
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
                               drawChart7();
245 245
                             });
246 246
                   </script>';
247
-        }
248
-        print '<div class="more">';
247
+		}
248
+		print '<div class="more">';
249 249
 	print '<a href="'.$globalURL.'/statistics/pilot" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
250 250
 	print '</div>';
251 251
 ?>
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         
254 254
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
255 255
 <?php
256
-    } else {
256
+	} else {
257 257
 ?>
258 258
             <div class="col-md-6">
259 259
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -261,21 +261,21 @@  discard block
 block discarded – undo
261 261
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
262 262
 	if (count($owner_array) == 0) print _("No data available");
263 263
 	else {
264
-	    print '<div id="chart7" class="chart" width="100%"></div>
264
+		print '<div id="chart7" class="chart" width="100%"></div>
265 265
                     <script> 
266 266
                         google.load("visualization", "1", {packages:["corechart"]});
267 267
                       google.setOnLoadCallback(drawChart7);
268 268
                       function drawChart7() {
269 269
                         var data = google.visualization.arrayToDataTable([
270 270
                             ["'._("Owner").'", "'._("# of times").'"], ';
271
-                            $owner_data = '';
272
-	    foreach($owner_array as $owner_item)
273
-	    {
271
+							$owner_data = '';
272
+		foreach($owner_array as $owner_item)
273
+		{
274 274
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
275
-	    }
276
-	    $owner_data = substr($owner_data, 0, -1);
277
-	    print $owner_data;
278
-	    print ']);
275
+		}
276
+		$owner_data = substr($owner_data, 0, -1);
277
+		print $owner_data;
278
+		print ']);
279 279
 
280 280
                         var options = {
281 281
                             chartArea: {"width": "80%", "height": "60%"},
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
         
300 300
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
301 301
 <?php
302
-    }
303
-    if (!empty($flightover_array)) {
302
+	}
303
+	if (!empty($flightover_array)) {
304 304
 ?>
305 305
             <div class="col-md-6">
306 306
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -308,21 +308,21 @@  discard block
 block discarded – undo
308 308
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
309 309
 	if (count($flightover_array) == 0) print _("No data available");
310 310
 	else {
311
-	    print '<div id="chart10" class="chart" width="100%"></div>
311
+		print '<div id="chart10" class="chart" width="100%"></div>
312 312
                     <script> 
313 313
                         google.load("visualization", "1", {packages:["corechart"]});
314 314
                       google.setOnLoadCallback(drawChart10);
315 315
                       function drawChart10() {
316 316
                         var data = google.visualization.arrayToDataTable([
317 317
                             ["'._("Country").'", "'._("# of times").'"], ';
318
-                            $flightover_data = '';
319
-	    foreach($flightover_array as $flightover_item)
320
-	    {
318
+							$flightover_data = '';
319
+		foreach($flightover_array as $flightover_item)
320
+		{
321 321
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
322
-	    }
323
-	    $flightover_data = substr($flightover_data, 0, -1);
324
-	    print $flightover_data;
325
-	    print ']);
322
+		}
323
+		$flightover_data = substr($flightover_data, 0, -1);
324
+		print $flightover_data;
325
+		print ']);
326 326
 
327 327
                         var options = {
328 328
                             chartArea: {"width": "80%", "height": "60%"},
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 </div>
347 347
             </div>
348 348
 <?php
349
-    }
349
+	}
350 350
 ?>
351 351
         </div>
352 352
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
         <div class="row column">
357 357
             <div class="col-md-6">
358 358
 <?php
359
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
360
-    if (count($airport_airport_array) > 0) {
359
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
360
+	if (count($airport_airport_array) > 0) {
361 361
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
362 362
 	print '<div id="chart3" class="chart" width="100%"></div>
363 363
                 <script>
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
 
371 371
                 var data = google.visualization.arrayToDataTable([ 
372 372
                     ["'._("Airport").'", "'._("# of times").'"],';
373
-                    $airport_data = '';
373
+					$airport_data = '';
374 374
 	foreach($airport_airport_array as $airport_item)
375 375
 	{
376
-	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
377
-	    $name = str_replace("'", "", $name);
378
-	    $name = str_replace('"', "", $name);
379
-	    $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
376
+		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
377
+		$name = str_replace("'", "", $name);
378
+		$name = str_replace('"', "", $name);
379
+		$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
380 380
 	}
381 381
 	$airport_data = substr($airport_data, 0, -1);
382 382
 	print $airport_data;
@@ -395,15 +395,15 @@  discard block
 block discarded – undo
395 395
               }
396 396
                 </script>';
397 397
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
398
-    }
398
+	}
399 399
 ?>
400 400
             </div>
401 401
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
402 402
 
403 403
             <div class="col-md-6">
404 404
 <?php
405
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
406
-    if (count($airport_airport_array2) > 0) {
405
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
406
+	if (count($airport_airport_array2) > 0) {
407 407
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
408 408
 	print '<div id="chart4" class="chart" width="100%"></div>
409 409
                 <script>
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	$airport_data2 = '';
420 420
 	foreach($airport_airport_array2 as $airport_item2)
421 421
 	{
422
-	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
423
-	    $name2 = str_replace(array("'",'"'), '', $name2);
424
-	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
422
+		$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
423
+		$name2 = str_replace(array("'",'"'), '', $name2);
424
+		$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
425 425
 	}
426 426
 	$airport_data2 = substr($airport_data2, 0, -1);
427 427
 	print $airport_data2;
@@ -440,36 +440,36 @@  discard block
 block discarded – undo
440 440
               }
441 441
                 </script>';
442 442
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
443
-    }
443
+	}
444 444
 ?>
445 445
             </div>
446 446
         </div>
447 447
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
448 448
 <?php
449
-    if ($year == '' && $month == '') {
449
+	if ($year == '' && $month == '') {
450 450
 ?>
451 451
         <div class="row column">
452 452
             <div class="col-md-6">
453 453
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
454 454
                 <?php
455
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
456
-		    if (count($year_array) == 0) print _("No data available");
457
-		    else {
458
-                  print '<div id="chart8" class="chart" width="100%"></div>
455
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
456
+			if (count($year_array) == 0) print _("No data available");
457
+			else {
458
+				  print '<div id="chart8" class="chart" width="100%"></div>
459 459
                     <script> 
460 460
                         google.load("visualization", "1", {packages:["corechart"]});
461 461
                       google.setOnLoadCallback(drawChart8);
462 462
                       function drawChart8() {
463 463
                         var data = google.visualization.arrayToDataTable([
464 464
                             ["'._("Month").'", "'._("# of Flights").'"], ';
465
-                            $year_data = '';
466
-                          foreach($year_array as $year_item)
467
-                                    {
468
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
469
-                                    }
470
-                                    $year_data = substr($year_data, 0, -1);
471
-                                    print $year_data;
472
-                        print ']);
465
+							$year_data = '';
466
+						  foreach($year_array as $year_item)
467
+									{
468
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
469
+									}
470
+									$year_data = substr($year_data, 0, -1);
471
+									print $year_data;
472
+						print ']);
473 473
 
474 474
                         var options = {
475 475
                             legend: {position: "none"},
@@ -487,8 +487,8 @@  discard block
 block discarded – undo
487 487
                               drawChart8();
488 488
                             });
489 489
                   </script>';
490
-                  }
491
-                  ?>
490
+				  }
491
+				  ?>
492 492
                 <div class="more">
493 493
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
494 494
                 </div>
@@ -497,24 +497,24 @@  discard block
 block discarded – undo
497 497
             <div class="col-md-6">
498 498
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
499 499
                 <?php
500
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
501
-		    if (count($month_array) == 0) print _("No data available");
502
-		    else {
503
-                  print '<div id="chart9" class="chart" width="100%"></div>
500
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
501
+			if (count($month_array) == 0) print _("No data available");
502
+			else {
503
+				  print '<div id="chart9" class="chart" width="100%"></div>
504 504
                     <script> 
505 505
                         google.load("visualization", "1", {packages:["corechart"]});
506 506
                       google.setOnLoadCallback(drawChart9);
507 507
                       function drawChart9() {
508 508
                         var data = google.visualization.arrayToDataTable([
509 509
                             ["'._("Day").'", "'._("# of Flights").'"], ';
510
-                            $month_data = '';
511
-                          foreach($month_array as $month_item)
512
-                                    {
513
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
514
-                                    }
515
-                                    $month_data = substr($month_data, 0, -1);
516
-                                    print $month_data;
517
-                        print ']);
510
+							$month_data = '';
511
+						  foreach($month_array as $month_item)
512
+									{
513
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
514
+									}
515
+									$month_data = substr($month_data, 0, -1);
516
+									print $month_data;
517
+						print ']);
518 518
 
519 519
                         var options = {
520 520
                             legend: {position: "none"},
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                               drawChart9();
533 533
                             });
534 534
                   </script>';
535
-                  }
536
-                  ?>
535
+				  }
536
+				  ?>
537 537
                 <div class="more">
538 538
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
539 539
                 </div>
@@ -543,25 +543,25 @@  discard block
 block discarded – undo
543 543
             <div class="col-md-6">
544 544
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
545 545
                 <?php
546
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
547
-		    if (empty($date_array)) print _("No data available");
548
-		    else {
549
-                  print '<div id="chart5" class="chart" width="100%"></div>
546
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
547
+			if (empty($date_array)) print _("No data available");
548
+			else {
549
+				  print '<div id="chart5" class="chart" width="100%"></div>
550 550
                     <script> 
551 551
                         google.load("visualization", "1", {packages:["corechart"]});
552 552
                       google.setOnLoadCallback(drawChart5);
553 553
                       function drawChart5() {
554 554
                         var data = google.visualization.arrayToDataTable([
555 555
                             ["'._("Date").'", "'._("# of Flights").'"], ';
556
-                            $date_data = '';
556
+							$date_data = '';
557 557
                         
558
-                          foreach($date_array as $date_item)
559
-                                    {
560
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
561
-                                    }
562
-                                    $date_data = substr($date_data, 0, -1);
563
-                                    print $date_data;
564
-                        print ']);
558
+						  foreach($date_array as $date_item)
559
+									{
560
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
561
+									}
562
+									$date_data = substr($date_data, 0, -1);
563
+									print $date_data;
564
+						print ']);
565 565
 
566 566
                         var options = {
567 567
                             legend: {position: "none"},
@@ -579,8 +579,8 @@  discard block
 block discarded – undo
579 579
                               drawChart5();
580 580
                             });
581 581
                   </script>';
582
-                  }
583
-                  ?>
582
+				  }
583
+				  ?>
584 584
                 <div class="more">
585 585
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
586 586
                 </div>
@@ -589,25 +589,25 @@  discard block
 block discarded – undo
589 589
             <div class="col-md-6">
590 590
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
591 591
                 <?php
592
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
593
-		    if (empty($hour_array)) print _("No data available");
594
-		    else {
592
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
593
+			if (empty($hour_array)) print _("No data available");
594
+			else {
595 595
 
596
-                  print '<div id="chart6" class="chart" width="100%"></div>
596
+				  print '<div id="chart6" class="chart" width="100%"></div>
597 597
                     <script> 
598 598
                         google.load("visualization", "1", {packages:["corechart"]});
599 599
                       google.setOnLoadCallback(drawChart6);
600 600
                       function drawChart6() {
601 601
                         var data = google.visualization.arrayToDataTable([
602 602
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
603
-                            $hour_data = '';
604
-                          foreach($hour_array as $hour_item)
605
-                                    {
606
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
607
-                                    }
608
-                                    $hour_data = substr($hour_data, 0, -1);
609
-                                    print $hour_data;
610
-                        print ']);
603
+							$hour_data = '';
604
+						  foreach($hour_array as $hour_item)
605
+									{
606
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
607
+									}
608
+									$hour_data = substr($hour_data, 0, -1);
609
+									print $hour_data;
610
+						print ']);
611 611
 
612 612
                         var options = {
613 613
                             legend: {position: "none"},
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
                               drawChart6();
626 626
                             });
627 627
                   </script>';
628
-                  }
629
-                ?>
628
+				  }
629
+				?>
630 630
                 <div class="more">
631 631
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
632 632
                 </div>
@@ -634,36 +634,36 @@  discard block
 block discarded – undo
634 634
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
635 635
         </div>
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 
640 640
 <?php
641
-    if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
641
+	if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
642 642
 ?>
643 643
         <div class="row column">
644 644
             <div class="col-md-6">
645 645
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
646 646
                 <?php
647
-		    require_once('require/class.Accident.php');
648
-            	    $Accident = new Accident();
649
-                  $year_array = $Accident->countFatalitiesByYear($filter_name);
650
-		    if (count($year_array) == 0) print _("No data available");
651
-		    else {
652
-                  print '<div id="chart32" class="chart" width="100%"></div>
647
+			require_once('require/class.Accident.php');
648
+					$Accident = new Accident();
649
+				  $year_array = $Accident->countFatalitiesByYear($filter_name);
650
+			if (count($year_array) == 0) print _("No data available");
651
+			else {
652
+				  print '<div id="chart32" class="chart" width="100%"></div>
653 653
                     <script> 
654 654
                         google.load("visualization", "1", {packages:["corechart"]});
655 655
                       google.setOnLoadCallback(drawChart32);
656 656
                       function drawChart32() {
657 657
                         var data = google.visualization.arrayToDataTable([
658 658
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
659
-                            $year_data = '';
660
-                          foreach($year_array as $year_item)
661
-                                    {
662
-                                        $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
663
-                                    }
664
-                                    $year_data = substr($year_data, 0, -1);
665
-                                    print $year_data;
666
-                        print ']);
659
+							$year_data = '';
660
+						  foreach($year_array as $year_item)
661
+									{
662
+										$year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
663
+									}
664
+									$year_data = substr($year_data, 0, -1);
665
+									print $year_data;
666
+						print ']);
667 667
 
668 668
                         var options = {
669 669
                             legend: {position: "none"},
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
                               drawChart32();
682 682
                             });
683 683
                   </script>';
684
-                  }
685
-                  ?>
684
+				  }
685
+				  ?>
686 686
                 <div class="more">
687 687
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
688 688
                 </div>
@@ -693,26 +693,26 @@  discard block
 block discarded – undo
693 693
             <div class="col-md-6">
694 694
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
695 695
                 <?php
696
-		    require_once('require/class.Accident.php');
697
-            	    $Accident = new Accident();
698
-                  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
699
-		    if (count($year_array) == 0) print _("No data available");
700
-		    else {
701
-                  print '<div id="chart33" class="chart" width="100%"></div>
696
+			require_once('require/class.Accident.php');
697
+					$Accident = new Accident();
698
+				  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
699
+			if (count($year_array) == 0) print _("No data available");
700
+			else {
701
+				  print '<div id="chart33" class="chart" width="100%"></div>
702 702
                     <script> 
703 703
                         google.load("visualization", "1", {packages:["corechart"]});
704 704
                       google.setOnLoadCallback(drawChart33);
705 705
                       function drawChart33() {
706 706
                         var data = google.visualization.arrayToDataTable([
707 707
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
708
-                            $year_data = '';
709
-                          foreach($year_array as $year_item)
710
-                                    {
711
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
712
-                                    }
713
-                                    $year_data = substr($year_data, 0, -1);
714
-                                    print $year_data;
715
-                        print ']);
708
+							$year_data = '';
709
+						  foreach($year_array as $year_item)
710
+									{
711
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
712
+									}
713
+									$year_data = substr($year_data, 0, -1);
714
+									print $year_data;
715
+						print ']);
716 716
 
717 717
                         var options = {
718 718
                             legend: {position: "none"},
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
                               drawChart33();
731 731
                             });
732 732
                   </script>';
733
-                  }
734
-                  ?>
733
+				  }
734
+				  ?>
735 735
                 <div class="more">
736 736
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
737 737
                 </div>
@@ -739,30 +739,30 @@  discard block
 block discarded – undo
739 739
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
740 740
 <br/>
741 741
 <?php
742
-    }
742
+	}
743 743
 ?>
744 744
 
745 745
 <?php
746
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
746
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
747 747
 ?>
748 748
         <div class="row column">
749 749
         	<?php
750
-        	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
751
-        	    if ($year == '' && $month == '') {
752
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
753
-		    } else {
754
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
755
-        	    }
756
-        	    if (!empty($polar)) {
757
-            		print '<h2>'._("Coverage pattern").'</h2>';
758
-        		foreach ($polar as $eachpolar) {
759
-        		    unset($polar_data);
760
-	        	    $Spotter = new Spotter();
761
-        		    $data = json_decode($eachpolar['source_data']);
762
-        		    foreach($data as $value => $key) {
763
-        			$direction = $Spotter->parseDirection(($value*22.5));
764
-        			$distance = $key;
765
-        			$unit = 'km';
750
+				//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
751
+				if ($year == '' && $month == '') {
752
+				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
753
+			} else {
754
+				$polar = $Stats->getStatsSource('polar',$year,$month);
755
+				}
756
+				if (!empty($polar)) {
757
+					print '<h2>'._("Coverage pattern").'</h2>';
758
+				foreach ($polar as $eachpolar) {
759
+					unset($polar_data);
760
+					$Spotter = new Spotter();
761
+					$data = json_decode($eachpolar['source_data']);
762
+					foreach($data as $value => $key) {
763
+					$direction = $Spotter->parseDirection(($value*22.5));
764
+					$distance = $key;
765
+					$unit = 'km';
766 766
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
767 767
 					$distance = round($distance*0.539957);
768 768
 					$unit = 'nm';
@@ -773,10 +773,10 @@  discard block
 block discarded – undo
773 773
 					$distance = $distance;
774 774
 					$unit = 'km';
775 775
 				}
776
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
777
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
778
-        		    }
779
-        	?>
776
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
777
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
778
+					}
779
+			?>
780 780
             <div class="col-md-6">
781 781
                 <h4><?php print $eachpolar['source_name']; ?></h4>
782 782
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -808,27 +808,27 @@  discard block
 block discarded – undo
808 808
 		</script>
809 809
             </div>
810 810
             <?php
811
-        	    }
812
-        	}
813
-            ?>
811
+				}
812
+			}
813
+			?>
814 814
         </div>
815 815
         <div class="row column">
816 816
             <div class="col-md-6">
817 817
         	<?php
818
-        	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
819
-        	    if ($year == '' && $month == '') {
820
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
821
-        	    } else {
822
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
823
-        	    }
824
-        	    if (!empty($msg)) {
825
-            		print '<h2>'._("Messages received").'</h2>';
826
-        		foreach ($msg as $eachmsg) {
827
-        		    //$eachmsg = $msg[0];
828
-        		    $data = $eachmsg['source_data'];
829
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
830
-        		    else $max = 500;
831
-        	?>
818
+				//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
819
+				if ($year == '' && $month == '') {
820
+				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
821
+				} else {
822
+				$msg = $Stats->getStatsSource('msg',$year,$month);
823
+				}
824
+				if (!empty($msg)) {
825
+					print '<h2>'._("Messages received").'</h2>';
826
+				foreach ($msg as $eachmsg) {
827
+					//$eachmsg = $msg[0];
828
+					$data = $eachmsg['source_data'];
829
+					if ($data > 500) $max = (round(($data+100)/100))*100;
830
+					else $max = 500;
831
+			?>
832 832
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
833 833
         	<script>
834 834
 		      var g = new JustGage({
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 			  });
845 845
 		</script>
846 846
             <?php
847
-        	   }
848
-        	}
849
-            ?>
847
+			   }
848
+			}
849
+			?>
850 850
             </div>
851 851
         </div>
852 852
         <div class="row column">
@@ -878,19 +878,19 @@  discard block
 block discarded – undo
878 878
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
879 879
 			}
880 880
 			$hist_data = substr($hist_data, 0, -1);
881
-            ?>
881
+			?>
882 882
             <div class="col-md-6">
883 883
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
884 884
                 <?php
885
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
885
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
886 886
                     <script> 
887 887
                         google.load("visualization", "1", {packages:["corechart"]});
888 888
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
889 889
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
890 890
                         var data = google.visualization.arrayToDataTable([
891 891
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
892
-                            print $hist_data;
893
-                        print ']);
892
+							print $hist_data;
893
+						print ']);
894 894
 
895 895
                         var options = {
896 896
                             legend: {position: "none"},
@@ -908,15 +908,15 @@  discard block
 block discarded – undo
908 908
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
909 909
                             });
910 910
                   </script>';
911
-        	?>
911
+			?>
912 912
     	    </div>
913 913
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
914 914
         	<?php
915
-                  }
916
-                ?>
915
+				  }
916
+				?>
917 917
         </div>
918 918
 <?php
919
-    }
919
+	}
920 920
 ?>
921 921
     </div>
922 922
 </div>  
Please login to merge, or discard this patch.