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 Aircraft Manufacturer");
8 if (!isset($filter_name)) $filter_name = '';
9 $airline_icao = (string)filter_input(INPUT_GET
,'airline',FILTER_SANITIZE_STRING
);
10 if ($airline_icao == '' && isset($globalFilter)) {
11 if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
14 $year = filter_input(INPUT_GET
,'year',FILTER_SANITIZE_NUMBER_INT
);
15 $month = filter_input(INPUT_GET
,'month',FILTER_SANITIZE_NUMBER_INT
);
17 require_once('header.php');
18 include('statistics-sub-menu.php');
20 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
21 print '<script type="text/javascript" src="'.$globalURL.'/js/d3pie.min.js"></script>';
22 print '<div class="info">
23 <h1>'._("Most common Aircraft Manufacturer").'</h1>
25 <p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>';
27 $manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline_icao,$filter_name,$year,$month);
28 print '<div id="chart" class="chart" width="100%"></div><script>';
29 $manufacturer_data = '';
30 foreach($manufacturers_array as $manufacturer_item)
32 $manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],';
34 $aircraft_data = substr($manufacturer_data, 0, -1);
35 print 'var series = ['.$aircraft_data.'];';
36 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);';
37 print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
38 print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
39 print 'var aircraftype = 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":';
41 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}}});';
44 if (!empty($manufacturers_array))
46 print '<div class="table-responsive">';
47 print '<table class="common-manufacturer table-striped">';
50 print '<th>'._("Aircraft Manufacturer").'</th>';
51 print '<th>'._("# of times").'</th>';
55 foreach($manufacturers_array as $manufacturer_item)
58 print '<td><strong>'.$i.'</strong></td>';
60 print '<a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'">'.$manufacturer_item['aircraft_manufacturer'].'</a>';
63 print $manufacturer_item['aircraft_manufacturer_count'];
72 require_once('footer.php');