forked from Ysurac/FlightAirMap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
accident-latest.php
47 lines (41 loc) · 1.63 KB
/
accident-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
<?php
require_once('require/class.Connection.php');
require_once('require/class.Accident.php');
require_once('require/class.Language.php');
$Accident = new Accident();
$title = _("Latest accidents");
require_once('header.php');
$page_url = $globalURL.'/accident-latest';
if(!isset($_GET['limit']))
{
$limit_start = 0;
$limit_end = 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 Accidents").'</h1>';
print '</div>';
print '<div class="table column">';
print '<p>'._("The table below shows the latest Accidents.").'</p>';
$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident');
if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $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');
?>