Completed
Push — master ( b37cbb...d3bd74 )
by Yannick
06:46
created
statistics.php 2 patches
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
52 52
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
53 53
 	}
54
-    ?>
54
+	?>
55 55
     </div>
56 56
     <?php include('statistics-sub-menu.php'); ?>
57 57
     <p class="global-stats">
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
61 61
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
62 62
 	<?php
63
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
63
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
64 64
 	?>
65 65
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
66 66
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
67 67
         <?php
68
-    	    } else {
69
-    	?>
68
+			} else {
69
+		?>
70 70
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
71 71
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72 72
     	<?php
73
-    	    }
74
-    	?>
73
+			}
74
+		?>
75 75
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
76 76
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
77 77
         <?php
78
-    		if ($airline_icao == '') {
79
-    	?>
78
+			if ($airline_icao == '') {
79
+		?>
80 80
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
81 81
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
82 82
 	<?php
@@ -99,88 +99,88 @@  discard block
 block discarded – undo
99 99
             <div class="col-md-6">
100 100
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
101 101
                  <?php
102
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
103
-		    if (count($aircraft_array) == 0) print _("No data available");
104
-		    else {
105
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
106
-                    $aircraft_data = '';
107
-                    foreach($aircraft_array as $aircraft_item)
108
-                    {
109
-                        $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
110
-                    }
111
-                    $aircraft_data = substr($aircraft_data, 0, -1);
112
-		    print 'var series = ['.$aircraft_data.'];';
113
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
114
-		    print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
115
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
116
-                    print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
117
-                    print 'dataset';
118
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
119
-                    print '</script>';
120
-                  }
121
-                  ?>
102
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
103
+			if (count($aircraft_array) == 0) print _("No data available");
104
+			else {
105
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
106
+					$aircraft_data = '';
107
+					foreach($aircraft_array as $aircraft_item)
108
+					{
109
+						$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
110
+					}
111
+					$aircraft_data = substr($aircraft_data, 0, -1);
112
+			print 'var series = ['.$aircraft_data.'];';
113
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
114
+			print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
115
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
116
+					print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
117
+					print 'dataset';
118
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
119
+					print '</script>';
120
+				  }
121
+				  ?>
122 122
                 <div class="more">
123 123
             	    <?php
124
-            		if ($year != '' && $month != '') {
125
-            	    ?>
124
+					if ($year != '' && $month != '') {
125
+					?>
126 126
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
127 127
             	    <?php
128
-            		} else {
129
-            	    ?>
128
+					} else {
129
+					?>
130 130
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
131 131
             	    <?php
132
-            		}
133
-            	    ?>
132
+					}
133
+					?>
134 134
                 </div>
135 135
             </div>
136 136
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
137 137
 <?php
138 138
 //    echo $airline_icao;
139
-    if ($airline_icao == '' || $airline_icao == 'all') {
139
+	if ($airline_icao == '' || $airline_icao == 'all') {
140 140
 	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
141 141
 	if (count($airline_array) > 0) {
142
-            print '<div class="col-md-6">';
143
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
144
-	    print '<div id="chart2" class="chart" width="100%"></div><script>';
145
-	    $airline_data = '';
146
-	    foreach($airline_array as $airline_item)
147
-	    {
142
+			print '<div class="col-md-6">';
143
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
144
+		print '<div id="chart2" class="chart" width="100%"></div><script>';
145
+		$airline_data = '';
146
+		foreach($airline_array as $airline_item)
147
+		{
148 148
 		$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
149
-	    }
150
-	    $airline_data = substr($airline_data, 0, -1);
151
-	    print 'var series = ['.$airline_data.'];';
152
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
153
-	    print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
154
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
155
-            print 'var airlinescnt = new d3pie("chart2",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
156
-	    print 'dataset';
157
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
158
-            print '</script>';
159
-	    if ($year != '' && $month != '') {
149
+		}
150
+		$airline_data = substr($airline_data, 0, -1);
151
+		print 'var series = ['.$airline_data.'];';
152
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
153
+		print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
154
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
155
+			print 'var airlinescnt = new d3pie("chart2",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
156
+		print 'dataset';
157
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
158
+			print '</script>';
159
+		if ($year != '' && $month != '') {
160 160
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
161 161
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
162 162
 		print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
163
-	    } else {
163
+		} else {
164 164
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
165 165
 		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
166 166
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
167
-	    }
168
-    	    print '</div>';
167
+		}
168
+			print '</div>';
169 169
 	}
170 170
 ?>
171 171
         </div>
172 172
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
173 173
 <?php
174
-    }
174
+	}
175 175
 ?>
176 176
         <div class="row column">
177 177
 <?php
178
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
179
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
178
+	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
179
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
180 180
 	if (empty($flightover_array)) {
181
-	    print '<div class="col-md-12">';
181
+		print '<div class="col-md-12">';
182 182
 	} else {
183
-            print '<div class="col-md-6">';
183
+			print '<div class="col-md-6">';
184 184
 	}
185 185
 ?>
186 186
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
189 189
 	if (count($pilot_array) == 0) print _("No data available");
190 190
 	else {
191
-	    print '<div id="chart7" class="chart" width="100%"></div><script>';
192
-	    $pilot_data = '';
193
-	    foreach($pilot_array as $pilot_item)
194
-	    {
191
+		print '<div id="chart7" class="chart" width="100%"></div><script>';
192
+		$pilot_data = '';
193
+		foreach($pilot_array as $pilot_item)
194
+		{
195 195
 		$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
196
-	    }
197
-	    $pilot_data = substr($pilot_data, 0, -1);
198
-	    print 'var series = ['.$pilot_data.'];';
199
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
200
-	    print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
201
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
202
-            print 'var pilotcnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
203
-	    print 'dataset';
204
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
205
-            print '</script>';
206
-        }
207
-        print '<div class="more">';
196
+		}
197
+		$pilot_data = substr($pilot_data, 0, -1);
198
+		print 'var series = ['.$pilot_data.'];';
199
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
200
+		print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
201
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
202
+			print 'var pilotcnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
203
+		print 'dataset';
204
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
205
+			print '</script>';
206
+		}
207
+		print '<div class="more">';
208 208
 	print '<a href="'.$globalURL.'/statistics/pilot'; 
209 209
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
210 210
 	print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         
215 215
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
216 216
 <?php
217
-    } else {
217
+	} else {
218 218
 ?>
219 219
             <div class="col-md-6">
220 220
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -222,21 +222,21 @@  discard block
 block discarded – undo
222 222
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
223 223
 	if (count($owner_array) == 0) print _("No data available");
224 224
 	else {
225
-	    print '<div id="chart7" class="chart" width="100%"></div><script>';
226
-	    $owner_data = '';
227
-	    foreach($owner_array as $owner_item)
228
-	    {
225
+		print '<div id="chart7" class="chart" width="100%"></div><script>';
226
+		$owner_data = '';
227
+		foreach($owner_array as $owner_item)
228
+		{
229 229
 		$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
230
-	    }
231
-	    $owner_data = substr($owner_data, 0, -1);
232
-	    print 'var series = ['.$owner_data.'];';
233
-	    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
234
-	    print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
235
-	    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
236
-            print 'var ownercnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
237
-	    print 'dataset';
238
-            print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
239
-	    print '</script>';
230
+		}
231
+		$owner_data = substr($owner_data, 0, -1);
232
+		print 'var series = ['.$owner_data.'];';
233
+		print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
234
+		print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
235
+		print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
236
+			print 'var ownercnt = new d3pie("chart7",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
237
+		print 'dataset';
238
+			print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
239
+		print '</script>';
240 240
 	}
241 241
 ?>
242 242
                 <div class="more">
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
         
247 247
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
248 248
 <?php
249
-    }
250
-    if (!empty($flightover_array)) {
249
+	}
250
+	if (!empty($flightover_array)) {
251 251
 ?>
252 252
             <div class="col-md-6">
253 253
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -255,20 +255,20 @@  discard block
 block discarded – undo
255 255
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
256 256
 	if (count($flightover_array) == 0) print _("No data available");
257 257
 	else {
258
-	    print '<div id="chart10" class="chart" width="100%"></div><script>';
259
-	    print 'var series = [';
260
-            $flightover_data = '';
261
-	    foreach($flightover_array as $flightover_item)
262
-	    {
258
+		print '<div id="chart10" class="chart" width="100%"></div><script>';
259
+		print 'var series = [';
260
+			$flightover_data = '';
261
+		foreach($flightover_array as $flightover_item)
262
+		{
263 263
 		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
264
-	    }
265
-	    $flightover_data = substr($flightover_data, 0, -1);
266
-	    print $flightover_data;
267
-	    print '];';
268
-	    print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
269
-	    print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
270
-	    print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
271
-	    print 'new Datamap({
264
+		}
265
+		$flightover_data = substr($flightover_data, 0, -1);
266
+		print $flightover_data;
267
+		print '];';
268
+		print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
269
+		print 'var paletteScale = d3.scale.linear().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
270
+		print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
271
+		print 'new Datamap({
272 272
     		element: document.getElementById("chart10"),
273 273
     		projection: "mercator", // big world map
274 274
     		fills: { defaultFill: "#F5F5F5" },
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         	    }
294 294
 		}
