Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created

statistics-manufacturer.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
require_once('require/class.Connection.php');
3
require_once('require/class.Stats.php');
4
require_once('require/class.Language.php');
5
$Stats = new Stats();
6
$title = _("Statistics").' - '._("Most common Aircraft Manufacturer");
7
require_once('header.php');
8
include('statistics-sub-menu.php'); 
9
10
print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
11
 	<div class="info">
12
	  	<h1>'._("Most common Aircraft Manufacturer").'</h1>
13
		 </div>
14
    	<p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>';
15
 
16
$manufacturers_array = $Stats->countAllAircraftManufacturers();
17
print '<div id="chart" class="chart" width="100%"></div>
18
      	<script> 
19
      		google.load("visualization", "1", {packages:["corechart"]});
20
          google.setOnLoadCallback(drawChart);
21
          function drawChart() {
22
            var data = google.visualization.arrayToDataTable([
23
            	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
24
$manufacturer_data = '';
25
foreach($manufacturers_array as $manufacturer_item)
26
{
27
	$manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],';
28
}
29
$aircraft_data = substr($manufacturer_data, 0, -1);
30
print $manufacturer_data;
31
print ']);
32
    
33
            var options = {
34
            	chartArea: {"width": "80%", "height": "60%"},
35
            	height:500,
36
            	 is3D: true
37
            };
38
    
39
            var chart = new google.visualization.PieChart(document.getElementById("chart"));
40
            chart.draw(data, options);
41
          }
42
          $(window).resize(function(){
43
    			  drawChart();
44
    			});
45
      </script>';
46
47
if (!empty($manufacturers_array))
48
{
49
	print '<div class="table-responsive">';
50
	print '<table class="common-manufacturer table-striped">';
51
	print '<thead>';
52
	print '<th></th>';
53
	print '<th>'._("Aircraft Manufacturer").'</th>';
54
	print '<th>'._("# of times").'</th>';
55
	print '</thead>';
56
	print '<tbody>';
57
	$i = 1;
58
	foreach($manufacturers_array as $manufacturer_item)
59
	{
60
		print '<tr>';
61
		print '<td><strong>'.$i.'</strong></td>';
62
		print '<td>';
63
		print '<a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'">'.$manufacturer_item['aircraft_manufacturer'].'</a>';
64
		print '</td>';
65
		print '<td>';
66
		print $manufacturer_item['aircraft_manufacturer_count'];
67
		print '</td>';
68
		print '</tr>';
69
		$i++;
70
	}
71
	print '<tbody>';
72
	print '</table>';
73
	print '</div>';
74
}
75
require_once('footer.php');
76
?>
1 ignored issue
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...