2 require_once('require/class.Connection.php');
3 require_once('require/class.Stats.php');
4 require_once('require/class.Language.php');
6 $title = _("Statistics").' - '._("Most common Airline");
7 require_once('header.php');
8 if (!isset($filter_name)) $filter_name = '';
9 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
10 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
11 include('statistics-sub-menu.php');
13 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
14 print '<script type="text/javascript" src="'.$globalURL.'/js/d3pie.min.js"></script>';
15 print '<div class="info">
16 <h1>'._("Most common Airline").'</h1>
18 <p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>';
20 $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
21 print '<div id="chart" class="chart" width="100%"></div><script>';
23 foreach($airline_array as $airline_item)
25 $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
27 $airline_data = substr($airline_data, 0, -1);
28 print 'var series = ['.$airline_data.'];';
29 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);';
30 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);';
31 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
32 print 'var airlinescnt = new d3pie("chart",{"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":';
34 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}}});';
37 if (!empty($airline_array))
39 print '<div class="table-responsive">';
40 print '<table class="common-airline table-striped">';
44 print '<th>'._("Airline").'</th>';
45 print '<th>'._("Country").'</th>';
46 print '<th>'._("# of times").'</th>';
50 foreach($airline_array as $airline_item)
53 print '<td><strong>'.$i.'</strong></td>';
54 print '<td class="logo">';
55 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'"><img src="';
56 if (isset($globalIVAO) && $globalIVAO && (@getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif') || @getimagesize
('images/airlines/'.$airline_item['airline_icao'].'.gif')))
58 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.gif';
59 } elseif (@getimagesize
('images/airlines/'.$airline_item['airline_icao'].'.png') || @getimagesize
($globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png'))
61 print $globalURL.'/images/airlines/'.$airline_item['airline_icao'].'.png';
63 print $globalURL.'/images/airlines/placeholder.png';
68 print '<a href="'.$globalURL.'/airline/'.$airline_item['airline_icao'].'">'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')</a>';
71 print '<a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $airline_item['airline_country'])).'">'.$airline_item['airline_country'].'</a>';
73 print '<td>'.$airline_item['airline_count'].'</td>';
81 require_once('footer.php');