295 295
 	    });";
296
-	    print '</script>';
296
+		print '</script>';
297 297
 	}
298 298
 ?>
299 299
                 <div class="more">
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
                 </div>
302 302
             </div>
303 303
 <?php
304
-    }
304
+	}
305 305
 ?>
306 306
         </div>
307 307
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
         <div class="row column">
312 312
             <div class="col-md-6">
313 313
 <?php
314
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
315
-    if (count($airport_airport_array) > 0) {
314
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
315
+	if (count($airport_airport_array) > 0) {
316 316
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
317 317
 	print '<div id="chart3" class="chart" width="100%"></div><script>';
318
-        print "\n";
319
-        print 'var series = [';
320
-        $airport_data = '';
318
+		print "\n";
319
+		print 'var series = [';
320
+		$airport_data = '';
321 321
 	foreach($airport_airport_array as $airport_item)
322 322
 	{
323 323
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
367 367
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
368 368
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
369
-    }
369
+	}
370 370
 ?>
371 371
             </div>
372 372
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
373 373
 
374 374
             <div class="col-md-6">
375 375
 <?php
376
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
377
-    if (count($airport_airport_array2) > 0) {
376
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
377
+	if (count($airport_airport_array2) > 0) {
378 378
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
379 379
 	print '<div id="chart4" class="chart" width="100%"></div><script>';
380
-        print "\n";
381
-        print 'var series = [';
382
-        $airport_data = '';
380
+		print "\n";
381
+		print 'var series = [';
382
+		$airport_data = '';
383 383
 	foreach($airport_airport_array2 as $airport_item)
384 384
 	{
385 385
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
@@ -429,28 +429,28 @@  discard block
 block discarded – undo
429 429
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
430 430
 	if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
431 431
 	print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
432
-    }
432
+	}
433 433
 ?>
434 434
             </div>
435 435
         </div>
436 436
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
437 437
 <?php
438
-    if ($year == '' && $month == '') {
438
+	if ($year == '' && $month == '') {
439 439
 ?>
440 440
         <div class="row column">
441 441
             <div class="col-md-6">
442 442
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
443 443
                 <?php
444
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
445
-		    if (count($year_array) == 0) print _("No data available");
446
-		    else {
444
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
445
+			if (count($year_array) == 0) print _("No data available");
446
+			else {
447 447
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
448 448
 			$year_data = '';
449 449
 			$year_cnt = '';
450 450
 			foreach($year_array as $year_item)
451 451
 			{
452
-			    $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
453
-			    $year_cnt .= $year_item['date_count'].',';
452
+				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
453
+				$year_cnt .= $year_item['date_count'].',';
454 454
 			}
455 455
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
456 456
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
                 	     columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
461 461
                 	     axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Flights"}},legend: { show: false }});';
462 462
 			print '</script>';
463
-                    }
464
-                  ?>
463
+					}
464
+				  ?>
465 465
                 <div class="more">
466 466
                     <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>
467 467
                 </div>
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
             <div class="col-md-6">
471 471
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
472 472
                 <?php
473
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
474
-		    if (count($month_array) == 0) print _("No data available");
475
-		    else {
476
-                	print '<div id="chart9" class="chart" width="100%"></div><script>';
477
-                        $month_data = '';
473
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
474
+			if (count($month_array) == 0) print _("No data available");
475
+			else {
476
+					print '<div id="chart9" class="chart" width="100%"></div><script>';
477
+						$month_data = '';
478 478
 			$month_cnt = '';
479 479
 			foreach($month_array as $month_item)
480 480
 			{
481
-			    $month_data .= '"'.$month_item['date_name'].'",';
482
-			    $month_cnt .= $month_item['date_count'].',';
481
+				$month_data .= '"'.$month_item['date_name'].'",';
482
+				$month_cnt .= $month_item['date_count'].',';
483 483
 			}
484 484
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
485 485
 			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
                 	     columns: ['.$month_data.','.$month_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
490 490
                 	     axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
491 491
 			
492
-            		print '</script>';
493
-                    }
494
-                  ?>
492
+					print '</script>';
493
+					}
494
+				  ?>
495 495
                 <div class="more">
496 496
                     <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>
497 497
                 </div>
@@ -501,16 +501,16 @@  discard block
 block discarded – undo
501 501
             <div class="col-md-6">
502 502
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
503 503
                 <?php
504
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
505
-		    if (empty($date_array)) print _("No data available");
506
-		    else {
507
-                	print '<div id="chart5" class="chart" width="100%"></div><script>';
508
-                        $date_data = '';
504
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
505
+			if (empty($date_array)) print _("No data available");
506
+			else {
507
+					print '<div id="chart5" class="chart" width="100%"></div><script>';
508
+						$date_data = '';
509 509
 			$date_cnt = '';
510 510
 			foreach($date_array as $date_item)
511 511
 			{
512
-			    $date_data .= '"'.$date_item['date_name'].'",';
513
-			    $date_cnt .= $date_item['date_count'].',';
512
+				$date_data .= '"'.$date_item['date_name'].'",';
513
+				$date_cnt .= $date_item['date_count'].',';
514 514
 			}
515 515
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
516 516
 			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
@@ -520,9 +520,9 @@  discard block
 block discarded – undo
520 520
                 	     columns: ['.$date_data.','.$date_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
521 521
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
522 522
 			
523
-                	print '</script>';
524
-                    }
525
-                  ?>
523
+					print '</script>';
524
+					}
525
+				  ?>
526 526
                 <div class="more">
527 527
                     <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>
528 528
                 </div>
@@ -531,16 +531,16 @@  discard block
 block discarded – undo
531 531
             <div class="col-md-6">
532 532
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
533 533
                 <?php
534
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
535
-		    if (empty($hour_array)) print _("No data available");
536
-		    else {
537
-                	print '<div id="chart6" class="chart" width="100%"></div><script>';
538
-                        $hour_data = '';
534
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
535
+			if (empty($hour_array)) print _("No data available");
536
+			else {
537
+					print '<div id="chart6" class="chart" width="100%"></div><script>';
538
+						$hour_data = '';
539 539
 			$hour_cnt = '';
540 540
 			foreach($hour_array as $hour_item)
541 541
 			{
542
-			    $hour_data .= '"'.$hour_item['hour_name'].':00",';
543
-			    $hour_cnt .= $hour_item['hour_count'].',';
542
+				$hour_data .= '"'.$hour_item['hour_name'].':00",';
543
+				$hour_cnt .= $hour_item['hour_count'].',';
544 544
 			}
545 545
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
546 546
 			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
@@ -550,9 +550,9 @@  discard block
 block discarded – undo
550 550
                 	     columns: ['.$hour_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
551 551
                 	     axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
552 552
 
553
-            	     print '</script>';
554
-                  }
555
-                ?>
553
+					 print '</script>';
554
+				  }
555
+				?>
556 556
                 <div class="more">
557 557
                     <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>
558 558
                 </div>
@@ -560,26 +560,26 @@  discard block
 block discarded – undo
560 560
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
561 561
         </div>
562 562
 <?php
563
-    }
563
+	}
564 564
 ?>
565 565
 
566 566
 <?php
567
-    if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
567
+	if (($airline_icao == '' || $airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
568 568
 ?>
569 569
         <div class="row column">
570 570
             <div class="col-md-6">
571 571
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
572 572
                 <?php
573
-                  $year_array = $Stats->countFatalitiesByYear();
574
-		    if (count($year_array) == 0) print _("No data available");
575
-		    else {
573
+				  $year_array = $Stats->countFatalitiesByYear();
574
+			if (count($year_array) == 0) print _("No data available");
575
+			else {
576 576
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
577
-                        $year_data = '';
577
+						$year_data = '';
578 578
 			$year_cnt = '';
579 579
 			foreach($year_array as $year_item)
580 580
 			{
581
-			    $year_data .= '"'.$year_item['year'].'-01-01",';
582
-			    $year_cnt .= $year_item['count'].',';
581
+				$year_data .= '"'.$year_item['year'].'-01-01",';
582
+				$year_cnt .= $year_item['count'].',';
583 583
 			}
584 584
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
585 585
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
591 591
 
592 592
 			print '</script>';
593
-		    }
594
-                  ?>
593
+			}
594
+				  ?>
595 595
                 <div class="more">
596 596
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
597 597
                 </div>
@@ -602,16 +602,16 @@  discard block
 block discarded – undo
602 602
             <div class="col-md-6">
603 603
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
604 604
                 <?php
605
-                  $year_array = $Stats->countFatalitiesLast12Months();
606
-		    if (count($year_array) == 0) print _("No data available");
607
-		    else {
605
+				  $year_array = $Stats->countFatalitiesLast12Months();
606
+			if (count($year_array) == 0) print _("No data available");
607
+			else {
608 608
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
609
-                        $year_data = '';
609
+						$year_data = '';
610 610
 			$year_cnt = '';
611 611
 			foreach($year_array as $year_item)
612 612
 			{
613
-			    $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
614
-			    $year_cnt .= $year_item['count'].',';
613
+				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
614
+				$year_cnt .= $year_item['count'].',';
615 615
 			}
616 616
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
617 617
 			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
                 	     columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
622 622
                 	     axis: { x: { type: "timeseries",tick: { format: "%Y-%m"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
623 623
 			print '</script>';
624
-		    }
625
-                  ?>
624
+			}
625
+				  ?>
626 626
                 <div class="more">
627 627
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
628 628
                 </div>
@@ -630,30 +630,30 @@  discard block
 block discarded – undo
630 630
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
631 631
 <br/>
632 632
 <?php
633
-    }
633
+	}
634 634
 ?>
635 635
 
636 636
 <?php
637
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
637
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
638 638
 ?>
639 639
         <div class="row column">
640 640
         	<?php
641
-        	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
642
-        	    if ($year == '' && $month == '') {
643
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
644
-		    } else {
645
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
646
-        	    }
647
-        	    if (!empty($polar)) {
648
-            		print '<h2>'._("Coverage pattern").'</h2>';
649
-        		foreach ($polar as $eachpolar) {
650
-        		    unset($polar_data);
651
-	        	    $Spotter = new Spotter();
652
-        		    $data = json_decode($eachpolar['source_data']);
653
-        		    foreach($data as $value => $key) {
654
-        			$direction = $Spotter->parseDirection(($value*22.5));
655
-        			$distance = $key;
656
-        			$unit = 'km';
641
+				//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
642
+				if ($year == '' && $month == '') {
643
+				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
644
+			} else {
645
+				$polar = $Stats->getStatsSource('polar',$year,$month);
646
+				}
647
+				if (!empty($polar)) {
648
+					print '<h2>'._("Coverage pattern").'</h2>';
649
+				foreach ($polar as $eachpolar) {
650
+					unset($polar_data);
651
+					$Spotter = new Spotter();
652
+					$data = json_decode($eachpolar['source_data']);
653
+					foreach($data as $value => $key) {
654
+					$direction = $Spotter->parseDirection(($value*22.5));
655
+					$distance = $key;
656
+					$unit = 'km';
657 657
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
658 658
 					$distance = round($distance*0.539957);
659 659
 					$unit = 'nm';
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
 					$distance = $distance;
665 665
 					$unit = 'km';
666 666
 				}
667
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
668
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
669
-        		    }
670
-        	?>
667
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
668
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
669
+					}
670
+			?>
671 671
             <div class="col-md-6">
672 672
                 <h4><?php print $eachpolar['source_name']; ?></h4>
673 673
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -699,27 +699,27 @@  discard block
 block discarded – undo
699 699
 		</script>
700 700
             </div>
701 701
             <?php
702
-        	    }
703
-        	}
704
-            ?>
702
+				}
703
+			}
704
+			?>
705 705
         </div>
706 706
         <div class="row column">
707 707
             <div class="col-md-6">
708 708
         	<?php
709
-        	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
710
-        	    if ($year == '' && $month == '') {
711
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
712
-        	    } else {
713
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
714
-        	    }
715
-        	    if (!empty($msg)) {
716
-            		print '<h2>'._("Messages received").'</h2>';
717
-        		foreach ($msg as $eachmsg) {
718
-        		    //$eachmsg = $msg[0];
719
-        		    $data = $eachmsg['source_data'];
720
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
721
-        		    else $max = 500;
722
-        	?>
709
+				//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
710
+				if ($year == '' && $month == '') {
711
+				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
712
+				} else {
713
+				$msg = $Stats->getStatsSource('msg',$year,$month);
714
+				}
715
+				if (!empty($msg)) {
716
+					print '<h2>'._("Messages received").'</h2>';
717
+				foreach ($msg as $eachmsg) {
718
+					//$eachmsg = $msg[0];
719
+					$data = $eachmsg['source_data'];
720
+					if ($data > 500) $max = (round(($data+100)/100))*100;
721
+					else $max = 500;
722
+			?>
723 723
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
724 724
         	<script>
725 725
 		      var g = new JustGage({
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
 			  });
736 736
 		</script>
737 737
             <?php
738
-        	   }
739
-        	}
740
-            ?>
738
+			   }
739
+			}
740
+			?>
741 741
             </div>
742 742
         </div>
743 743
         <div class="row column">
@@ -775,26 +775,26 @@  discard block
 block discarded – undo
775 775
 			//$hist_data = substr($hist_data, 0, -1);
776 776
 			$distance_data = "['x',".substr($distance_data, 0, -1)."]";
777 777
 			$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
778
-            ?>
778
+			?>
779 779
             <div class="col-md-6">
780 780
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
781 781
                 <?php
782
-                    print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
783
-		    print 'c3.generate({
782
+					print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
783
+			print 'c3.generate({
784 784
 			bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
785 785
 			data: { x: "x",
786 786
 			columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
787 787
 			axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
788
-		    print '</script>';
789
-        	?>
788
+			print '</script>';
789
+			?>
790 790
     	    </div>
791 791
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
792 792
         	<?php
793
-                  }
794
-                ?>
793
+				  }
794
+				?>
795 795
         </div>
796 796
 <?php
797
-    }
797
+	}
798 798
 ?>
799 799
     </div>
800 800
 </div>  
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $Stats = new Stats();
8 8
 
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == '' && isset($globalFilter)) {
12 12
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
13 13
 }
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	$title = _("Statistics");
23 23
 }
24 24
 
25
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
26
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
25
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
26
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
27 27
 
28 28
 require_once('header.php');
29 29
 
@@ -49,36 +49,36 @@  discard block
 block discarded – undo
49 49
 		date_default_timezone_set('UTC');
50 50
 		$lastupdate = strtotime($last_update[0]['value']);
51 51
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
52
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
52
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
53 53
 	}
54 54
     ?>
55 55
     </div>
56 56
     <?php include('statistics-sub-menu.php'); ?>
57 57
     <p class="global-stats">
58
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
59
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
60
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
61
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
59
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
60
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
61
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
62 62
 	<?php
63 63
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
64 64
 	?>
65
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
66
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
65
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
66
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
67 67
         <?php
68 68
     	    } else {
69 69
     	?>
70
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
71
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
70
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
71
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
72 72
     	<?php
73 73
     	    }
