Completed
Push — master ( d56a2b...17d606 )
by Yannick
05:33
created
statistics.php 1 patch
Indentation   +222 added lines, -222 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
     <p class="global-stats">
49 49
         <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span>
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span>
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
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span>
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span>
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span>
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
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span>
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,27 +130,27 @@  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
 	$airline_array = $Stats->countAllAirlines(true,$filter_name);
135 135
 	if (count($airline_array) == 0) print _("No data available");
136 136
 	else {
137
-            print '<div class="col-md-6">';
138
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
139
-	    print '<div id="chart2" class="chart" width="100%"></div>
137
+			print '<div class="col-md-6">';
138
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
139
+		print '<div id="chart2" class="chart" width="100%"></div>
140 140
                     <script> 
141 141
                         google.load("visualization", "1", {packages:["corechart"]});
142 142
                       google.setOnLoadCallback(drawChart2);
143 143
                       function drawChart2() {
144 144
                         var data = google.visualization.arrayToDataTable([
145 145
                             ["'._("Airline").'", "'._("# of times").'"], ';
146
-	    $airline_data = '';
147
-	    foreach($airline_array as $airline_item)
148
-	    {
146
+		$airline_data = '';
147
+		foreach($airline_array as $airline_item)
148
+		{
149 149
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
150
-	    }
151
-	    $airline_data = substr($airline_data, 0, -1);
152
-	    print $airline_data;
153
-	    print ']);
150
+		}
151
+		$airline_data = substr($airline_data, 0, -1);
152
+		print $airline_data;
153
+		print ']);
154 154
 
155 155
                         var options = {
156 156
                             chartArea: {"width": "80%", "height": "60%"},
@@ -165,51 +165,51 @@  discard block
 block discarded – undo
165 165
                               drawChart2();
166 166
                             });
167 167
                   </script>';
168
-	    print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
169
-    	    print '</div>';
168
+		print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
169
+			print '</div>';
170 170
 	}
171 171
 ?>
172 172
         </div>
173 173
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
174 174
 <?php
175
-    }
175
+	}
176 176
 ?>
177 177
         <div class="row column">
178 178
 
179 179
 	    <?php
180
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
180
+				 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
181 181
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
182
-		    if (empty($flightover_array)) {
183
-	    ?>
182
+			if (empty($flightover_array)) {
183
+		?>
184 184
             <div class="col-md-12">
185 185
             <?php
186
-        	    } else {
187
-            ?>
186
+				} else {
187
+			?>
188 188
             <div class="col-md-6">
189 189
             <?php
190
-            	    }
191
-            ?>
190
+					}
191
+			?>
192 192
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
193 193
                  <?php
194
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
195
-		    if (count($pilot_array) == 0) print _("No data available");
196
-		    else {
194
+				  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
195
+			if (count($pilot_array) == 0) print _("No data available");
196
+			else {
197 197
 
198
-                  print '<div id="chart7" class="chart" width="100%"></div>
198
+				  print '<div id="chart7" class="chart" width="100%"></div>
199 199
                     <script> 
200 200
                         google.load("visualization", "1", {packages:["corechart"]});
201 201
                       google.setOnLoadCallback(drawChart7);
202 202
                       function drawChart7() {
203 203
                         var data = google.visualization.arrayToDataTable([
204 204
                             ["'._("Pilots").'", "'._("# of times").'"], ';
205
-                            $pilot_data = '';
206
-                          foreach($pilot_array as $pilot_item)
207
-                                    {
208
-                                            $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
209
-                                    }
210
-                                    $pilot_data = substr($pilot_data, 0, -1);
211
-                                    print $pilot_data;
212
-                        print ']);
205
+							$pilot_data = '';
206
+						  foreach($pilot_array as $pilot_item)
207
+									{
208
+											$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
209
+									}
210
+									$pilot_data = substr($pilot_data, 0, -1);
211
+									print $pilot_data;
212
+						print ']);
213 213
 
214 214
                         var options = {
215 215
                             chartArea: {"width": "80%", "height": "60%"},
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
                               drawChart7();
225 225
                             });
226 226
                   </script>';
227
-                  }
228
-                  ?>
227
+				  }
228
+				  ?>
229 229
                 <div class="more">
230 230
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
231 231
                 </div>
@@ -233,30 +233,30 @@  discard block
 block discarded – undo
233 233
         
234 234
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
235 235
         <?php
236
-    	    } else {
237
-    	?>
236
+			} else {
237
+		?>
238 238
             <div class="col-md-6">
239 239
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
240 240
                  <?php
241
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
242
-		    if (count($owner_array) == 0) print _("No data available");
243
-		    else {
241
+				  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
242
+			if (count($owner_array) == 0) print _("No data available");
243
+			else {
244 244
 
245
-                  print '<div id="chart7" class="chart" width="100%"></div>
245
+				  print '<div id="chart7" class="chart" width="100%"></div>
246 246
                     <script> 
247 247
                         google.load("visualization", "1", {packages:["corechart"]});
248 248
                       google.setOnLoadCallback(drawChart7);
249 249
                       function drawChart7() {
250 250
                         var data = google.visualization.arrayToDataTable([
251 251
                             ["'._("Owner").'", "'._("# of times").'"], ';
252
-                            $owner_data = '';
253
-                          foreach($owner_array as $owner_item)
254
-                                    {
255
-                                            $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
256
-                                    }
257
-                                    $owner_data = substr($owner_data, 0, -1);
258
-                                    print $owner_data;
259
-                        print ']);
252
+							$owner_data = '';
253
+						  foreach($owner_array as $owner_item)
254
+									{
255
+											$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
256
+									}
257
+									$owner_data = substr($owner_data, 0, -1);
258
+									print $owner_data;
259
+						print ']);
260 260
 
261 261
                         var options = {
262 262
                             chartArea: {"width": "80%", "height": "60%"},
@@ -271,8 +271,8 @@  discard block
 block discarded – undo
271 271
                               drawChart7();
272 272
                             });
273 273
                   </script>';
274
-                  }
275
-                  ?>
274
+				  }
275
+				  ?>
276 276
                 <div class="more">
277 277
                     <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
278 278
                 </div>
@@ -280,32 +280,32 @@  discard block
 block discarded – undo
280 280
         
281 281
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
282 282
         <?php
283
-    	    }
284
-    	    if (!empty($flightover_array)) {
285
-    	?>
283
+			}
284
+			if (!empty($flightover_array)) {
285
+		?>
286 286
     	
287 287
             <div class="col-md-6">
288 288
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
289 289
                  <?php
290
-                  //$flightover_array = $Stats->countAllFlightOverCountries();
291
-		    if (count($flightover_array) == 0) print _("No data available");
292
-		    else {
290
+				  //$flightover_array = $Stats->countAllFlightOverCountries();
291
+			if (count($flightover_array) == 0) print _("No data available");
292
+			else {
293 293
 
294
-                  print '<div id="chart10" class="chart" width="100%"></div>
294
+				  print '<div id="chart10" class="chart" width="100%"></div>
295 295
                     <script> 
296 296
                         google.load("visualization", "1", {packages:["corechart"]});
297 297
                       google.setOnLoadCallback(drawChart10);
298 298
                       function drawChart10() {
299 299
                         var data = google.visualization.arrayToDataTable([
300 300
                             ["'._("Country").'", "'._("# of times").'"], ';
301
-                            $flightover_data = '';
302
-                          foreach($flightover_array as $flightover_item)
303
-                                    {
304
-                                            $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
305
-                                    }
306
-                                    $flightover_data = substr($flightover_data, 0, -1);
307
-                                    print $flightover_data;
308
-                        print ']);
301
+							$flightover_data = '';
302
+						  foreach($flightover_array as $flightover_item)
303
+									{
304
+											$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
305
+									}
306
+									$flightover_data = substr($flightover_data, 0, -1);
307
+									print $flightover_data;
308
+						print ']);
309 309
 
310 310
                         var options = {
311 311
                             chartArea: {"width": "80%", "height": "60%"},
@@ -322,15 +322,15 @@  discard block
 block discarded – undo
322 322
                               drawChart10();
323 323
                             });
324 324
                   </script>';
325
-                  }
326
-                  ?>
325
+				  }
326
+				  ?>
327 327
                 <div class="more">
328 328
                     <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
329 329
                 </div>
330 330
             </div>
331 331
         <?php
332
-            }
333
-        ?>
332
+			}
333
+		?>
334 334
         </div>
335 335
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
336 336
 
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
             <div class="col-md-6">
341 341
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
342 342
                 <?php
343
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
344
-		    if (count($airport_airport_array) == 0) print _("No data available");
345
-		    else {
343
+				$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
344
+			if (count($airport_airport_array) == 0) print _("No data available");
345
+			else {
346 346
 
347
-                 print '<div id="chart3" class="chart" width="100%"></div>
347
+				 print '<div id="chart3" class="chart" width="100%"></div>
348 348
                 <script>
349 349
                 google.load("visualization", "1", {packages:["geochart"]});
350 350
                 google.setOnLoadCallback(drawCharts3);
@@ -355,17 +355,17 @@  discard block
 block discarded – undo
355 355
 
356 356
                 var data = google.visualization.arrayToDataTable([ 
357 357
                     ["'._("Airport").'", "'._("# of times").'"],';
358
-                    $airport_data = '';
359
-                  foreach($airport_airport_array as $airport_item)
360
-                        {
361
-                            $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
362
-                            $name = str_replace("'", "", $name);
363
-                            $name = str_replace('"', "", $name);
364
-                            $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
365
-                        }
366
-                        $airport_data = substr($airport_data, 0, -1);
367
-                        print $airport_data;
368
-                print ']);
358
+					$airport_data = '';
359
+				  foreach($airport_airport_array as $airport_item)
360
+						{
361
+							$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
362
+							$name = str_replace("'", "", $name);
363
+							$name = str_replace('"', "", $name);
364
+							$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
365
+						}
366
+						$airport_data = substr($airport_data, 0, -1);
367
+						print $airport_data;
368
+				print ']);
369 369
 
370 370
                 var options = {
371 371
                     legend: {position: "none"},
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
                 chart.draw(data, options);
380 380
               }
381 381
                 </script>';
382
-                }
383
-              ?>
382
+				}
383
+			  ?>
384 384
               <div class="more">
385 385
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
386 386
               </div>
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
             <div class="col-md-6">
391 391
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
392 392
                 <?php
393
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
394
-		    if (count($airport_airport_array2) == 0) print _("No data available");
395
-		    else {
393
+				$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
394
+			if (count($airport_airport_array2) == 0) print _("No data available");
395
+			else {
396 396
 
397
-                print '<div id="chart4" class="chart" width="100%"></div>
397
+				print '<div id="chart4" class="chart" width="100%"></div>
398 398
                 <script>
399 399
                 google.load("visualization", "1", {packages:["geochart"]});
400 400
                 google.setOnLoadCallback(drawCharts4);
@@ -405,17 +405,17 @@  discard block
 block discarded – undo
405 405
 
406 406
                 var data = google.visualization.arrayToDataTable([ 
407 407
                     ["'._("Airport").'", "'._("# of times").'"],';
408
-                    $airport_data2 = '';
409
-                  foreach($airport_airport_array2 as $airport_item2)
410
-                        {
411
-                            $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
412
-                            $name2 = str_replace("'", "", $name2);
413
-                            $name2 = str_replace('"', "", $name2);
414
-                            $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
415
-                        }
416
-                        $airport_data2 = substr($airport_data2, 0, -1);
417
-                        print $airport_data2;
418
-                print ']);
408
+					$airport_data2 = '';
409
+				  foreach($airport_airport_array2 as $airport_item2)
410
+						{
411
+							$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
412
+							$name2 = str_replace("'", "", $name2);
413
+							$name2 = str_replace('"', "", $name2);
414
+							$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
415
+						}
416
+						$airport_data2 = substr($airport_data2, 0, -1);
417
+						print $airport_data2;
418
+				print ']);
419 419
 
420 420
                 var options = {
421 421
                     legend: {position: "none"},
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
                 chart.draw(data, options);
430 430
               }
431 431
                 </script>';
432
-                }
433
-              ?>
432
+				}
433
+			  ?>
434 434
               <div class="more">
435 435
                 <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
436 436
               </div>
@@ -442,24 +442,24 @@  discard block
 block discarded – undo
442 442
             <div class="col-md-6">
443 443
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
444 444
                 <?php
445
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
446
-		    if (count($year_array) == 0) print _("No data available");
447
-		    else {
448
-                  print '<div id="chart8" class="chart" width="100%"></div>
445
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
446
+			if (count($year_array) == 0) print _("No data available");
447
+			else {
448
+				  print '<div id="chart8" class="chart" width="100%"></div>
449 449
                     <script> 
450 450
                         google.load("visualization", "1", {packages:["corechart"]});
451 451
                       google.setOnLoadCallback(drawChart8);
452 452
                       function drawChart8() {
453 453
                         var data = google.visualization.arrayToDataTable([
454 454
                             ["'._("Month").'", "'._("# of Flights").'"], ';
455
-                            $year_data = '';
456
-                          foreach($year_array as $year_item)
457
-                                    {
458
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
459
-                                    }
460
-                                    $year_data = substr($year_data, 0, -1);
461
-                                    print $year_data;
462
-                        print ']);
455
+							$year_data = '';
456
+						  foreach($year_array as $year_item)
457
+									{
458
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
459
+									}
460
+									$year_data = substr($year_data, 0, -1);
461
+									print $year_data;
462
+						print ']);
463 463
 
464 464
                         var options = {
465 465
                             legend: {position: "none"},
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
                               drawChart8();
478 478
                             });
479 479
                   </script>';
480
-                  }
481
-                  ?>
480
+				  }
481
+				  ?>
482 482
                 <div class="more">
483 483
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
484 484
                 </div>
@@ -488,24 +488,24 @@  discard block
 block discarded – undo
488 488
             <div class="col-md-6">
489 489
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
490 490
                 <?php
491
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
492
-		    if (count($month_array) == 0) print _("No data available");
493
-		    else {
494
-                  print '<div id="chart9" class="chart" width="100%"></div>
491
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
492
+			if (count($month_array) == 0) print _("No data available");
493
+			else {
494
+				  print '<div id="chart9" class="chart" width="100%"></div>
495 495
                     <script> 
496 496
                         google.load("visualization", "1", {packages:["corechart"]});
497 497
                       google.setOnLoadCallback(drawChart9);
498 498
                       function drawChart9() {
499 499
                         var data = google.visualization.arrayToDataTable([
500 500
                             ["'._("Day").'", "'._("# of Flights").'"], ';
501
-                            $month_data = '';
502
-                          foreach($month_array as $month_item)
503
-                                    {
504
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
505
-                                    }
506
-                                    $month_data = substr($month_data, 0, -1);
507
-                                    print $month_data;
508
-                        print ']);
501
+							$month_data = '';
502
+						  foreach($month_array as $month_item)
503
+									{
504
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
505
+									}
506
+									$month_data = substr($month_data, 0, -1);
507
+									print $month_data;
508
+						print ']);
509 509
 
510 510
                         var options = {
511 511
                             legend: {position: "none"},
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
                               drawChart9();
524 524
                             });
525 525
                   </script>';
526
-                  }
527
-                  ?>
526
+				  }
527
+				  ?>
528 528
                 <div class="more">
529 529
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
530 530
                 </div>
@@ -534,25 +534,25 @@  discard block
 block discarded – undo
534 534
             <div class="col-md-6">
535 535
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
536 536
                 <?php
537
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
538
-		    if (empty($date_array)) print _("No data available");
539
-		    else {
540
-                  print '<div id="chart5" class="chart" width="100%"></div>
537
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
538
+			if (empty($date_array)) print _("No data available");
539
+			else {
540
+				  print '<div id="chart5" class="chart" width="100%"></div>
541 541
                     <script> 
542 542
                         google.load("visualization", "1", {packages:["corechart"]});
543 543
                       google.setOnLoadCallback(drawChart5);
544 544
                       function drawChart5() {
545 545
                         var data = google.visualization.arrayToDataTable([
546 546
                             ["'._("Date").'", "'._("# of Flights").'"], ';
547
-                            $date_data = '';
547
+							$date_data = '';
548 548
                         
549
-                          foreach($date_array as $date_item)
550
-                                    {
551
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
552
-                                    }
553
-                                    $date_data = substr($date_data, 0, -1);
554
-                                    print $date_data;
555
-                        print ']);
549
+						  foreach($date_array as $date_item)
550
+									{
551
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
552
+									}
553
+									$date_data = substr($date_data, 0, -1);
554
+									print $date_data;
555
+						print ']);
556 556
 
557 557
                         var options = {
558 558
                             legend: {position: "none"},
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
                               drawChart5();
571 571
                             });
572 572
                   </script>';
573
-                  }
574
-                  ?>
573
+				  }
574
+				  ?>
575 575
                 <div class="more">
576 576
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
577 577
                 </div>
@@ -581,25 +581,25 @@  discard block
 block discarded – undo
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);
585
-		    if (empty($hour_array)) print _("No data available");
586
-		    else {
584
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
585
+			if (empty($hour_array)) print _("No data available");
586
+			else {
587 587
 
588
-                  print '<div id="chart6" class="chart" width="100%"></div>
588
+				  print '<div id="chart6" class="chart" width="100%"></div>
589 589
                     <script> 
590 590
                         google.load("visualization", "1", {packages:["corechart"]});
591 591
                       google.setOnLoadCallback(drawChart6);
592 592
                       function drawChart6() {
593 593
                         var data = google.visualization.arrayToDataTable([
594 594
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
595
-                            $hour_data = '';
596
-                          foreach($hour_array as $hour_item)
597
-                                    {
598
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
599
-                                    }
600
-                                    $hour_data = substr($hour_data, 0, -1);
601
-                                    print $hour_data;
602
-                        print ']);
595
+							$hour_data = '';
596
+						  foreach($hour_array as $hour_item)
597
+									{
598
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
599
+									}
600
+									$hour_data = substr($hour_data, 0, -1);
601
+									print $hour_data;
602
+						print ']);
603 603
 
604 604
                         var options = {
605 605
                             legend: {position: "none"},
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
                               drawChart6();
618 618
                             });
619 619
                   </script>';
620
-                  }
621
-                ?>
620
+				  }
621
+				?>
622 622
                 <div class="more">
623 623
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
624 624
                 </div>
@@ -626,21 +626,21 @@  discard block
 block discarded – undo
626 626
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
627 627
         </div>
628 628
 <?php
629
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
629
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
630 630
 ?>
631 631
         <div class="row column">
632 632
         	<?php
633
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
634
-        	    if (!empty($polar)) {
635
-            		print '<h2>'._("Coverage pattern").'</h2>';
636
-        		foreach ($polar as $eachpolar) {
637
-        		    unset($polar_data);
638
-	        	    $Spotter = new Spotter();
639
-        		    $data = json_decode($eachpolar['source_data']);
640
-        		    foreach($data as $value => $key) {
641
-        			$direction = $Spotter->parseDirection(($value*22.5));
642
-        			$distance = $key;
643
-        			$unit = 'km';
633
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
634
+				if (!empty($polar)) {
635
+					print '<h2>'._("Coverage pattern").'</h2>';
636
+				foreach ($polar as $eachpolar) {
637
+					unset($polar_data);
638
+					$Spotter = new Spotter();
639
+					$data = json_decode($eachpolar['source_data']);
640
+					foreach($data as $value => $key) {
641
+					$direction = $Spotter->parseDirection(($value*22.5));
642
+					$distance = $key;
643
+					$unit = 'km';
644 644
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
645 645
 					$distance = round($distance*0.539957);
646 646
 					$unit = 'nm';
@@ -651,10 +651,10 @@  discard block
 block discarded – undo
651 651
 					$distance = $distance;
652 652
 					$unit = 'km';
653 653
 				}
654
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
655
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
656
-        		    }
657
-        	?>
654
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
655
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
656
+					}
657
+			?>
658 658
             <div class="col-md-6">
659 659
                 <h4><?php print $eachpolar['source_name']; ?></h4>
660 660
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -686,22 +686,22 @@  discard block
 block discarded – undo
686 686
 		</script>
687 687
             </div>
688 688
             <?php
689
-        	    }
690
-        	}
691
-            ?>
689
+				}
690
+			}
691
+			?>
692 692
         </div>
693 693
         <div class="row column">
694 694
             <div class="col-md-6">
695 695
         	<?php
696
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
697
-        	    if (!empty($msg)) {
698
-            		print '<h2>'._("Messages received").'</h2>';
699
-        		foreach ($msg as $eachmsg) {
700
-        		    //$eachmsg = $msg[0];
701
-        		    $data = $eachmsg['source_data'];
702
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
703
-        		    else $max = 500;
704
-        	?>
696
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
697
+				if (!empty($msg)) {
698
+					print '<h2>'._("Messages received").'</h2>';
699
+				foreach ($msg as $eachmsg) {
700
+					//$eachmsg = $msg[0];
701
+					$data = $eachmsg['source_data'];
702
+					if ($data > 500) $max = (round(($data+100)/100))*100;
703
+					else $max = 500;
704
+			?>
705 705
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
706 706
         	<script>
707 707
 		      var g = new JustGage({
@@ -717,9 +717,9 @@  discard block
 block discarded – undo
717 717
 			  });
718 718
 		</script>
719 719
             <?php
720
-        	   }
721
-        	}
722
-            ?>
720
+			   }
721
+			}
722
+			?>
723 723
             </div>
724 724
         </div>
725 725
         <div class="row column">
@@ -746,19 +746,19 @@  discard block
 block discarded – undo
746 746
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
747 747
 			}
748 748
 			$hist_data = substr($hist_data, 0, -1);
749
-            ?>
749
+			?>
750 750
             <div class="col-md-6">
751 751
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
752 752
                 <?php
753
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
753
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
754 754
                     <script> 
755 755
                         google.load("visualization", "1", {packages:["corechart"]});
756 756
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
757 757
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
758 758
                         var data = google.visualization.arrayToDataTable([
759 759
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
760
-                            print $hist_data;
761
-                        print ']);
760
+							print $hist_data;
761
+						print ']);
762 762
 
763 763
                         var options = {
764 764
                             legend: {position: "none"},
@@ -776,15 +776,15 @@  discard block
 block discarded – undo
776 776
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
777 777
                             });
778 778
                   </script>';
779
-        	?>
779
+			?>
780 780
     	    </div>
781 781
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
782 782
         	<?php
783
-                  }
784
-                ?>
783
+				  }
784
+				?>
785 785
         </div>
786 786
 <?php
787
-    }
787
+	}
788 788
 ?>
789 789
     </div>
790 790
 </div>  
Please login to merge, or discard this patch.