Merge pull request #456 from Struart88/patch-2
[FlightAirMap.git] / ident-statistics-manufacturer.php
blobee1e188c247ed45ab9409ac291d8a48b3fe53a35
1 <?php
2 require_once('require/class.Connection.php');
3 require_once('require/class.Spotter.php');
4 require_once('require/class.Language.php');
5 if (!isset($_GET['ident'])) {
6 header('Location: '.$globalURL.'/ident');
7 die();
9 $Spotter = new Spotter();
10 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11 $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12 $spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort);
14 if (!empty($spotter_array))
16 $title = sprintf(_("Most Common Aircraft Manufacturer of %s"),$spotter_array[0]['ident']);
17 require_once('header.php');
18 print '<div class="info column">';
19 print '<h1>'.$spotter_array[0]['ident'].'</h1>';
20 print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
21 print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>';
22 print '</div>';
24 include('ident-sub-menu.php');
25 print '<div class="column">';
26 print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
27 print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
29 $manufacturers_array = $Spotter->countAllAircraftManufacturerByIdent($ident);
30 if (!empty($manufacturers_array))
32 print '<div class="table-responsive">';
33 print '<table class="common-manufacturer table-striped">';
34 print '<thead>';
35 print '<th></th>';
36 print '<th>'._("Aircraft Manufacturer").'</th>';
37 print '<th>'._("# of times").'</th>';
38 print '<th></th>';
39 print '</thead>';
40 print '<tbody>';
41 $i = 1;
42 foreach($manufacturers_array as $manufacturer_item)
44 print '<tr>';
45 print '<td><strong>'.$i.'</strong></td>';
46 print '<td>';
47 print '<a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'">'.$manufacturer_item['aircraft_manufacturer'].'</a>';
48 print '</td>';
49 print '<td>';
50 print $manufacturer_item['aircraft_manufacturer_count'];
51 print '</td>';
52 print '<td><a href="'.$globalURL.'/search?manufacturer='.strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer'])).'&callsign='.$ident.'">'._("Search flights").'</a></td>';
53 print '</tr>';
54 $i++;
56 print '<tbody>';
57 print '</table>';
58 print '</div>';
60 print '</div>';
61 } else {
62 $title = _("Ident");
63 require_once('header.php');
64 print '<h1>'._("Error").'</h1>';
65 print '<p>'._("Sorry, this ident/callsign is not in the database. :(").'</p>';
68 require_once('footer.php');