ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
UserDataFilter.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
27{
28 final public const SORT_FIELD_ISSUE_TIMESTAMP = 1;
29 final public const SORT_FIELD_USR_LOGIN = 2;
30 final public const SORT_FIELD_USR_LASTNAME = 3;
31 final public const SORT_FIELD_USR_FIRSTNAME = 4;
32 final public const SORT_FIELD_OBJ_TITLE = 5;
33 final public const SORT_FIELD_USR_EMAIL = 6;
34 final public const SORT_DIRECTION_ASC = 1;
35 final public const SORT_DIRECTION_DESC = 2;
36
37 private ?string $objectTitle = null;
38 private ?int $issuedBeforeTimestamp = null;
39 private ?int $issuedAfterTimestamp = null;
40 private bool $onlyCertActive = true;
41 private ?string $userFirstName = null;
42 private ?string $userLastName = null;
43 private ?string $userLogin = null;
44 private ?string $userEmail = null;
45 private ?string $userIdentification = null;
47 private array $userIds = [];
49 private array $objIds = [];
51 private array $sorts = [];
52 private ?int $limitOffset = null;
53 private ?int $limitCount = null;
54 private bool $shouldIncludeDeletedObjects = true;
56 private array $orgUnitIds = [];
57
61 private function ensureValidUniqueUsrIds(array $usrIds): void
62 {
63 array_walk($usrIds, static function (int $usrId): void {
64 // Do nothing, use this for type safety of array values
65 });
66 }
67
71 private function ensureValidUniqueObjIds(array $objIds): void
72 {
73 array_walk($objIds, static function (int $objId): void {
74 // Do nothing, use this for type safety of array values
75 });
76 }
77
81 private function ensureValidUniqueOrgUnitIds(array $orgUnitIds): void
82 {
83 array_walk($orgUnitIds, static function (int $orgUnitId): void {
84 // Do nothing, use this for type safety of array values
85 });
86 }
87
88 public function withObjectTitle(?string $title): self
89 {
90 $clone = clone $this;
91 $clone->objectTitle = $title;
92
93 return $clone;
94 }
95
96 public function withUserFirstName(?string $firstName): self
97 {
98 $clone = clone $this;
99 $clone->userFirstName = $firstName;
100
101 return $clone;
102 }
103
104 public function withUserLastName(?string $lastName): self
105 {
106 $clone = clone $this;
107 $clone->userLastName = $lastName;
108
109 return $clone;
110 }
111
112 public function withUserLogin(?string $login): self
113 {
114 $clone = clone $this;
115 $clone->userLogin = $login;
116
117 return $clone;
118 }
119
120 public function withUserEmailAddress(?string $emailAddress): self
121 {
122 $clone = clone $this;
123 $clone->userEmail = $emailAddress;
124
125 return $clone;
126 }
127
128 public function withUserIdentification(?string $userIdentification): self
129 {
130 $clone = clone $this;
131 $clone->userIdentification = $userIdentification;
132
133 return $clone;
134 }
135
136 public function withIssuedBeforeTimestamp(?int $timestamp): self
137 {
138 $clone = clone $this;
139 $clone->issuedBeforeTimestamp = $timestamp;
140
141 return $clone;
142 }
143
144 public function withIssuedAfterTimestamp(?int $timestamp): self
145 {
146 $clone = clone $this;
147 $clone->issuedAfterTimestamp = $timestamp;
148
149 return $clone;
150 }
151
152 public function withOnlyCertActive(bool $status): self
153 {
154 $clone = clone $this;
155 $clone->onlyCertActive = $status;
156
157 return $clone;
158 }
159
164 public function withUserIds(array $usrIds): self
165 {
166 $this->ensureValidUniqueUsrIds($usrIds);
167
168 $clone = clone $this;
169 $clone->userIds = array_unique($usrIds);
170
171 return $clone;
172 }
173
178 public function withAdditionalUserIds(array $usrIds): self
179 {
180 $this->ensureValidUniqueUsrIds($usrIds);
181
182 $clone = clone $this;
183 $clone->userIds = array_unique(array_merge($clone->userIds, $usrIds));
184
185 return $clone;
186 }
187
192 public function withObjIds(array $objIds): self
193 {
194 $this->ensureValidUniqueObjIds($objIds);
195
196 $clone = clone $this;
197 $clone->objIds = array_unique($objIds);
198
199 return $clone;
200 }
201
206 public function withAdditionalObjIds(array $objIds): self
207 {
208 $this->ensureValidUniqueObjIds($objIds);
209
210 $clone = clone $this;
211 $clone->objIds = array_unique(array_merge($clone->objIds, $objIds));
212
213 return $clone;
214 }
215
220 public function withOrgUnitIds(array $orgUnitIds): self
221 {
222 $this->ensureValidUniqueOrgUnitIds($orgUnitIds);
223
224 $clone = clone $this;
225 $clone->orgUnitIds = array_unique($orgUnitIds);
226
227 return $clone;
228 }
229
234 public function withAdditionalOrgUnitIds(array $orgUnitIds): self
235 {
236 $this->ensureValidUniqueOrgUnitIds($orgUnitIds);
237
238 $clone = clone $this;
239 $clone->orgUnitIds = array_unique(array_merge($clone->orgUnitIds, $orgUnitIds));
240
241 return $clone;
242 }
243
244 public function getObjectTitle(): ?string
245 {
246 return $this->objectTitle;
247 }
248
249 public function getIssuedBeforeTimestamp(): ?int
250 {
252 }
253
254 public function getIssuedAfterTimestamp(): ?int
255 {
257 }
258
259 public function isOnlyCertActive(): bool
260 {
262 }
263
264 public function getUserFirstName(): ?string
265 {
267 }
268
269 public function getUserLastName(): ?string
270 {
271 return $this->userLastName;
272 }
273
274 public function getUserLogin(): ?string
275 {
276 return $this->userLogin;
277 }
278
279 public function getUserEmail(): ?string
280 {
281 return $this->userEmail;
282 }
283
284 public function getUserIdentification(): ?string
285 {
287 }
288
292 public function getUserIds(): array
293 {
294 return $this->userIds;
295 }
296
300 public function getObjIds(): array
301 {
302 return $this->objIds;
303 }
304
308 public function getOrgUnitIds(): array
309 {
310 return $this->orgUnitIds;
311 }
312
313 public function withSortedLastNames(int $direction = self::SORT_DIRECTION_ASC): self
314 {
315 $clone = clone $this;
316 $clone->sorts[] = [self::SORT_FIELD_USR_LASTNAME, $direction];
317
318 return $clone;
319 }
320
321 public function withSortedFirstNames(int $direction = self::SORT_DIRECTION_ASC): self
322 {
323 $clone = clone $this;
324 $clone->sorts[] = [self::SORT_FIELD_USR_FIRSTNAME, $direction];
325
326 return $clone;
327 }
328
329 public function withSortedObjectTitles(int $direction = self::SORT_DIRECTION_ASC): self
330 {
331 $clone = clone $this;
332 $clone->sorts[] = [self::SORT_FIELD_OBJ_TITLE, $direction];
333
334 return $clone;
335 }
336
337 public function withSortedLogins(int $direction = self::SORT_DIRECTION_ASC): self
338 {
339 $clone = clone $this;
340 $clone->sorts[] = [self::SORT_FIELD_USR_LOGIN, $direction];
341
342 return $clone;
343 }
344
345 public function withSortedIssuedOnTimestamps(int $direction = self::SORT_DIRECTION_ASC): self
346 {
347 $clone = clone $this;
348 $clone->sorts[] = [self::SORT_FIELD_ISSUE_TIMESTAMP, $direction];
349
350 return $clone;
351 }
352
353 public function withSortedEmails(int $direction = self::SORT_DIRECTION_ASC): self
354 {
355 $clone = clone $this;
356 $clone->sorts[] = [self::SORT_FIELD_USR_EMAIL, $direction];
357
358 return $clone;
359 }
360
364 public function getSorts(): array
365 {
366 return $this->sorts;
367 }
368
369 public function withLimitOffset(?int $limitOffset): self
370 {
371 $clone = clone $this;
372 $clone->limitOffset = $limitOffset;
373 return $clone;
374 }
375
376 public function getLimitOffset(): ?int
377 {
378 return $this->limitOffset;
379 }
380
381 public function withLimitCount(?int $limitCount): self
382 {
383 $clone = clone $this;
384 $clone->limitCount = $limitCount;
385 return $clone;
386 }
387
388 public function getLimitCount(): ?int
389 {
390 return $this->limitCount;
391 }
392
393 public function withShouldIncludeDeletedObjects(): self
394 {
395 $clone = clone $this;
396 $clone->shouldIncludeDeletedObjects = true;
397
398 return $clone;
399 }
400
402 {
403 $clone = clone $this;
404 $clone->shouldIncludeDeletedObjects = false;
405
406 return $clone;
407 }
408
409 public function shouldIncludeDeletedObjects(): bool
410 {
412 }
413}
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
withSortedEmails(int $direction=self::SORT_DIRECTION_ASC)
withSortedIssuedOnTimestamps(int $direction=self::SORT_DIRECTION_ASC)
withUserIdentification(?string $userIdentification)
withSortedFirstNames(int $direction=self::SORT_DIRECTION_ASC)
withSortedLastNames(int $direction=self::SORT_DIRECTION_ASC)
withSortedLogins(int $direction=self::SORT_DIRECTION_ASC)
withSortedObjectTitles(int $direction=self::SORT_DIRECTION_ASC)
$objId
Definition: xapitoken.php:57