|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the TYPO3 CMS project. |
|
5
|
|
|
* |
|
6
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
8
|
|
|
* of the License, or any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* The TYPO3 project - inspiring people to share! |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Belog\Domain\Model; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Constraints for log entries |
|
20
|
|
|
* @internal This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API. |
|
21
|
|
|
*/ |
|
22
|
|
|
class Constraint |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Selected user/group; possible values are "gr-<uid>" for a group, "us-<uid>" for a user or -1 for "all users" |
|
26
|
|
|
* |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $userOrGroup = '0'; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Number of log rows to show |
|
33
|
|
|
* |
|
34
|
|
|
* @var int |
|
35
|
|
|
*/ |
|
36
|
|
|
protected $number = 20; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* UID of selected workspace |
|
40
|
|
|
* |
|
41
|
|
|
* @var int |
|
42
|
|
|
*/ |
|
43
|
|
|
protected $workspaceUid = Workspace::UID_ANY_WORKSPACE; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Selected action |
|
47
|
|
|
* |
|
48
|
|
|
* @var int |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $action = 0; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Calculated start timestamp |
|
54
|
|
|
* |
|
55
|
|
|
* @var int |
|
56
|
|
|
*/ |
|
57
|
|
|
protected $startTimestamp = 0; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Calculated end timestamp |
|
61
|
|
|
* |
|
62
|
|
|
* @var int |
|
63
|
|
|
*/ |
|
64
|
|
|
protected $endTimestamp = 0; |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Manual date start |
|
68
|
|
|
* @var \DateTime|null |
|
69
|
|
|
*/ |
|
70
|
|
|
protected $manualDateStart; |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* Manual date stop |
|
74
|
|
|
* @var \DateTime|null |
|
75
|
|
|
*/ |
|
76
|
|
|
protected $manualDateStop; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Selected page ID in page context |
|
80
|
|
|
* |
|
81
|
|
|
* @var int |
|
82
|
|
|
*/ |
|
83
|
|
|
protected $pageId = 0; |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* Page level depth |
|
87
|
|
|
* |
|
88
|
|
|
* @var int |
|
89
|
|
|
*/ |
|
90
|
|
|
protected $depth = 0; |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Set user |
|
94
|
|
|
* |
|
95
|
|
|
* @param string $user |
|
96
|
|
|
*/ |
|
97
|
|
|
public function setUserOrGroup($user) |
|
98
|
|
|
{ |
|
99
|
|
|
$this->userOrGroup = $user; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Get user |
|
104
|
|
|
* |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getUserOrGroup() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->userOrGroup; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* Set number of log rows to show |
|
114
|
|
|
* |
|
115
|
|
|
* @param int $number |
|
116
|
|
|
*/ |
|
117
|
|
|
public function setNumber($number) |
|
118
|
|
|
{ |
|
119
|
|
|
$this->number = (int)$number; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* Get number of log entries to show |
|
124
|
|
|
* |
|
125
|
|
|
* @return int |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getNumber() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->number; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Set workspace |
|
134
|
|
|
* |
|
135
|
|
|
* @param string $workspace |
|
136
|
|
|
*/ |
|
137
|
|
|
public function setWorkspaceUid($workspace) |
|
138
|
|
|
{ |
|
139
|
|
|
$this->workspaceUid = $workspace; |
|
|
|
|
|
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Get workspace |
|
144
|
|
|
* |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getWorkspaceUid() |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->workspaceUid; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* Set action |
|
154
|
|
|
* |
|
155
|
|
|
* @param int $action |
|
156
|
|
|
*/ |
|
157
|
|
|
public function setAction($action) |
|
158
|
|
|
{ |
|
159
|
|
|
$this->action = $action; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
/** |
|
163
|
|
|
* Get action |
|
164
|
|
|
* |
|
165
|
|
|
* @return int |
|
166
|
|
|
*/ |
|
167
|
|
|
public function getAction() |
|
168
|
|
|
{ |
|
169
|
|
|
return (int)$this->action; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* Set calculated start timestamp from query constraints |
|
174
|
|
|
* |
|
175
|
|
|
* @param int $timestamp |
|
176
|
|
|
*/ |
|
177
|
|
|
public function setStartTimestamp($timestamp) |
|
178
|
|
|
{ |
|
179
|
|
|
$this->startTimestamp = (int)$timestamp; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* Get calculated start timestamp from query constraints |
|
184
|
|
|
* |
|
185
|
|
|
* @return int |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getStartTimestamp() |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->startTimestamp; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* Set calculated end timestamp from query constraints |
|
194
|
|
|
* |
|
195
|
|
|
* @param int $timestamp |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setEndTimestamp($timestamp) |
|
198
|
|
|
{ |
|
199
|
|
|
$this->endTimestamp = (int)$timestamp; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* Get calculated end timestamp from query constraints |
|
204
|
|
|
* |
|
205
|
|
|
* @return int |
|
206
|
|
|
*/ |
|
207
|
|
|
public function getEndTimestamp() |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->endTimestamp; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* Set page id |
|
214
|
|
|
* |
|
215
|
|
|
* @param int $id |
|
216
|
|
|
*/ |
|
217
|
|
|
public function setPageId($id) |
|
218
|
|
|
{ |
|
219
|
|
|
$this->pageId = (int)$id; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
/** |
|
223
|
|
|
* Get page id |
|
224
|
|
|
* |
|
225
|
|
|
* @return int |
|
226
|
|
|
*/ |
|
227
|
|
|
public function getPageId() |
|
228
|
|
|
{ |
|
229
|
|
|
return $this->pageId; |
|
230
|
|
|
} |
|
231
|
|
|
|
|
232
|
|
|
/** |
|
233
|
|
|
* Set page level depth |
|
234
|
|
|
* |
|
235
|
|
|
* @param int $depth |
|
236
|
|
|
*/ |
|
237
|
|
|
public function setDepth($depth) |
|
238
|
|
|
{ |
|
239
|
|
|
$this->depth = $depth; |
|
240
|
|
|
} |
|
241
|
|
|
|
|
242
|
|
|
/** |
|
243
|
|
|
* Get page level depth |
|
244
|
|
|
* |
|
245
|
|
|
* @return int |
|
246
|
|
|
*/ |
|
247
|
|
|
public function getDepth() |
|
248
|
|
|
{ |
|
249
|
|
|
return (int)$this->depth; |
|
250
|
|
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* Set manual date start |
|
254
|
|
|
* |
|
255
|
|
|
* @param \DateTime $manualDateStart |
|
256
|
|
|
*/ |
|
257
|
|
|
public function setManualDateStart(\DateTime $manualDateStart = null) |
|
258
|
|
|
{ |
|
259
|
|
|
$this->manualDateStart = $manualDateStart; |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
/** |
|
263
|
|
|
* Get manual date start |
|
264
|
|
|
* |
|
265
|
|
|
* @return \DateTime|null |
|
266
|
|
|
*/ |
|
267
|
|
|
public function getManualDateStart() |
|
268
|
|
|
{ |
|
269
|
|
|
return $this->manualDateStart; |
|
270
|
|
|
} |
|
271
|
|
|
|
|
272
|
|
|
/** |
|
273
|
|
|
* Set manual date stop |
|
274
|
|
|
* |
|
275
|
|
|
* @param \DateTime $manualDateStop |
|
276
|
|
|
*/ |
|
277
|
|
|
public function setManualDateStop(\DateTime $manualDateStop = null) |
|
278
|
|
|
{ |
|
279
|
|
|
$this->manualDateStop = $manualDateStop; |
|
280
|
|
|
} |
|
281
|
|
|
|
|
282
|
|
|
/** |
|
283
|
|
|
* Get manual date stop |
|
284
|
|
|
* |
|
285
|
|
|
* @return \DateTime|null |
|
286
|
|
|
*/ |
|
287
|
|
|
public function getManualDateStop() |
|
288
|
|
|
{ |
|
289
|
|
|
return $this->manualDateStop; |
|
290
|
|
|
} |
|
291
|
|
|
} |
|
292
|
|
|
|
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.