2 require_once('require/class.Connection.php');
3 require_once('require/class.Stats.php');
4 require_once('require/class.Language.php');
6 $title = _("Statistics").' - '._("Busiest Time of the Day");
9 if (isset($_GET['marine'])) {
11 require_once('require/class.Marine.php');
12 $Marine = new Marine();
13 } elseif (isset($_GET['tracker'])) {
15 require_once('require/class.Tracker.php');
16 $Tracker = new Tracker();
19 if (!isset($filter_name)) $filter_name = '';
20 $airline_icao = (string)filter_input(INPUT_GET
,'airline',FILTER_SANITIZE_STRING
);
21 if ($airline_icao == '' && isset($globalFilter)) {
22 if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 require_once('header.php');
26 include('statistics-sub-menu.php');
28 print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
29 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
30 print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>';
31 print '<div class="info">
32 <h1>'._("Busiest Time of the Day").'</h1>
34 <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>';
36 if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
37 elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true);
38 elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true);
39 print '<div id="chartHour" class="chart" width="100%"></div><script>';
43 foreach($hour_array as $hour_item)
45 while($last != $hour_item['hour_name']) {
46 $hour_data .= '"'.$last.':00",';
51 $hour_data .= '"'.$hour_item['hour_name'].':00",';
52 $hour_cnt .= $hour_item['hour_count'].',';
54 $hour_data = "[".substr($hour_data, 0, -1)."]";
55 $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
59 columns: ['.$hour_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
60 axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});';
63 if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name);
64 elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true);
65 elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true);
66 if (!empty($hour_array))
68 print '<div class="table-responsive">';
69 print '<table class="common-hour table-striped">';
72 print '<th>'._("Hour").'</th>';
73 print '<th>'._("Number").'</th>';
77 foreach($hour_array as $hour_item)
80 print '<td><strong>'.$i.'</strong></td>';
81 print '<td>'.$hour_item['hour_name'].':00</td>';
82 print '<td>'.$hour_item['hour_count'].'</td>';
91 require_once('footer.php');