forked from opencaching/opencaching-pl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log_cache_multi_panel.php
133 lines (115 loc) · 6.55 KB
/
log_cache_multi_panel.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?php
use src\Models\GeoCache\GeoCacheCommons;
use src\Models\GeoCache\GeoCacheLogCommons;
use src\Utils\Database\XDb;
use src\Models\ApplicationContainer;
require_once (__DIR__.'/lib/common.inc.php');
$no_tpl_build = false;
$loggedUser = ApplicationContainer::GetAuthorizedUser();
if (!$loggedUser || (!isset($_FILES['userfile']) && !isset($_SESSION['log_cache_multi_data']))) {
tpl_redirect('log_cache_multi_send.php');
exit;
}
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" media="screen,projection" href="/css/style_screen.css" />
<link rel="stylesheet" type="text/css" media="print" href="/css/style_print.css" />
<style>
a:link {
color:inherit;
text-decoration: none;
}
a:visited {
color:inherit;
text-decoration: none;
}
a:hover {
color:inherit;
font-weight: bold;
text-decoration: underline;
}
a:active {
color:inherit;
text-decoration: none;
}
.bgcolorM1 {background-color: rgb(170,187,182);}
</style>
</head>
<body>
<?php
$dane = array();
if (isset($_SESSION['log_cache_multi_filteredData'])) {
$dane = $_SESSION['log_cache_multi_filteredData'];
$cacheIdList = array();
foreach ($dane as $k => $v) {
$cacheIdList[] = $v['cache_id'];
}
// dociagam info o ostatniej aktywnosci dla kazdej skrzynki
if ( count($cacheIdList) > 0) {
$rs = XDb::xSql(
"SELECT c.* FROM
(
SELECT cache_id, MAX(date) date FROM `cache_logs`
WHERE user_id= ? AND cache_id IN (" . XDb::xEscape( implode(',',$cacheIdList) ) . ")
GROUP BY cache_id
) as x INNER JOIN `cache_logs` as c ON c.cache_id = x.cache_id
AND c.date = x.date", $loggedUser->getUserId() );
while( $record = XDb::xFetchArray($rs) ){
foreach ($dane as $k => $v) {
if ($v['cache_id'] == $record['cache_id']) {
$v['got_last_activity'] = true;
$v['last_date'] = substr($record['date'], 0, strlen($record['date']) - 3);
$v['last_status'] = $record['type'];
$dane[$k] = $v;
}
}
}//while
}
foreach ($dane as $k => $v) {
?>
<form method="POST" name="logCacheForm" action="log.php?cacheid=<?php echo $v['cache_id']; ?>" target="cacheLog">
<textarea style="visibility:hidden;position:absolute;" name="logtext"><?php echo $v['koment']; ?></textarea>
<input type="hidden" name="logtype" value="<?php echo $v['status']; ?>" />
<input type="hidden" name="logyear" value="<?php echo $v['rok']; ?>" />
<input type="hidden" name="logmonth" value="<?php echo $v['msc']; ?>" />
<input type="hidden" name="logday" value="<?php echo $v['dzien']; ?>" />
<input type="hidden" name="loghour" value="<?php echo $v['godz']; ?>" />
<input type="hidden" name="logmin" value="<?php echo $v['min']; ?>" />
<table border="0" style="table-layout: fixed; border: 1px dotted black; line-height: 1.6em; font-size: 10px; "><?php
// jesli zgodne daty i typ to inny kolor:
if ((isset($v['data']) && isset($v['last_date']) && $v['data'] == $v['last_date']) && (isset($v['status']) && isset($v['last_status']) && $v['status'] == $v['last_status'])) {
$zgodne = true;
$styl = "bgcolorM1";
} else {
$zgodne = false;
$styl = "bgcolor2";
}
?>
<tr class="<?php echo $styl; ?>">
<td width=210><?php echo isset($v['cache_name']) ?
"<img src=\"" . GeoCacheCommons::CacheIconByType($v['cache_type'], GeoCacheCommons::STATUS_READY) . "\" /> " .
$v['kod_str'] . " " . $v['cache_name'] : " "; ?></td>
<td width=70 style="text-align: right"><?php
echo isset($v['data']) ? str_replace(" ", "<br />", $v['data']) : " ";
echo " ";
echo isset($v['status']) ? "<img src=\"" . GeoCacheLogCommons::GetIconForType($v['status']) . "\" />" : " ";
?></td>
<td width=70 style="text-align: right"><?php
echo isset($v['got_last_activity']) ? str_replace(" ", "<br />", $v['last_date']) . " " . (isset($v['last_status']) ? "<img src=\"" . GeoCacheLogCommons::GetIconForType($v['last_status']) . "\" />" : " ") : " ";
?></td>
</tr><tr class="<?php echo $styl; ?>">
<td width="280" colspan=2><?php echo isset($v['koment']) ? $v['koment'] : " "; ?> </td>
<td style="text-align: center"><?php
if (isset($v['cache_id']) && (!$zgodne)) {
echo "<input type=\"submit\" value=\"Log\" style=\"width: 50px\" onclick=\"parent.cachePreview.location.href='viewcache.php?cacheid=" . $v['cache_id'] . "'; return true;\"/>";
};
?>
</td>
</tr>
</table>
</form>
<?php
}
}