-
Notifications
You must be signed in to change notification settings - Fork 159
/
acars-latest.php
52 lines (46 loc) · 1.61 KB
/
acars-latest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once('require/class.Connection.php');
require_once('require/class.ACARS.php');
require_once('require/class.Language.php');
$ACARS = new ACARS();
$title = _("Latest ACARS messages");
require_once('header.php');
$page_url = $globalURL.'/acars-latest';
if (!isset($_GET['limit']))
{
$limit_start = 0;
$limit_end = 25;
$absolute_difference = 25;
} else {
$limit_explode = explode(",", $_GET['limit']);
$limit_start = $limit_explode[0];
$limit_end = $limit_explode[1];
if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) {
$limit_start = 0;
$limit_end = 25;
}
}
$absolute_difference = abs($limit_start - $limit_end);
$limit_next = $limit_end + $absolute_difference;
$limit_previous_1 = $limit_start - $absolute_difference;
$limit_previous_2 = $limit_end - $absolute_difference;
print '<div class="info column">';
print '<h1>'._("Latest ACARS messages").'</h1>';
print '</div>';
print '<div class="table column">';
print '<p>'._("The table below shows the latest ACARS messages.").'</p>';
$spotter_array = $ACARS->getLatestAcarsData($limit_start.",".$absolute_difference);
if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) {
include('table-output.php');
print '<div class="pagination">';
if ($limit_previous_1 >= 0) {
print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>';
}
if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>';
}
print '</div>';
}
print '</div>';
require_once('footer.php');
?>