-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathmyroutes.php
58 lines (43 loc) · 3.71 KB
/
myroutes.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
53
54
55
56
57
58
<?php
use src\Utils\Database\XDb;
use src\Utils\Text\InputFilter;
use src\Models\ApplicationContainer;
require_once (__DIR__.'/lib/common.inc.php');
//user logged in?
$loggedUser = ApplicationContainer::GetAuthorizedUser();
if (!$loggedUser) {
$target = urlencode(tpl_get_current_page());
tpl_redirect('login.php?target=' . $target);
exit;
}
$tplname = 'myroutes';
$user_id = $loggedUser->getUserId();
$route_rs = XDb::xSql(
"SELECT `route_id` ,`description` `desc`, `name`,`radius`,`length`
FROM `routes` WHERE `user_id`= ?
ORDER BY `route_id` DESC", $user_id);
if ( $routes_record = XDb::xFetchArray($route_rs) ) {
$routes = '<div class="headitems">';
$routes .= '<div style="width:80px;" class="myr">' . tr('route_name') . '</div><div class="ver"> </div><div style="width:295px;" class="myr"> ' . tr('route_desc') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('radius') . '</div><div class="ver"> </div><div style="width:60px;" class="myr"> ' . tr('length') . '</div><div class="ver"> </div><div style="width:70px;" class="myr"> ' . tr('caches') . '</div><div class="ver"> </div><div style="width:50px;" class="myr">' . tr('edit') . '</div><div class="ver"> </div><div style="width:20px;" class="myr"> ' . tr('delete') . '</div></div>';
do{
$desc = $routes_record['desc'];
if ($desc != '') {
$desc = InputFilter::cleanupUserInput($desc);
}
$routes .= '<div class="listitems">';
$routes .= '<table border="0" class="myr"><tr><td style="margin-left:3px;width:75px;" class="myr">' . $routes_record['name'] . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:297px;" class="myr">' . nl2br($desc) . '</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:65px;" class="myr">' . $routes_record['radius'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:62px;" class="myr">' . $routes_record['length'] . ' km</td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:73px;" class="myr"><a class="links" href="myroutes_search.php?routeid=' . $routes_record['route_id'] . '"><img src="/images/action/16x16-search.png" alt="" title=' . tr("search_caches_along_route") . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:53px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '"><img src="images/actions/edit-16.png" alt="" title=' . tr('edit_route') . ' /></a></td><td width="2" style="border-right:solid thin #7fa2ca"></td>
<td style="width:23px;" class="myr"><a class="links" href="myroutes_edit.php?routeid=' . $routes_record['route_id'] . '&delete" onclick="return confirm(\'' . tr("confirm_remove_route") . '\');"><img style="vertical-align: middle;" src="images/log/16x16-trash.png" alt="" title=' . tr('delete') . ' /></a></td></tr></table></div>';
} while( $routes_record = XDb::xFetchArray($route_rs));
$routes .= '';
tpl_set_var('content', $routes);
} else {
tpl_set_var('content', "<div class=\"listitems\"><br/><center><span style=\"font-size:140%;font-weight:bold \"> " . tr('no_routes') . "</span><br/><br/></center></div>");
}
XDb::xFreeResults($route_rs);
//make the template and send it out
tpl_BuildTemplate();