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").' - '._("Busiest Time of the Day"); |
7
|
|
|
|
8
|
|
|
$type = 'aircraft'; |
9
|
|
|
if (isset($_GET['marine'])) { |
10
|
|
|
$type = 'marine'; |
11
|
|
|
require_once('require/class.Marine.php'); |
12
|
|
|
$Marine = new Marine(); |
13
|
|
|
} elseif (isset($_GET['tracker'])) { |
14
|
|
|
$type = 'tracker'; |
15
|
|
|
require_once('require/class.Tracker.php'); |
16
|
|
|
$Tracker = new Tracker(); |
17
|
|
|
} |
18
|
|
|
|
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]; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
require_once('header.php'); |
26
|
|
|
include('statistics-sub-menu.php'); |
27
|
|
|
|
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> |
33
|
|
|
</div> |
34
|
|
|
<p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
35
|
|
|
|
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>'; |
40
|
|
|
$hour_data = ''; |
41
|
|
|
$hour_cnt = ''; |
42
|
|
|
$last = 0; |
43
|
|
|
foreach($hour_array as $hour_item) |
44
|
|
|
{ |
45
|
|
|
while($last != $hour_item['hour_name']) { |
46
|
|
|
$hour_data .= '"'.$last.':00",'; |
47
|
|
|
$hour_cnt .= '0,'; |
48
|
|
|
$last++; |
49
|
|
|
} |
50
|
|
|
$last++; |
51
|
|
|
$hour_data .= '"'.$hour_item['hour_name'].':00",'; |
52
|
|
|
$hour_cnt .= $hour_item['hour_count'].','; |
53
|
|
|
} |
54
|
|
|
$hour_data = "[".substr($hour_data, 0, -1)."]"; |
55
|
|
|
$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
56
|
|
|
print 'c3.generate({ |
57
|
|
|
bindto: "#chartHour", |
58
|
|
|
data: { |
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 }});'; |
61
|
|
|
print '</script>'; |
62
|
|
|
|
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)) |
67
|
|
|
{ |
68
|
|
|
print '<div class="table-responsive">'; |
69
|
|
|
print '<table class="common-hour table-striped">'; |
70
|
|
|
print '<thead>'; |
71
|
|
|
print '<th></th>'; |
72
|
|
|
print '<th>'._("Hour").'</th>'; |
73
|
|
|
print '<th>'._("Number").'</th>'; |
74
|
|
|
print '</thead>'; |
75
|
|
|
print '<tbody>'; |
76
|
|
|
$i = 1; |
77
|
|
|
foreach($hour_array as $hour_item) |
78
|
|
|
{ |
79
|
|
|
print '<tr>'; |
80
|
|
|
print '<td><strong>'.$i.'</strong></td>'; |
81
|
|
|
print '<td>'.$hour_item['hour_name'].':00</td>'; |
82
|
|
|
print '<td>'.$hour_item['hour_count'].'</td>'; |
83
|
|
|
print '</tr>'; |
84
|
|
|
$i++; |
85
|
|
|
} |
86
|
|
|
print '<tbody>'; |
87
|
|
|
print '</table>'; |
88
|
|
|
print '</div>'; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
require_once('footer.php'); |
92
|
|
|
?> |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: