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');
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 Time of Day 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>';
24 include('ident-sub-menu.php');
25 print '<div class="column">';
26 print '<h2>'._("Most Common Time of Day").'</h2>';
27 print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
28 $hour_array = $Spotter->countAllHoursByIdent($ident);
29 print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
30 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
31 print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>';
32 print '<div id="chartHour" class="chart" width="100%"></div><script>';
36 foreach($hour_array as $hour_item)
38 while($last != $hour_item['hour_name']) {
39 $hour_data .= '"'.$last.':00",';
44 $hour_data .= '"'.$hour_item['hour_name'].':00",';
45 $hour_cnt .= $hour_item['hour_count'].',';
47 $hour_data = "['x',".substr($hour_data, 0, -1)."]";
48 $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
54 columns: ['.$hour_cnt.','.$hour_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}
57 x: { type: "timeseries", tick: { format: "%H:%M" }},
58 y: { label: "# of Flights",tick: { format: d3.format("d") }}
60 legend: { show: false }
63 if (!empty($hour_array))
65 print '<div class="table-responsive">';
66 print '<table class="common-hour table-striped">';
68 print '<th>'._("Hour").'</th>';
69 print '<th>'._("Number").'</th>';
73 foreach($hour_array as $hour_item)
76 print '<td>'.$hour_item['hour_name'].':00</td>';
77 print '<td>'.$hour_item['hour_count'].'</td>';
88 require_once('header.php');
89 print '<h1>'._("Error").'</h1>';
90 print '<p>'._("Sorry, this ident/callsign is not in the database. :(").'</p>';
93 require_once('footer.php');