2 require_once('require/class.Connection.php');
3 require_once('require/class.Stats.php');
4 require_once('require/class.Language.php');
5 $beginpage = microtime(true);
9 if (isset($_GET['tracker'])) {
10 require_once('require/class.Tracker.php');
11 $Tracker = new Tracker();
13 } elseif (isset($_GET['marine'])) {
14 require_once('require/class.Marine.php');
15 $Marine = new Marine();
17 } elseif (isset($_GET['satellite'])) {
18 require_once('require/class.Satellite.php');
19 $Satellite = new Satellite();
22 require_once('require/class.Spotter.php');
25 if (!isset($filter_name)) $filter_name = '';
26 $airline_icao = (string)filter_input(INPUT_GET
,'airline',FILTER_SANITIZE_STRING
);
27 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
30 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
31 $Spotter = new Spotter();
32 $airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 if (isset($airline_info[0]['name'])) {
34 $airline_name = $airline_info[0]['name'];
35 } elseif (strpos($airline_icao,'alliance_') !== FALSE) {
36 $alliance_name = $airline_icao;
39 if ($type == 'aircraft' && isset($airline_name)) {
40 $title = _("Statistics").' - '.$airline_name;
42 $title = _("Statistics");
45 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
46 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
48 require_once('header.php');
51 <link href
="<?php echo $globalURL; ?>/css/c3.min.css" rel
="stylesheet" type
="text/css">
52 <!--<script type
="text/javascript" src
="https://d3js.org/d3.v4.min.js"></script
>-->
53 <!--<script type
="text/javascript" src
="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script
>-->
54 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/d3.min.js"></script
>
55 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/c3.min.js"></script
>
56 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/d3pie.min.js"></script
>
57 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/radarChart.js"></script
>
58 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/raphael-2.1.4.min.js"></script
>
59 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/justgage.js"></script
>
60 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/topojson.v2.min.js"></script
>
61 <script type
="text/javascript" src
="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script
>
64 <h1
><?php
if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?
></h1
>
66 if ($type == 'aircraft') {
67 $last_update = $Stats->getLastStatsUpdate();
68 } elseif ($type == 'marine') {
69 $last_update = $Stats->getLastStatsUpdate('last_update_stats_marine');
70 } elseif ($type == 'tracker') {
71 $last_update = $Stats->getLastStatsUpdate('last_update_stats_tracker');
73 if (isset($last_update[0]['value'])) {
74 date_default_timezone_set('UTC');
75 $lastupdate = strtotime($last_update[0]['value']);
76 if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
77 print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
83 include('statistics-sub-menu.php');
85 <p
class="global-stats">
87 if ($type == 'aircraft') {
89 <span
><span
class="badge"><?php
print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?
></span
> <?php
echo _("Flights"); ?
></span
>
90 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
91 <span
><span
class="badge"><?php
print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?
></span
> <?php
echo _("Arrivals seen"); ?
></span
>
92 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
94 if ((isset($globalUsePilot) && $globalUsePilot) ||
!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) ||
(isset($globalIVAO) && $globalIVAO) ||
(isset($globalVATSIM) && $globalVATSIM) ||
(isset($globalphpVMS) && $globalphpVMS) ||
(isset($globalVAM) && $globalVAM))) {
96 <span
><span
class="badge"><?php
print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?
></span
> <?php
echo _("Pilots"); ?
></span
>
97 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
100 if ((isset($globalUseOwner) && $globalUseOwner) ||
(!isset($globalUseOwner) && (!isset($globalVA) ||
!$globalVA) && (!isset($globalIVAO) ||
!$globalIVAO) && (!isset($globalVATSIM) ||
!$globalVATSIM) && (!isset($globalphpVMS) ||
!$globalphpVMS) && (!isset($globalVAM) ||
!$globalVAM))) {
102 <span
><span
class="badge"><?php
print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?
></span
> <?php
echo _("Owners"); ?
></span
>
103 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
107 <span
><span
class="badge"><?php
print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?
></span
> <?php
echo _("Aircraft types"); ?
></span
>
108 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
110 if ($airline_icao == '') {
112 <span
><span
class="badge"><?php
print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?
></span
> <?php
echo _("Airlines"); ?
></span
>
113 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
118 if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
119 if ($airline_icao == '' ||
$airline_icao == 'all') {
121 <span
><span
class="badge"><?php
print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?
></span
> <?php
echo _("Military"); ?
></span
>
122 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
128 } elseif ($type == 'marine') {
130 <span
><span
class="badge"><?php
print number_format($Stats->countOverallMarine($filter_name,$year,$month)); ?
></span
> <?php
echo _("Vessels"); ?
></span
>
131 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
133 if (isset($globalVM) && $globalVM) {
135 <span
><span
class="badge"><?php
print number_format($Marine->countOverallMarineTypes($filter_name,$year,$month)); ?
></span
> <?php
echo _("Types"); ?
></span
>
136 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
137 <span
><span
class="badge"><?php
print number_format($Marine->countOverallMarineRaces($filter_name,$year,$month)); ?
></span
> <?php
echo _("Races"); ?
></span
>
138 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
139 <span
><span
class="badge"><?php
print number_format($Marine->countOverallMarineCaptains($filter_name,$year,$month)); ?
></span
> <?php
echo _("Captains"); ?
></span
>
140 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
144 <span
><span
class="badge"><?php
print number_format($Stats->countOverallMarineTypes($filter_name,$year,$month)); ?
></span
> <?php
echo _("Types"); ?
></span
>
145 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
148 } elseif ($type == 'tracker') {
150 <span
><span
class="badge"><?php
print number_format($Stats->countOverallTracker($filter_name,$year,$month)); ?
></span
> <?php
echo _("Trackers"); ?
></span
>
151 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
152 <span
><span
class="badge"><?php
print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?
></span
> <?php
echo _("Types"); ?
></span
>
153 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
158 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
159 <div
class="specific-stats">
161 if ($type == 'aircraft') {
163 <div
class="row column">
164 <div
class="col-md-6">
165 <h2
><?php
echo _("Top 10 Most Common Aircraft Type"); ?
></h2
>
167 $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
168 if (count($aircraft_array) == 0) {
169 print _("No data available");
171 print '<div id="chart1" class="chart" width="100%"></div><script>';
173 foreach($aircraft_array as $aircraft_item) {
174 if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
175 else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
177 $aircraft_data = substr($aircraft_data, 0, -1);
178 print 'var series = ['.$aircraft_data.'];';
179 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);';
180 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
181 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
182 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":';
184 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}}});';
190 if ($year != '' && $month != '') {
192 <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"); ?
>»
;</a
>
196 <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"); ?
>»
;</a
>
202 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
204 if ($airline_icao == '' ||
$airline_icao == 'all') {
205 $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
206 if (count($airline_array) > 0) {
207 print '<div class="col-md-6">';
208 print '<h2>'._("Top 10 Most Common Airline").'</h2>';
209 print '<div id="chart2" class="chart" width="100%"></div><script>';
211 foreach($airline_array as $airline_item) {
212 $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
214 $airline_data = substr($airline_data, 0, -1);
215 print 'var series = ['.$airline_data.'];';
216 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);';
217 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
218 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
219 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":';
221 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}}});';
223 if ($year != '' && $month != '') {
224 print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
225 if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
226 print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>';
228 print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
229 if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
230 print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>';
236 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
242 if ($type == 'marine') {
244 <div
class="row column">
245 <div
class="col-md-6">
246 <h2
><?php
echo _("Top 10 Most Common Vessel Type"); ?
></h2
>
248 $marine_array = $Stats->countAllMarineTypes(true,$filter_name,$year,$month);
249 if (count($marine_array) == 0) print _("No data available");
251 print '<div id="chart1" class="chart" width="100%"></div><script>';
253 foreach($marine_array as $marine_item) {
254 $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
256 $marine_data = substr($marine_data, 0, -1);
257 print 'var series = ['.$marine_data.'];';
258 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);';
259 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
260 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
261 print 'var marinetype = 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":';
263 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}}});';
270 if ($year != '' && $month != '') {
272 <a href
="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
276 <a href
="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
282 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
285 if (isset($globalVM) && $globalVM) {
287 <div
class="col-md-6">
288 <h2
><?php
echo _("Top 10 Races Number of Participants"); ?
></h2
>
290 $marine_array = $Marine->countAllCaptainsByRaces(true,$filter_name,$year,$month);
291 if (count($marine_array) == 0) print _("No data available");
293 print '<div id="chart991" class="chart" width="100%"></div><script>';
295 foreach($marine_array as $marine_item) {
296 $marine_data .= '["'.$marine_item['marine_race_name'].'",'.$marine_item['marine_captain_count'].'],';
298 $marine_data = substr($marine_data, 0, -1);
299 print 'var series = ['.$marine_data.'];';
300 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);';
301 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
302 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
303 print 'var marinetype = new d3pie("chart991",{"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":';
305 print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3,"format":"value"},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#98e8e3","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
311 if ($year != '' && $month != '') {
313 <a href
="<?php print $globalURL; ?>/marine/statistics/race/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
317 <a href
="<?php print $globalURL; ?>/marine/statistics/race" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
323 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
325 <div
class="row column">
330 if ($type == 'tracker') {
332 <div
class="row column">
333 <div
class="col-md-6">
334 <h2
><?php
echo _("Top 10 Most Common Tracker Type"); ?
></h2
>
336 $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
337 if (count($tracker_array) == 0) print _("No data available");
339 print '<div id="chart1" class="chart" width="100%"></div><script>';
341 foreach($tracker_array as $tracker_item) {
342 $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
344 $tracker_data = substr($tracker_data, 0, -1);
345 print 'var series = ['.$tracker_data.'];';
346 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);';
347 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
348 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
349 print 'var trackertype = 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":';
351 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}}});';
358 if ($year != '' && $month != '') {
360 <a href="<?php print $globalURL; ?>/tracker/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a>
364 <a href="<?php print $globalURL; ?>/tracker/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a>
371 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
375 if ($type == 'satellite') {
377 <div
class="row column">
378 <div
class="col-md-6">
379 <h2
><?php
echo _("Top 10 Most Common Owners"); ?
></h2
>
381 $owner_array = $Satellite->countAllOwners(true);
382 if (count($owner_array) == 0) print _("No data available");
384 print '<div id="chart7" class="chart" width="100%"></div><script>';
386 foreach($owner_array as $owner_item) {
387 $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
389 $owner_data = substr($owner_data, 0, -1);
390 print 'var series = ['.$owner_data.'];';
391 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);';
392 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
393 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
394 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":';
396 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}}});';
402 <a href
="<?php print $globalURL; ?>/statistics/owner<?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"); ?
>»
;</a
>
406 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
407 <div
class="col-md-6">
408 <h2
><?php
echo _("Top 10 Most Common Countries Owners"); ?
></h2
>
410 $countries_array = $Satellite->countAllCountriesOwners(true);
411 if (count($countries_array) == 0) print _("No data available");
413 print '<div id="chart8" class="chart" width="100%"></div><script>';
415 foreach($countries_array as $owner_item) {
416 $owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
418 $owner_data = substr($owner_data, 0, -1);
419 print 'var series = ['.$owner_data.'];';
420 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);';
421 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
422 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
423 print 'var ownercnt = new d3pie("chart8",{"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":';
425 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}}});';
431 <a href
="<?php print $globalURL; ?>/statistics/owner<?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"); ?
>»
;</a
>
436 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
438 <div
class="row column">
439 <div
class="col-md-6">
440 <h2
><?php
echo _("Top 10 Most Common Launch Sites"); ?
></h2
>
442 $launch_site_array = $Satellite->countAllLaunchSite(true);
443 if (count($launch_site_array) == 0) print _("No data available");
445 print '<div id="chart9" class="chart" width="100%"></div><script>';
446 $launch_site_data = '';
447 foreach($launch_site_array as $launch_site_item) {
448 $launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
450 $launch_site_data = substr($launch_site_data, 0, -1);
451 print 'var series = ['.$launch_site_data.'];';
452 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);';
453 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
454 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
455 print 'var ownercnt = new d3pie("chart9",{"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":';
457 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}}});';
463 <a href
="<?php print $globalURL; ?>/statistics/owner<?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"); ?
>»
;</a
>
470 if ($type == 'aircraft') {
472 <div
class="row column">
474 $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
475 //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
476 if ((isset($globalUsePilot) && $globalUsePilot) ||
!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) ||
(isset($globalIVAO) && $globalIVAO) ||
(isset($globalVATSIM) && $globalVATSIM) ||
(isset($globalphpVMS) && $globalphpVMS) ||
(isset($globalVAM) && $globalVAM))) {
477 if (empty($flightover_array)) {
478 print '<div class="col-md-12">';
480 print '<div class="col-md-6">';
483 <h2
><?php
echo _("Top 10 Most Common Pilots"); ?
></h2
>
485 $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
486 if (count($pilot_array) == 0) print _("No data available");
488 print '<div id="chart7" class="chart" width="100%"></div><script>';
490 foreach($pilot_array as $pilot_item) {
491 $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
493 $pilot_data = substr($pilot_data, 0, -1);
494 print 'var series = ['.$pilot_data.'];';
495 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);';
496 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
497 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
498 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":';
500 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}}});';
503 print '<div class="more">';
504 print '<a href="'.$globalURL.'/statistics/pilot';
505 if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
506 print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>';
511 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
515 if ((isset($globalUseOwner) && $globalUseOwner) ||
(!isset($globalUseOwner) && (!isset($globalVA) ||
!$globalVA) && (!isset($globalIVAO) ||
!$globalIVAO) && (!isset($globalVATSIM) ||
!$globalVATSIM) && (!isset($globalphpVMS) ||
!$globalphpVMS) && (!isset($globalVAM) ||
!$globalVAM))) {
517 <div
class="col-md-6">
518 <h2
><?php
echo _("Top 10 Most Common Owners"); ?
></h2
>
520 $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
521 if (count($owner_array) == 0) print _("No data available");
523 print '<div id="chart7" class="chart" width="100%"></div><script>';
525 foreach($owner_array as $owner_item) {
526 $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
528 $owner_data = substr($owner_data, 0, -1);
529 print 'var series = ['.$owner_data.'];';
530 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);';
531 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
532 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
533 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":';
535 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}}});';
540 <a href
="<?php print $globalURL; ?>/statistics/owner<?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"); ?
>»
;</a
>
544 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
547 if (!empty($flightover_array)) {
549 <div
class="col-md-6">
550 <h2
><?php
echo _("Top 20 Most Common Country a Flight was Over"); ?
></h2
>
552 //$flightover_array = $Stats->countAllFlightOverCountries();
553 if (count($flightover_array) == 0) print _("No data available");
555 print '<div id="chart10" class="chart" width="100%"></div><script>';
556 print 'var series = [';
557 $flightover_data = '';
558 foreach($flightover_array as $flightover_item) {
559 $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
561 $flightover_data = substr($flightover_data, 0, -1);
562 print $flightover_data;
564 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);';
565 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
566 print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
568 element: document.getElementById("chart10"),
569 projection: "mercator", // big world map
570 fills: { defaultFill: "#F5F5F5" },
574 borderColor: "#DEDEDE",
575 highlightBorderWidth: 2,
576 highlightFillColor: function(geo) {
577 return geo["fillColor"] || "#F5F5F5";
579 highlightBorderColor: "#B7B7B7",
580 done: function(datamap) {
581 datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
583 datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
586 popupTemplate: function(geo, data) {
587 if (!data) { return ; }
588 return ['."'".'<div class="hoverinfo">'."','<strong>', geo.properties.name, '</strong>','<br>Count: <strong>', data.numberOfThings, '</strong>','</div>'].join('');
596 <a href
="<?php print $globalURL; ?>/statistics/country<?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"); ?
>»
;</a
>
603 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
607 if ($type == 'marine') {
608 $flightover_array = $Stats->countAllMarineOverCountries(true,$filter_name,$year,$month);
610 <!-- <div
class="row column">-->
611 <div
class="col-md-6">
612 <h2
><?php
echo _("Top 20 Most Common Country a Vessel was inside"); ?
></h2
>
614 if (count($flightover_array) == 0) print _("No data available");
616 print '<div id="chart10" class="chart" width="100%"></div><script>';
617 print 'var series = [';
618 $flightover_data = '';
619 foreach($flightover_array as $flightover_item) {
620 $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
622 $flightover_data = substr($flightover_data, 0, -1);
623 print $flightover_data;
625 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);';
626 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
627 print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
629 element: document.getElementById("chart10"),
630 projection: "mercator", // big world map
631 fills: { defaultFill: "#F5F5F5" },
635 borderColor: "#DEDEDE",
636 highlightBorderWidth: 2,
637 highlightFillColor: function(geo) {
638 return geo["fillColor"] || "#F5F5F5";
640 highlightBorderColor: "#B7B7B7",
641 done: function(datamap) {
642 datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
644 datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
647 popupTemplate: function(geo, data) {
648 if (!data) { return ; }
649 return ['."'".'<div class="hoverinfo">'."','<strong>', geo.properties.name, '</strong>','<br>Count: <strong>', data.numberOfThings, '</strong>','</div>'].join('');
657 <a href
="<?php print $globalURL; ?>/marine/statistics/country" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
659 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
665 if ($type == 'tracker') {
666 $flightover_array = $Stats->countAllTrackerOverCountries(true);
668 <!-- <div
class="row column">-->
669 <div
class="col-md-6">
670 <h2
><?php
echo _("Top 20 Most Common Country a Tracker was inside"); ?
></h2
>
672 if (count($flightover_array) == 0) print _("No data available");
674 print '<div id="chart10" class="chart" width="100%"></div><script>';
675 print 'var series = [';
676 $flightover_data = '';
677 foreach($flightover_array as $flightover_item) {
678 $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
680 $flightover_data = substr($flightover_data, 0, -1);
681 print $flightover_data;
683 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);';
684 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
685 print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});';
687 element: document.getElementById("chart10"),
688 projection: "mercator", // big world map
689 fills: { defaultFill: "#F5F5F5" },
693 borderColor: "#DEDEDE",
694 highlightBorderWidth: 2,
695 highlightFillColor: function(geo) {
696 return geo["fillColor"] || "#F5F5F5";
698 highlightBorderColor: "#B7B7B7",
699 done: function(datamap) {
700 datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
702 datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
705 popupTemplate: function(geo, data) {
706 if (!data) { return ; }
707 return ['."'".'<div class="hoverinfo">'."','<strong>', geo.properties.name, '</strong>','<br>Count: <strong>', data.numberOfThings, '</strong>','</div>'].join('');
715 <a href
="<?php print $globalURL; ?>/tracker/statistics/country" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
722 if ($type == 'aircraft') {
724 <div
class="row column">
725 <div
class="col-md-6">
727 $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
728 if (count($airport_airport_array) > 0) {
729 print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
730 print '<div id="chart3" class="chart" width="100%"></div><script>';
732 print 'var series = [';
734 foreach($airport_airport_array as $airport_item) {
735 $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
737 $airport_data = substr($airport_data, 0, -1);
740 print 'var onlyValues = series.map(function(obj){ return obj[0]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'."\n";
741 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'."\n";
742 print 'var radiusScale = d3.scale.log().domain([minValue,maxValue]).range([0,10]);'."\n";
743 print 'var dataset = [];'."\n";
744 print 'var colorset = [];'."\n";
745 print 'colorset["defaultFill"] = "#F5F5F5";';
746 print 'series.forEach(function(item){'."\n";
747 print 'var cnt = item[0], nm = item[1], lat = item[2], long = item[3];'."\n";
748 print 'colorset[nm] = paletteScale(cnt);';
749 print 'dataset.push({ count: cnt, name: nm, radius: Math.floor(radiusScale(cnt)), latitude: lat, longitude: long, fillKey: nm });'."\n";
751 print 'var bbl = new Datamap({
752 element: document.getElementById("chart3"),
753 projection: "mercator", // big world map
757 borderColor: "#DEDEDE",
758 highlightBorderWidth: 2,
759 highlightFillColor: function(geo) {
760 return geo["fillColor"] || "#F5F5F5";
762 highlightBorderColor: "#B7B7B7"
764 done: function(datamap) {
765 datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
767 datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
771 bbl.bubbles(dataset,{
772 popupTemplate: function(geo, data) {
773 if (!data) { return ; }
774 return ['."'".'<div class="hoverinfo">'."','<strong>', data.name, '</strong>','<br>Count: <strong>', data.count, '</strong>','</div>'].join('');
778 print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure';
779 if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
780 print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>';
784 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
786 <div
class="col-md-6">
788 $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
789 if (count($airport_airport_array2) > 0) {
790 print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
791 print '<div id="chart4" class="chart" width="100%"></div><script>';
793 print 'var series = [';
795 foreach($airport_airport_array2 as $airport_item)
797 if (isset($airport_item['airport_arrival_longitude']) && isset($airport_item['airport_arrival_latitude'])) {
798 $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
801 $airport_data = substr($airport_data, 0, -1);
804 print 'var onlyValues = series.map(function(obj){ return obj[0]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'."\n";
805 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'."\n";
806 print 'var radiusScale = d3.scale.log().domain([minValue,maxValue]).range([0,10]);'."\n";
807 print 'var dataset = [];'."\n";
808 print 'var colorset = [];'."\n";
809 print 'colorset["defaultFill"] = "#F5F5F5";';
810 print 'series.forEach(function(item){'."\n";
811 print 'var cnt = item[0], nm = item[1], lat = item[2], long = item[3];'."\n";
812 print 'colorset[nm] = paletteScale(cnt);';
813 print 'dataset.push({ count: cnt, name: nm, radius: Math.floor(radiusScale(cnt)), latitude: lat, longitude: long, fillKey: nm });'."\n";
815 print 'var bbl = new Datamap({
816 element: document.getElementById("chart4"),
817 projection: "mercator", // big world map
821 borderColor: "#DEDEDE",
822 highlightBorderWidth: 2,
823 highlightFillColor: function(geo) {
824 return geo["fillColor"] || "#F5F5F5";
826 highlightBorderColor: "#B7B7B7"
828 done: function(datamap) {
829 datamap.svg.call(d3.behavior.zoom().on("zoom", redraw));
831 datamap.svg.selectAll("g").attr("transform", "translate(" + d3.event.translate + ")scale(" + d3.event.scale + ")");
835 bbl.bubbles(dataset,{
836 popupTemplate: function(geo, data) {
837 if (!data) { return ; }
838 return ['."'".'<div class="hoverinfo">'."','<strong>', data.name, '</strong>','<br>Count: <strong>', data.count, '</strong>','</div>'].join('');
842 print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
843 if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
844 print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>';
849 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
852 if ($type == 'aircraft') {
855 if ($year == '' && $month == '') {
857 <div
class="row column">
858 <div
class="col-md-6">
859 <h2
><?php
echo _("Busiest Months of the last 12 Months"); ?
></h2
>
861 $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
862 if (count($year_array) == 0) print _("No data available");
864 print '<div id="chart8" class="chart" width="100%"></div><script>';
867 foreach($year_array as $year_item) {
868 $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
869 $year_cnt .= $year_item['date_count'].',';
871 $year_data = "['x',".substr($year_data, 0, -1)."]";
872 $year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
876 columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
877 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Flights"}},legend: { show: false }});';
882 <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"); ?
>»
;</a
>
885 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
886 <div
class="col-md-6">
887 <h2
><?php
echo _("Busiest Day in the last Month"); ?
></h2
>
889 $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
890 if (count($month_array) == 0) print _("No data available");
892 print '<div id="chart9" class="chart" width="100%"></div><script>';
895 foreach($month_array as $month_item) {
896 $month_data .= '"'.$month_item['date_name'].'",';
897 $month_cnt .= $month_item['date_count'].',';
899 $month_data = "['x',".substr($month_data, 0, -1)."]";
900 $month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
904 columns: ['.$month_data.','.$month_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
905 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
910 <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"); ?
>»
;</a
>
913 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
915 <div
class="col-md-6">
916 <h2
><?php
echo _("Busiest Day in the last 7 Days"); ?
></h2
>
918 $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
919 if (empty($date_array)) print _("No data available");
921 print '<div id="chart5" class="chart" width="100%"></div><script>';
924 foreach($date_array as $date_item) {
925 $date_data .= '"'.$date_item['date_name'].'",';
926 $date_cnt .= $date_item['date_count'].',';
928 $date_data = "['x',".substr($date_data, 0, -1)."]";
929 $date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
933 columns: ['.$date_data.','.$date_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
934 axis: { x: { type: "timeseries",tick: { format: "%Y-%m-%d"}}, y: { label: "# of Flights"}},legend: { show: false }});';
939 <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"); ?
>»
;</a
>
942 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
943 <div
class="col-md-6">
944 <h2
><?php
echo _("Busiest Time of the Day"); ?
></h2
>
946 $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
947 if (empty($hour_array)) print _("No data available");
949 print '<div id="chart6" class="chart" width="100%"></div><script>';
952 foreach($hour_array as $hour_item) {
953 $hour_data .= '"'.$hour_item['hour_name'].':00",';
954 $hour_cnt .= $hour_item['hour_count'].',';
956 $hour_data = "[".substr($hour_data, 0, -1)."]";
957 $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
961 columns: ['.$hour_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
962 axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
967 <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"); ?
>»
;</a
>
970 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
977 if ($type == 'marine') {
980 if ($year == '' && $month == '') {
982 <div
class="row column">
983 <div
class="col-md-6">
984 <h2
><?php
echo _("Busiest Months of the last 12 Months"); ?
></h2
>
986 $year_array = $Stats->countAllMarineMonthsLastYear(true,$filter_name);
987 if (count($year_array) == 0) print _("No data available");
989 print '<div id="chart8" class="chart" width="100%"></div><script>';
992 foreach($year_array as $year_item) {
993 $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
994 $year_cnt .= $year_item['date_count'].',';
996 $year_data = "['x',".substr($year_data, 0, -1)."]";
997 $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
1001 columns: ['.$year_data.','.$year_cnt.'], types: { vessels: "area"}, colors: { vessels: "#1a3151"}},
1002 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Vessels"}},legend: { show: false }});';
1007 <a href
="<?php print $globalURL; ?>/marine/statistics/year" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1011 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1012 <div
class="col-md-6">
1013 <h2
><?php
echo _("Busiest Day in the last Month"); ?
></h2
>
1015 $month_array = $Stats->countAllMarineDatesLastMonth($filter_name);
1016 if (count($month_array) == 0) print _("No data available");
1018 print '<div id="chart9" class="chart" width="100%"></div><script>';
1021 foreach($month_array as $month_item) {
1022 $month_data .= '"'.$month_item['date_name'].'",';
1023 $month_cnt .= $month_item['date_count'].',';
1025 $month_data = "['x',".substr($month_data, 0, -1)."]";
1026 $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
1027 print 'c3.generate({
1030 columns: ['.$month_data.','.$month_cnt.'], types: { vessels: "area"}, colors: { vessels: "#1a3151"}},
1031 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "# of Vessels"}},legend: { show: false }});';
1036 <a href
="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1039 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1041 <div
class="col-md-6">
1042 <h2
><?php
echo _("Busiest Day in the last 7 Days"); ?
></h2
>
1044 $date_array = $Stats->countAllMarineDatesLast7Days($filter_name);
1045 if (empty($date_array)) print _("No data available");
1047 print '<div id="chart5" class="chart" width="100%"></div><script>';
1050 foreach($date_array as $date_item) {
1051 $date_data .= '"'.$date_item['date_name'].'",';
1052 $date_cnt .= $date_item['date_count'].',';
1054 $date_data = "['x',".substr($date_data, 0, -1)."]";
1055 $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
1056 print 'c3.generate({
1059 columns: ['.$date_data.','.$date_cnt.'], types: { vessels: "area"}, colors: { vessels: "#1a3151"}},
1060 axis: { x: { type: "timeseries",tick: { format: "%Y-%m-%d"}}, y: { label: "# of Vessels"}},legend: { show: false }});';
1065 <a href
="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1068 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1069 <div
class="col-md-6">
1070 <h2
><?php
echo _("Busiest Time of the Day"); ?
></h2
>
1072 $hour_array = $Stats->countAllMarineHours('hour',true,$filter_name);
1073 if (empty($hour_array)) print _("No data available");
1075 print '<div id="chart6" class="chart" width="100%"></div><script>';
1078 foreach($hour_array as $hour_item) {
1079 $hour_data .= '"'.$hour_item['hour_name'].':00",';
1080 $hour_cnt .= $hour_item['hour_count'].',';
1082 $hour_data = "[".substr($hour_data, 0, -1)."]";
1083 $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1084 print 'c3.generate({
1087 columns: ['.$hour_cnt.'], types: { vessels: "area"}, colors: { vessels: "#1a3151"}},
1088 axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Vessels"}},legend: { show: false }});';
1093 <a href
="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1096 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1103 if ($type == 'tracker') {
1106 if ($year == '' && $month == '') {
1108 <div
class="row column">
1109 <div
class="col-md-6">
1110 <h2
><?php
echo _("Busiest Months of the last 12 Months"); ?
></h2
>
1112 $year_array = $Stats->countAllTrackerMonthsLastYear(true);
1113 if (count($year_array) == 0) print _("No data available");
1115 print '<div id="chart8" class="chart" width="100%"></div><script>';
1118 foreach($year_array as $year_item) {
1119 $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1120 $year_cnt .= $year_item['date_count'].',';
1122 $year_data = "['x',".substr($year_data, 0, -1)."]";
1123 $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1124 print 'c3.generate({
1127 columns: ['.$year_data.','.$year_cnt.'], types: { trackers: "area"}, colors: { trackers: "#1a3151"}},
1128 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Trackers"}},legend: { show: false }});';
1133 <a href
="<?php print $globalURL; ?>/tracker/statistics/year" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1137 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1138 <div
class="col-md-6">
1139 <h2
><?php
echo _("Busiest Day in the last Month"); ?
></h2
>
1141 $month_array = $Stats->countAllTrackerDatesLastMonth();
1142 if (count($month_array) == 0) print _("No data available");
1144 print '<div id="chart9" class="chart" width="100%"></div><script>';
1147 foreach($month_array as $month_item) {
1148 $month_data .= '"'.$month_item['date_name'].'",';
1149 $month_cnt .= $month_item['date_count'].',';
1151 $month_data = "['x',".substr($month_data, 0, -1)."]";
1152 $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1153 print 'c3.generate({
1156 columns: ['.$month_data.','.$month_cnt.'], types: { trackers: "area"}, colors: { trackers: "#1a3151"}},
1157 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "# of Trackers"}},legend: { show: false }});';
1162 <a href
="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1165 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1167 <div
class="col-md-6">
1168 <h2
><?php
echo _("Busiest Day in the last 7 Days"); ?
></h2
>
1170 $date_array = $Stats->countAllTrackerDatesLast7Days();
1171 if (empty($date_array)) print _("No data available");
1173 print '<div id="chart5" class="chart" width="100%"></div><script>';
1176 foreach($date_array as $date_item) {
1177 $date_data .= '"'.$date_item['date_name'].'",';
1178 $date_cnt .= $date_item['date_count'].',';
1180 $date_data = "['x',".substr($date_data, 0, -1)."]";
1181 $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1182 print 'c3.generate({
1185 columns: ['.$date_data.','.$date_cnt.'], types: { trackers: "area"}, colors: { trackers: "#1a3151"}},
1186 axis: { x: { type: "timeseries",tick: { format: "%Y-%m-%d"}}, y: { label: "# of Trackers"}},legend: { show: false }});';
1191 <a href
="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1194 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1195 <div
class="col-md-6">
1196 <h2
><?php
echo _("Busiest Time of the Day"); ?
></h2
>
1198 $hour_array = $Stats->countAllTrackerHours('hour',true);
1199 if (empty($hour_array)) print _("No data available");
1201 print '<div id="chart6" class="chart" width="100%"></div><script>';
1204 foreach($hour_array as $hour_item) {
1205 $hour_data .= '"'.$hour_item['hour_name'].':00",';
1206 $hour_cnt .= $hour_item['hour_count'].',';
1208 $hour_data = "[".substr($hour_data, 0, -1)."]";
1209 $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1210 print 'c3.generate({
1213 columns: ['.$hour_cnt.'], types: { trackers: "area"}, colors: { trackers: "#1a3151"}},
1214 axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Trackers"}},legend: { show: false }});';
1219 <a href
="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1222 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1229 if ($type == 'satellite') {
1232 if ($year == '' && $month == '') {
1234 <div
class="row column">
1235 <div
class="col-md-6">
1236 <h2
><?php
echo _("Busiest Launch Months of the last 12 Months"); ?
></h2
>
1238 $year_array = $Satellite->countAllMonthsLastYear();
1239 if (count($year_array) == 0) print _("No data available");
1241 print '<div id="chart21" class="chart" width="100%"></div><script>';
1244 foreach($year_array as $year_item) {
1245 $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1246 $year_cnt .= $year_item['date_count'].',';
1248 $year_data = "['x',".substr($year_data, 0, -1)."]";
1249 $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1250 print 'c3.generate({
1253 columns: ['.$year_data.','.$year_cnt.'], types: { trackers: "area"}, colors: { satellite: "#1a3151"}},
1254 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "# of Satellite"}},legend: { show: false }});';
1260 <a href
="<?php print $globalURL; ?>/tracker/statistics/year" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1265 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1266 <div
class="col-md-6">
1267 <h2
><?php
echo _("Busiest Launch Years of the last 10 Years"); ?
></h2
>
1269 $year_array = $Satellite->countAllYears();
1270 if (count($year_array) == 0) print _("No data available");
1272 print '<div id="chart22" class="chart" width="100%"></div><script>';
1275 foreach($year_array as $year_item) {
1276 $year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1277 $year_cnt .= $year_item['date_count'].',';
1279 $year_data = "['x',".substr($year_data, 0, -1)."]";
1280 $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1281 print 'c3.generate({
1284 columns: ['.$year_data.','.$year_cnt.'], types: { trackers: "area"}, colors: { satellite: "#1a3151"}},
1285 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y"}}, y: { label: "# of Satellite"}},legend: { show: false }});';
1291 <a href
="<?php print $globalURL; ?>/tracker/statistics/year" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1296 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1303 if ($type == 'aircraft') {
1306 if (($airline_icao == '' ||
$airline_icao == 'all') && $year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
1308 <div
class="row column">
1309 <div
class="col-md-6">
1310 <h2
><?php
echo _("Fatalities by Years"); ?
></h2
>
1312 $year_array = $Stats->countFatalitiesByYear();
1313 if (count($year_array) == 0) print _("No data available");
1315 print '<div id="chart32" class="chart" width="100%"></div><script>';
1318 foreach($year_array as $year_item) {
1319 $year_data .= '"'.$year_item['year'].'-01-01",';
1320 $year_cnt .= $year_item['count'].',';
1322 $year_data = "['x',".substr($year_data, 0, -1)."]";
1323 $year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1324 print 'c3.generate({
1327 columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1328 axis: { x: { type: "timeseries",tick: { format: "%Y"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
1333 <a href
="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1336 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1338 <div
class="row column">
1339 <div
class="col-md-6">
1340 <h2
><?php
echo _("Fatalities last 12 Months"); ?
></h2
>
1342 $year_array = $Stats->countFatalitiesLast12Months();
1343 if (count($year_array) == 0) print _("No data available");
1345 print '<div id="chart33" class="chart" width="100%"></div><script>';
1348 foreach($year_array as $year_item) {
1349 $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1350 $year_cnt .= $year_item['count'].',';
1352 $year_data = "['x',".substr($year_data, 0, -1)."]";
1353 $year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1354 print 'c3.generate({
1357 columns: ['.$year_data.','.$year_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1358 axis: { x: { type: "timeseries",tick: { format: "%Y-%m"}}, y: { label: "# of Fatalities"}},legend: { show: false }});';
1363 <a href
="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role
="button"><?php
echo _("See full statistic"); ?
>»
;</a
>
1366 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1373 if (($airline_icao == '' ||
$airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '' && (!isset($globalSatellite) ||
$globalSatellite === FALSE)) {
1375 <div
class="row column">
1377 //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1378 if ($year == '' && $month == '') {
1379 if ($type == 'aircraft') {
1380 $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1381 } elseif ($type == 'marine') {
1382 $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1383 } elseif ($type == 'tracker') {
1384 $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1387 if ($type == 'aircraft') {
1388 $polar = $Stats->getStatsSource('polar',$year,$month);
1389 } elseif ($type == 'marine') {
1390 $polar = $Stats->getStatsSource('polar_marine',$year,$month);
1391 } elseif ($type == 'tracker') {
1392 $polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1395 if (!empty($polar)) {
1396 print '<h2>'._("Coverage pattern").'</h2>';
1397 foreach ($polar as $eachpolar) {
1399 $Spotter = new Spotter();
1400 $data = json_decode($eachpolar['source_data']);
1401 foreach($data as $value => $key) {
1402 $direction = $Spotter->parseDirection(($value*22.5));
1405 if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1406 $distance = round($distance*0.539957);
1408 } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1409 $distance = round($distance*0.621371);
1411 } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') ||
!isset($globalUnitDistance))) ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
1412 $distance = $distance;
1415 if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1416 else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1419 <div
class="col-md-6">
1420 <h4
><?php
print $eachpolar['source_name']; ?
></h4
>
1421 <div id
="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width
="100%"></div
>
1424 var margin
= {top
: 100, right
: 100, bottom
: 100, left
: 100},
1425 width
= Math
.min(700, window
.innerWidth
- 10) - margin
.left
- margin
.right
,
1426 height
= Math
.min(width
, window
.innerHeight
- margin
.top
- margin
.bottom
- 20);
1429 <?php
print $polar_data; ?
>
1432 var color
= d3
.scale
.ordinal().range(["#EDC951","#CC333F","#00A0B0"]);
1433 //var color = d3.scaleOrdinal().range(["#EDC951","#CC333F","#00A0B0"]);
1435 var radarChartOptions
= {
1443 unit
: '<?php echo $unit; ?>'
1445 RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data
, radarChartOptions
);
1454 <div
class="row column">
1455 <div
class="col-md-6">
1457 //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1458 if ($year == '' && $month == '') {
1459 if ($type == 'aircraft') {
1460 $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1461 } elseif ($type == 'marine') {
1462 $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1463 } elseif ($type == 'tracker') {
1464 $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1467 if ($type == 'aircraft') {
1468 $msg = $Stats->getStatsSource('msg',$year,$month);
1469 } elseif ($type == 'marine') {
1470 $msg = $Stats->getStatsSource('msg_marine',$year,$month);
1471 } elseif ($type == 'tracker') {
1472 $msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1476 print '<h2>'._("Messages received").'</h2>';
1477 foreach ($msg as $eachmsg) {
1478 //$eachmsg = $msg[0];
1479 $data = $eachmsg['source_data'];
1480 if ($data > 500) $max = (round(($data+
100)/100))*100;
1483 <div id
="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div
>
1485 var g
= new JustGage({
1486 id
: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1487 value
: <?php
echo $data; ?
>,
1489 max
: <?php
print $max; ?
>,
1490 valueMinFontSize
: 10,
1494 title
: "<?php print $eachmsg['source_name']; ?>"
1503 <div
class="row column">
1505 //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1506 if ($year == '' && $month == '') {
1507 if ($type == 'aircraft') {
1508 $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1509 } elseif ($type == 'marine') {
1510 $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1511 } elseif ($type == 'tracker') {
1512 $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1515 if ($type == 'aircraft') {
1516 $hist = $Stats->getStatsSource('hist',$year,$month);
1517 } elseif ($type == 'marine') {
1518 $hist = $Stats->getStatsSource('hist_marine',$year,$month);
1519 } elseif ($type == 'tracker') {
1520 $hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1523 foreach ($hist as $hists) {
1525 $distance_data = '';
1527 $source = $hists['source_name'];
1528 $hist_array = json_decode($hists['source_data']);
1530 foreach($hist_array as $distance => $nb) {
1531 if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1532 $distance = round($distance*0.539957);
1534 } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1535 $distance = round($distance*0.621371);
1537 } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') ||
!isset($globalUnitDistance))) ||
(isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
1538 $distance = $distance;
1541 //$hist_data .= '[ "'.$distance.'",'.$nb.'],';
1542 $distance_data .= '"'.$distance.'",';
1543 $nb_data .= $nb.',';
1545 //$hist_data = substr($hist_data, 0, -1);
1546 $distance_data = "['x',".substr($distance_data, 0, -1)."]";
1547 $nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1549 <div
class="col-md-6">
1550 <h2
><?php
echo sprintf(_("Distance for %s"),$source); ?
></h2
>
1552 print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1553 print 'c3.generate({
1554 bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1556 columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1557 axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1561 <!-- <?php
print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?
> -->
1573 require_once('footer.php');