forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcache_titled.php
76 lines (53 loc) · 2.25 KB
/
cache_titled.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
use Utils\Database\OcDb;
use Utils\Text\Formatter;
require_once('./lib/common.inc.php');
$tplname = 'cache_titled';
$usrid = -1;
if ( $usr != false )
$usrid = $usr['userid'];
$dbcLocCache = OcDb::instance();
$query="SELECT
caches.type cache_type, caches.name cacheName, caches.cache_id cache_id,
user.username userName, user.user_id user_id,
cache_location.adm3 cacheRegion, cache_titled.date_alg dateAlg
FROM cache_titled
JOIN caches on caches.cache_id = cache_titled.cache_id
JOIN user on user.user_id = caches.user_id
JOIN cache_location ON cache_location.cache_id = cache_titled.cache_id
WHERE caches.status=1";
$s = $dbcLocCache->simpleQuery($query);
$content="";
for( $i = 0; $i < $dbcLocCache->rowCount($s); $i++ )
{
$record = $dbcLocCache->dbResultFetch($s);
$cacheId = $record[ 'cache_id' ];
$cacheName = str_replace("'", "-", $record[ 'cacheName' ] );
$cacheName = str_replace("\"", " ", $cacheName);
$cacheNameRef = '<a href="viewcache.php?cacheid={cacheId}">{cacheName}<a>';
$cacheNameRef = str_replace('{cacheId}', $cacheId, $cacheNameRef );
$cacheNameRef = str_replace('{cacheName}', $cacheName, $cacheNameRef );
$cacheRegion = $record[ 'cacheRegion' ];
$ownId = $record[ 'user_id' ];
$userName = str_replace("'", "-", $record[ 'userName' ] );
$userName = str_replace("\"", " ", $userName);
$userNameRef = '<a href="viewprofile.php?userid={userId}">{userName}<a>';
$userNameRef = str_replace('{userId}', $ownId, $userNameRef );
$userNameRef = str_replace('{userName}', $userName, $userNameRef );
$dateAlg = Formatter::date($record[ 'dateAlg' ]);
$dateAlgSort = date("y.m.d", strtotime($record[ 'dateAlg' ]));
$cacheType = $record[ 'cache_type' ];
$typeIcon ='<img src="{src}" />';
$typeIcon = str_replace( "{src}", myninc::checkCacheStatusByUser($record, $usrid), $typeIcon );
$content .= "
gct.addEmptyRow();
gct.addToLastRow( 0, '$typeIcon' );
gct.addToLastRow( 1, '$cacheNameRef' );
gct.addToLastRow( 2, '$cacheRegion' );
gct.addToLastRow( 3, '$userNameRef' );
gct.addToLastRow( 4, '<span $dateAlgSort/> $dateAlg' );
";
}
$view->loadJQueryUI();
tpl_set_var( 'contentTable', $content );
tpl_BuildTemplate();