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 Month of Last Year");
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();
18 if (!isset($filter_name)) $filter_name = '';
19 $airline_icao = (string)filter_input(INPUT_GET
,'airline',FILTER_SANITIZE_STRING
);
20 if ($airline_icao == '' && isset($globalFilter)) {
21 if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
24 require_once('header.php');
25 include('statistics-sub-menu.php');
27 print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
28 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
29 print '<script type="text/javascript" src="'.$globalURL.'/js/c3.min.js"></script>';
30 print '<div class="info">
31 <h1>'._("Busiest Day Last Month").'</h1>
33 <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>';
35 if ($type == 'aircraft') $date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
36 elseif ($type == 'marine') $date_array = $Marine->countAllDatesLastMonth();
37 elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLastMonth();
39 print '<div id="chart" class="chart" width="100%"></div><script>';
42 foreach($date_array as $month_item)
44 $month_data .= '"'.$month_item['date_name'].'",';
45 $month_cnt .= $month_item['date_count'].',';
47 $month_data = "['x',".substr($month_data, 0, -1)."]";
48 $month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
52 columns: ['.$month_data.','.$month_cnt.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
53 axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m-%d"}}, y: { label: "#"}},legend: { show: false }});';
56 //$date_array = $Stats->countAllDates();
57 if (!empty($date_array))
59 foreach($date_array as $key => $row) {
60 $years[$key] = $row['date_name'];
61 $counts[$key] = $row['date_count'];
63 array_multisort($counts,SORT_DESC
,$date_array);
64 print '<div class="table-responsive">';
65 print '<table class="common-date table-striped">';
68 print '<th>'._("Date").'</th>';
69 print '<th>'._("Number").'</th>';
73 foreach($date_array as $date_item)
76 print '<td><strong>'.$i.'</strong></td>';
78 if ($type == 'aircraft') print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
79 else print '<a href="'.$globalURL.'/'.$type.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>';
82 print $date_item['date_count'];
92 require_once('footer.php');