blob: edb29eea134f8572235a203d033c6e95383bce39 (
plain) (
blame)
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
|
<?php
/***************************************
* Description:
* Autor: Uroš Podkrižnik
* Created date: 09.04.2020
*****************************************/
class UserTrackingClass
{
public function __construct()
{
return $this;
}
private static $_instance;
/**
* V kolikor razred kličemo statično
*
* @return instance
*/
public static function init()
{
if (!static::$_instance)
static::$_instance = new UserTrackingClass();
return static::$_instance;
}
/**
* @desc prikaze tracking sprememb
*/
public function userTrackingDisplay()
{
global $lang;
global $global_user_id;
echo '<div id="div_archive_content" class="tracking">';
echo '<fieldset>';
echo '<legend>' . $lang['srv_survey_archives_tracking_history'] . '</legend>';
// Izvoz v Excel
echo '<p class="bottom16">'.$lang['srv_survey_archives_tracking_last_changes'].'</p>';
//echo '<div id="table-horizontal-scroll-wrapper1-userchanges">';
//echo '<div id="table-horizontal-scroll-wrapper2-userchanges">'; - wrapperja za scroll na mobilnem
echo '<div class="table-horizontal-scroll-wrapper1">';
echo '<div class="table-horizontal-scroll-wrapper2">';
echo '<table id="tracking">';
// Prva vrstica
echo '<tr>';
echo ' <th>' . $lang['date'] . '</th>';
echo ' <th class="center">IP</th>';
echo ' <th>GET</th>';
echo ' <th>POST</th>';
echo '</tr>';
// Vrstice s podatki
$sql = sisplet_query("SELECT * FROM user_tracking WHERE user = '$global_user_id' ORDER BY datetime DESC LIMIT 25");
while ($row = mysqli_fetch_array($sql)) {
echo '<tr>';
echo ' <td><div class="no_wrap">' . datetime($row['datetime']) . '</div></td>';
echo ' <td class="center">' . $row['ip'] . '</td>';
echo ' <td><div class="postget_wrap">' . $row['get'] . '</div></td>';
echo ' <td><div class="postget_wrap">' . $row['post'] . '</div></td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
echo '</div>'; //- wrapperja za scroll na mobilnem
echo '</fieldset>';
echo '</div>';
}
public function csvExport()
{
global $global_user_id;
define('delimiter', ';');
$podatki = 'datetime' . delimiter;
//$podatki .= 'uid' . delimiter;
$podatki .= 'ip' . delimiter;
//$podatki .= 'status' . delimiter;
$podatki .= 'parameter' . delimiter;
$podatki .= 'value' . delimiter;
$podatki .= 'parameter' . delimiter;
$podatki .= 'value' . delimiter;
$podatki .= "\n";
$sql = sisplet_query("SELECT * FROM user_tracking WHERE user = '$global_user_id' ORDER BY datetime DESC");
while ($row = mysqli_fetch_array($sql)) {
$sqlu = sisplet_query("SELECT name, surname, id FROM users WHERE id = '$row[user]'");
$rowu = mysqli_fetch_array($sqlu);
$podatki .= '' . datetime($row['datetime']) . delimiter;
//$podatki .= '' . $rowu['id'] . delimiter;
$podatki .= '' . $row['ip'] . delimiter;
//$podatki .= '' . $row['status'] . delimiter;
foreach (explode(',', $row['get']) AS $value) {
$value = explode(':', $value);
$podatki .= trim($value[0]) . delimiter;
$podatki .= trim($value[1]) . delimiter;
}
$podatki .= "\n";
}
$ime = str_replace('-', '_', $_GET['a']);
return Export::init()->csv('Spremembe_' . $ime, $podatki);
}
}
|