74 74
     	?>
75
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
76
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
75
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
76
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
77 77
         <?php
78 78
     		if ($airline_icao == '') {
79 79
     	?>
80
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
81
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
81
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
82 82
 	<?php
83 83
 		}
84 84
 	?>
@@ -86,25 +86,25 @@  discard block
 block discarded – undo
86 86
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
87 87
 			if ($airline_icao == '' || $airline_icao == 'all') {
88 88
 	?>
89
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
90
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
89
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
90
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
91 91
 	<?php
92 92
 			}
93 93
 		}
94 94
 	?>
95 95
     </p>
96
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
96
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
97 97
     <div class="specific-stats">
98 98
         <div class="row column">
99 99
             <div class="col-md-6">
100 100
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
101 101
                  <?php
102
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
102
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
103 103
 		    if (count($aircraft_array) == 0) print _("No data available");
104 104
 		    else {
105 105
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
106 106
                     $aircraft_data = '';
107
-                    foreach($aircraft_array as $aircraft_item)
107
+                    foreach ($aircraft_array as $aircraft_item)
108 108
                     {
109 109
                         $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
110 110
                     }
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
             	    ?>
134 134
                 </div>
135 135
             </div>
136
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
136
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
137 137
 <?php
138 138
 //    echo $airline_icao;
139 139
     if ($airline_icao == '' || $airline_icao == 'all') {
140
-	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
140
+	$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
141 141
 	if (count($airline_array) > 0) {
142 142
             print '<div class="col-md-6">';
143 143
 	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
144 144
 	    print '<div id="chart2" class="chart" width="100%"></div><script>';
145 145
 	    $airline_data = '';
146
-	    foreach($airline_array as $airline_item)
146
+	    foreach ($airline_array as $airline_item)
147 147
 	    {
148 148
 		$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
149 149
 	    }
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 ?>
171 171
         </div>
172
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
172
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
173 173
 <?php
174 174
     }
175 175
 ?>
176 176
         <div class="row column">
177 177
 <?php
178
-    $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
178
+    $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
179 179
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
180 180
 	if (empty($flightover_array)) {
181 181
 	    print '<div class="col-md-12">';
@@ -185,12 +185,12 @@  discard block
 block discarded – undo
185 185
 ?>
186 186
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
187 187
 <?php
188
-	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
188
+	$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
189 189
 	if (count($pilot_array) == 0) print _("No data available");
190 190
 	else {
191 191
 	    print '<div id="chart7" class="chart" width="100%"></div><script>';
192 192
 	    $pilot_data = '';
193
-	    foreach($pilot_array as $pilot_item)
193
+	    foreach ($pilot_array as $pilot_item)
194 194
 	    {
195 195
 		$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
196 196
 	    }
@@ -212,19 +212,19 @@  discard block
 block discarded – undo
212 212
 ?>
213 213
             </div>
214 214
         
215
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
215
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
216 216
 <?php
217 217
     } else {
218 218
 ?>
219 219
             <div class="col-md-6">
220 220
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
221 221
 <?php
222
-	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
222
+	$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
223 223
 	if (count($owner_array) == 0) print _("No data available");
224 224
 	else {
225 225
 	    print '<div id="chart7" class="chart" width="100%"></div><script>';
226 226
 	    $owner_data = '';
227
-	    foreach($owner_array as $owner_item)
227
+	    foreach ($owner_array as $owner_item)
228 228
 	    {
229 229
 		$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
230 230
 	    }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                 </div>
245 245
             </div>
246 246
         
247
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
247
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
248 248
 <?php
249 249
     }
250 250
     if (!empty($flightover_array)) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	    print '<div id="chart10" class="chart" width="100%"></div><script>';
259 259
 	    print 'var series = [';
260 260
             $flightover_data = '';
261
-	    foreach($flightover_array as $flightover_item)
261
+	    foreach ($flightover_array as $flightover_item)
262 262
 	    {
263 263
 		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
264 264
 	    }
@@ -304,21 +304,21 @@  discard block
 block discarded – undo
304 304
     }
305 305
 ?>
306 306
         </div>
307
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
307
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
308 308
 
309 309
     	
310 310
         </div>
311 311
         <div class="row column">
312 312
             <div class="col-md-6">
313 313
 <?php
314
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
314
+    $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
315 315
     if (count($airport_airport_array) > 0) {
316 316
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
317 317
 	print '<div id="chart3" class="chart" width="100%"></div><script>';
318 318
         print "\n";
319 319
         print 'var series = [';
320 320
         $airport_data = '';
321
-	foreach($airport_airport_array as $airport_item)
321
+	foreach ($airport_airport_array as $airport_item)
322 322
 	{
323 323
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
324 324
 	}
@@ -369,18 +369,18 @@  discard block
 block discarded – undo
369 369
     }
370 370
 ?>
371 371
             </div>
372
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
372
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
373 373
 
374 374
             <div class="col-md-6">
375 375
 <?php
376
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
376
+    $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
377 377
     if (count($airport_airport_array2) > 0) {
378 378
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
379 379
 	print '<div id="chart4" class="chart" width="100%"></div><script>';
380 380
         print "\n";
381 381
         print 'var series = [';
382 382
         $airport_data = '';
383
-	foreach($airport_airport_array2 as $airport_item)
383
+	foreach ($airport_airport_array2 as $airport_item)
384 384
 	{
385 385
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
386 386
 	}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 ?>
434 434
             </div>
435 435
         </div>
436
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
436
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
437 437
 <?php
438 438
     if ($year == '' && $month == '') {
439 439
 ?>
@@ -441,19 +441,19 @@  discard block
 block discarded – undo
441 441
             <div class="col-md-6">
442 442
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
443 443
                 <?php
444
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
444
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
445 445
 		    if (count($year_array) == 0) print _("No data available");
446 446
 		    else {
447 447
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
448 448
 			$year_data = '';
449 449
 			$year_cnt = '';
450
-			foreach($year_array as $year_item)
450
+			foreach ($year_array as $year_item)
451 451
 			{
452 452
 			    $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
453 453
 			    $year_cnt .= $year_item['date_count'].',';
454 454
 			}
455 455
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
456
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
456
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
457 457
 			print 'c3.generate({
458 458
                 	    bindto: "#chart8",
459 459
                 	    data: { x: "x",
@@ -466,23 +466,23 @@  discard block
 block discarded – undo
466 466
                     <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>
467 467
                 </div>
468 468
             </div>
469
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
469
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
470 470
             <div class="col-md-6">
471 471
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
472 472
                 <?php
473
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
474 474
 		    if (count($month_array) == 0) print _("No data available");
475 475
 		    else {
476 476
                 	print '<div id="chart9" class="chart" width="100%"></div><script>';
477 477
                         $month_data = '';
478 478
 			$month_cnt = '';
479
-			foreach($month_array as $month_item)
479
+			foreach ($month_array as $month_item)
480 480
 			{
481 481
 			    $month_data .= '"'.$month_item['date_name'].'",';
482 482
 			    $month_cnt .= $month_item['date_count'].',';
483 483
 			}
484 484
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
485
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
485
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
486 486
 			print 'c3.generate({
487 487
                 	    bindto: "#chart9",
488 488
                 	    data: { x: "x",
@@ -496,24 +496,24 @@  discard block
 block discarded – undo
496 496
                     <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>
497 497
                 </div>
498 498
             </div>
499
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
499
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
500 500
 
501 501
             <div class="col-md-6">
502 502
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
503 503
                 <?php
504
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
504
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
505 505
 		    if (empty($date_array)) print _("No data available");
506 506
 		    else {
507 507
                 	print '<div id="chart5" class="chart" width="100%"></div><script>';
508 508
                         $date_data = '';
509 509
 			$date_cnt = '';
510
-			foreach($date_array as $date_item)
510
+			foreach ($date_array as $date_item)
511 511
 			{
512 512
 			    $date_data .= '"'.$date_item['date_name'].'",';
513 513
 			    $date_cnt .= $date_item['date_count'].',';
514 514
 			}
515 515
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
516
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
516
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
517 517
 			print 'c3.generate({
518 518
                 	    bindto: "#chart5",
519 519
                 	    data: { x: "x",
@@ -527,23 +527,23 @@  discard block
 block discarded – undo
527 527
                     <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>
528 528
                 </div>
529 529
             </div>
530
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
530
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
531 531
             <div class="col-md-6">
532 532
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
533 533
                 <?php
534
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
534
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
535 535
 		    if (empty($hour_array)) print _("No data available");
536 536
 		    else {
537 537
                 	print '<div id="chart6" class="chart" width="100%"></div><script>';
538 538
                         $hour_data = '';
539 539
 			$hour_cnt = '';
540
-			foreach($hour_array as $hour_item)
540
+			foreach ($hour_array as $hour_item)
541 541
 			{
542 542
 			    $hour_data .= '"'.$hour_item['hour_name'].':00",';
543 543
 			    $hour_cnt .= $hour_item['hour_count'].',';
544 544
 			}
545 545
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
546
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
546
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
547 547
 			print 'c3.generate({
548 548
                 	    bindto: "#chart6",
549 549
                 	    data: {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                     <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>
558 558
                 </div>
559 559
             </div>
560
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
560
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
561 561
         </div>
562 562
 <?php
563 563
     }
@@ -576,13 +576,13 @@  discard block
 block discarded – undo
576 576
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
577 577
                         $year_data = '';
578 578
 			$year_cnt = '';
579
-			foreach($year_array as $year_item)
579
+			foreach ($year_array as $year_item)
580 580
 			{
581 581
 			    $year_data .= '"'.$year_item['year'].'-01-01",';
582 582
 			    $year_cnt .= $year_item['count'].',';
583 583
 			}
584 584
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
585
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
585
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
586 586
 			print 'c3.generate({
587 587
                 	    bindto: "#chart32",
588 588
                 	    data: { x: "x",
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
597 597
                 </div>
598 598
             </div>
599
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
599
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
600 600
 
601 601
         <div class="row column">
602 602
             <div class="col-md-6">
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
609 609
                         $year_data = '';
610 610
 			$year_cnt = '';
611
-			foreach($year_array as $year_item)
611
+			foreach ($year_array as $year_item)
612 612
 			{
613 613
 			    $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
614 614
 			    $year_cnt .= $year_item['count'].',';
615 615
 			}
616 616
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
617
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
617
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
618 618
 			print 'c3.generate({
619 619
                 	    bindto: "#chart33",
620 620
                 	    data: { x: "x",
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
628 628
                 </div>
629 629
             </div>
630
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
630
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
631 631
 <br/>
632 632
 <?php
633 633
     }
@@ -640,9 +640,9 @@  discard block
 block discarded – undo
640 640
         	<?php
641 641
         	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
642 642
         	    if ($year == '' && $month == '') {
643
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
643
+		        $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
644 644
 		    } else {
645
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
645
+        		$polar = $Stats->getStatsSource('polar', $year, $month);
646 646
         	    }
647 647
         	    if (!empty($polar)) {
648 648
             		print '<h2>'._("Coverage pattern").'</h2>';
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
         		    unset($polar_data);
651 651
 	        	    $Spotter = new Spotter();
652 652
         		    $data = json_decode($eachpolar['source_data']);
653
-        		    foreach($data as $value => $key) {
653
+        		    foreach ($data as $value => $key) {
654 654
         			$direction = $Spotter->parseDirection(($value*22.5));
655 655
         			$distance = $key;
656 656
         			$unit = 'km';
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         	?>
671 671
             <div class="col-md-6">
672 672
                 <h4><?php print $eachpolar['source_name']; ?></h4>
673
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
673
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
674 674
         	<script>
675 675
         	    (function() {
676 676
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 		      color: color,
695 695
 		      unit: '<?php echo $unit; ?>'
696 696
 		    };
697
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
697
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
698 698
 		    })();
699 699
 		</script>
700 700
             </div>
@@ -708,22 +708,22 @@  discard block
 block discarded – undo
708 708
         	<?php
709 709
         	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
710 710
         	    if ($year == '' && $month == '') {
711
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
711
+        		$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
712 712
         	    } else {
713
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
713
+        		$msg = $Stats->getStatsSource('msg', $year, $month);
714 714
         	    }
715 715
         	    if (!empty($msg)) {
716 716
             		print '<h2>'._("Messages received").'</h2>';
717 717
         		foreach ($msg as $eachmsg) {
718 718
         		    //$eachmsg = $msg[0];
719 719
         		    $data = $eachmsg['source_data'];
720
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
720
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
721 721
         		    else $max = 500;
722 722
         	?>
723
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
723
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
724 724
         	<script>
725 725
 		      var g = new JustGage({
726
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
726
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
727 727
 			    value: <?php echo $data; ?>,
728 728
 			    min: 0,
729 729
 			    max: <?php print $max; ?>,
@@ -745,9 +745,9 @@  discard block
 block discarded – undo
745 745
             <?php
746 746
 		//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
747 747
 		if ($year == '' && $month == '') {
748
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
748
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
749 749
 		} else {
750
-			$hist = $Stats->getStatsSource('hist',$year,$month);
750
+			$hist = $Stats->getStatsSource('hist', $year, $month);
751 751
 		}
752 752
 		foreach ($hist as $hists) {
753 753
 			//$hist_data = '';
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 			$source = $hists['source_name'];
757 757
 			$hist_array = json_decode($hists['source_data']);
758 758
 			$unit = 'km';
759
-			foreach($hist_array as $distance => $nb)
759
+			foreach ($hist_array as $distance => $nb)
760 760
 			{
761 761
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
762 762
 					$distance = round($distance*0.539957);
@@ -777,18 +777,18 @@  discard block
 block discarded – undo
777 777
 			$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
778 778
             ?>
779 779
             <div class="col-md-6">
780
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
780
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
781 781
                 <?php
782
-                    print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
782
+                    print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
783 783
 		    print 'c3.generate({
784
-			bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
784
+			bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
785 785
 			data: { x: "x",
786 786
 			columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
787 787
 			axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
788 788
 		    print '</script>';
789 789
         	?>
790 790
     	    </div>
791
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
791
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
792 792
         	<?php
793 793
                   }
794 794
                 ?>
Please login to merge, or discard this patch.