1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Extension "sf_event_mgt" for TYPO3 CMS. |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please read the |
9
|
|
|
* LICENSE.txt file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace DERHANSEN\SfEventMgt\Domain\Model; |
13
|
|
|
|
14
|
|
|
use DateTime; |
15
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Registration\Field; |
16
|
|
|
use DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository; |
17
|
|
|
use DERHANSEN\SfEventMgt\Utility\MiscUtility; |
18
|
|
|
use DERHANSEN\SfEventMgt\Utility\ShowInPreviews; |
19
|
|
|
use TYPO3\CMS\Core\Context\Context; |
20
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
21
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase; |
22
|
|
|
use TYPO3\CMS\Extbase\Domain\Model\FileReference; |
23
|
|
|
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; |
24
|
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Event |
28
|
|
|
*/ |
29
|
|
|
class Event extends AbstractEntity |
30
|
|
|
{ |
31
|
|
|
protected ?DateTime $tstamp = null; |
32
|
|
|
protected bool $hidden = false; |
33
|
|
|
protected ?DateTime $starttime = null; |
34
|
|
|
protected ?DateTime $endtime = null; |
35
|
|
|
protected string $title = ''; |
36
|
|
|
protected string $teaser = ''; |
37
|
|
|
protected string $description = ''; |
38
|
|
|
protected string $program = ''; |
39
|
|
|
protected string $customText = ''; |
40
|
|
|
protected ?DateTime $startdate = null; |
41
|
|
|
protected ?DateTime $enddate = null; |
42
|
|
|
protected int $maxParticipants = 0; |
43
|
|
|
protected int $maxRegistrationsPerUser = 1; |
44
|
|
|
protected float $price = 0.0; |
45
|
|
|
protected string $currency = ''; |
46
|
|
|
protected bool $enablePayment = false; |
47
|
|
|
protected bool $restrictPaymentMethods = false; |
48
|
|
|
protected string $selectedPaymentMethods = ''; |
49
|
|
|
protected ?DateTime $registrationStartdate = null; |
50
|
|
|
protected ?DateTime $registrationDeadline = null; |
51
|
|
|
protected ?Location $location = null; |
52
|
|
|
protected string $room = ''; |
53
|
|
|
protected bool $enableRegistration = false; |
54
|
|
|
protected bool $enableWaitlist = false; |
55
|
|
|
protected bool $enableWaitlistMoveup = false; |
56
|
|
|
protected string $link = ''; |
57
|
|
|
protected bool $topEvent = false; |
58
|
|
|
protected ?Organisator $organisator = null; |
59
|
|
|
protected bool $notifyAdmin = true; |
60
|
|
|
protected bool $notifyOrganisator = false; |
61
|
|
|
protected bool $enableCancel = false; |
62
|
|
|
protected ?DateTime $cancelDeadline = null; |
63
|
|
|
protected bool $enableAutoconfirm = false; |
64
|
|
|
protected bool $uniqueEmailCheck = false; |
65
|
|
|
protected string $metaKeywords = ''; |
66
|
|
|
protected string $metaDescription = ''; |
67
|
|
|
protected string $alternativeTitle = ''; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @var ObjectStorage<Category> |
71
|
|
|
* @Extbase\ORM\Lazy |
72
|
|
|
*/ |
73
|
|
|
protected ObjectStorage $category; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @var ObjectStorage<Event> |
77
|
|
|
* @Extbase\ORM\Lazy |
78
|
|
|
*/ |
79
|
|
|
protected ObjectStorage $related; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var ObjectStorage<Registration> |
83
|
|
|
* @Extbase\ORM\Cascade("remove") |
84
|
|
|
* @Extbase\ORM\Lazy |
85
|
|
|
*/ |
86
|
|
|
protected ObjectStorage $registration; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @var ObjectStorage<Registration> |
90
|
|
|
* @Extbase\ORM\Lazy |
91
|
|
|
*/ |
92
|
|
|
protected ObjectStorage $registrationWaitlist; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var ObjectStorage<Field> |
96
|
|
|
* @Extbase\ORM\Lazy |
97
|
|
|
*/ |
98
|
|
|
protected ObjectStorage $registrationFields; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @var ObjectStorage<FileReference> |
102
|
|
|
* @Extbase\ORM\Lazy |
103
|
|
|
*/ |
104
|
|
|
protected ObjectStorage $image; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @var ObjectStorage<FileReference> |
108
|
|
|
* @Extbase\ORM\Lazy |
109
|
|
|
*/ |
110
|
|
|
protected ObjectStorage $files; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @var ObjectStorage<FileReference> |
114
|
|
|
* @Extbase\ORM\Lazy |
115
|
|
|
*/ |
116
|
|
|
protected ObjectStorage $additionalImage; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @var ObjectStorage<PriceOption> |
120
|
|
|
* @Extbase\ORM\Cascade("remove") |
121
|
|
|
* @Extbase\ORM\Lazy |
122
|
|
|
*/ |
123
|
|
|
protected ObjectStorage $priceOptions; |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @var ObjectStorage<Speaker> |
127
|
|
|
* @Extbase\ORM\Lazy |
128
|
|
|
*/ |
129
|
|
|
protected ObjectStorage $speaker; |
130
|
|
|
|
131
|
|
|
public function __construct() |
132
|
|
|
{ |
133
|
|
|
$this->initializeObject(); |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Initialize all ObjectStorages as fetching an entity from the DB does not use the constructor |
138
|
|
|
*/ |
139
|
|
|
public function initializeObject() |
140
|
|
|
{ |
141
|
|
|
$this->category = new ObjectStorage(); |
142
|
|
|
$this->related = new ObjectStorage(); |
143
|
|
|
$this->registration = new ObjectStorage(); |
144
|
|
|
$this->registrationWaitlist = new ObjectStorage(); |
145
|
|
|
$this->registrationFields = new ObjectStorage(); |
146
|
|
|
$this->image = new ObjectStorage(); |
147
|
|
|
$this->files = new ObjectStorage(); |
148
|
|
|
$this->additionalImage = new ObjectStorage(); |
149
|
|
|
$this->priceOptions = new ObjectStorage(); |
150
|
|
|
$this->speaker = new ObjectStorage(); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
public function getTstamp(): ?DateTime |
154
|
|
|
{ |
155
|
|
|
return $this->tstamp; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
public function setTstamp(?DateTime $tstamp) |
159
|
|
|
{ |
160
|
|
|
$this->tstamp = $tstamp; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
public function getHidden(): bool |
164
|
|
|
{ |
165
|
|
|
return $this->hidden; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
public function setHidden(bool $hidden) |
169
|
|
|
{ |
170
|
|
|
$this->hidden = $hidden; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
public function getStarttime(): ?DateTime |
174
|
|
|
{ |
175
|
|
|
return $this->starttime; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
public function setStarttime(?DateTime $starttime) |
179
|
|
|
{ |
180
|
|
|
$this->starttime = $starttime; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
public function getEndtime(): ?DateTime |
184
|
|
|
{ |
185
|
|
|
return $this->endtime; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function setEndtime(?DateTime $endtime) |
189
|
|
|
{ |
190
|
|
|
$this->endtime = $endtime; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function getTitle(): string |
194
|
|
|
{ |
195
|
|
|
return $this->title; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
public function setTitle(string $title) |
199
|
|
|
{ |
200
|
|
|
$this->title = $title; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public function getTeaser(): string |
204
|
|
|
{ |
205
|
|
|
return $this->teaser; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public function setTeaser(string $teaser) |
209
|
|
|
{ |
210
|
|
|
$this->teaser = $teaser; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function getDescription(): string |
214
|
|
|
{ |
215
|
|
|
return $this->description; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
public function setDescription(string $description) |
219
|
|
|
{ |
220
|
|
|
$this->description = $description; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
public function getProgram(): string |
224
|
|
|
{ |
225
|
|
|
return $this->program; |
226
|
|
|
} |
227
|
|
|
|
228
|
|
|
public function setProgram(string $program) |
229
|
|
|
{ |
230
|
|
|
$this->program = $program; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
public function getCustomText(): string |
234
|
|
|
{ |
235
|
|
|
return $this->customText; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
public function setCustomText(string $customText): void |
239
|
|
|
{ |
240
|
|
|
$this->customText = $customText; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
public function getStartdate(): ?DateTime |
244
|
|
|
{ |
245
|
|
|
return $this->startdate; |
246
|
|
|
} |
247
|
|
|
|
248
|
|
|
public function setStartdate(?DateTime $startdate) |
249
|
|
|
{ |
250
|
|
|
$this->startdate = $startdate; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
public function getEnddate(): ?DateTime |
254
|
|
|
{ |
255
|
|
|
return $this->enddate; |
256
|
|
|
} |
257
|
|
|
|
258
|
|
|
public function setEnddate(?DateTime $enddate) |
259
|
|
|
{ |
260
|
|
|
$this->enddate = $enddate; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
public function getMaxParticipants(): int |
264
|
|
|
{ |
265
|
|
|
return $this->maxParticipants; |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
public function setMaxParticipants(int $participants) |
269
|
|
|
{ |
270
|
|
|
$this->maxParticipants = $participants; |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
public function getPrice(): float |
274
|
|
|
{ |
275
|
|
|
return $this->price; |
276
|
|
|
} |
277
|
362 |
|
|
278
|
|
|
public function setPrice(float $price) |
279
|
362 |
|
{ |
280
|
362 |
|
$this->price = $price; |
281
|
362 |
|
} |
282
|
362 |
|
|
283
|
362 |
|
public function getCurrency(): string |
284
|
362 |
|
{ |
285
|
362 |
|
return $this->currency; |
286
|
362 |
|
} |
287
|
362 |
|
|
288
|
|
|
public function setCurrency(string $currency) |
289
|
|
|
{ |
290
|
|
|
$this->currency = $currency; |
291
|
|
|
} |
292
|
|
|
|
293
|
|
|
public function getEnablePayment(): bool |
294
|
10 |
|
{ |
295
|
|
|
return $this->enablePayment; |
296
|
10 |
|
} |
297
|
|
|
|
298
|
|
|
public function setEnablePayment(bool $enablePayment) |
299
|
|
|
{ |
300
|
|
|
$this->enablePayment = $enablePayment; |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
public function getRestrictPaymentMethods(): bool |
304
|
|
|
{ |
305
|
|
|
return $this->restrictPaymentMethods; |
306
|
2 |
|
} |
307
|
|
|
|
308
|
2 |
|
public function setRestrictPaymentMethods(bool $restrictPaymentMethods) |
309
|
2 |
|
{ |
310
|
|
|
$this->restrictPaymentMethods = $restrictPaymentMethods; |
311
|
|
|
} |
312
|
|
|
|
313
|
|
|
public function getSelectedPaymentMethods(): string |
314
|
|
|
{ |
315
|
|
|
return $this->selectedPaymentMethods; |
316
|
2 |
|
} |
317
|
|
|
|
318
|
2 |
|
public function setSelectedPaymentMethods(string $selectedPaymentMethods) |
319
|
|
|
{ |
320
|
|
|
$this->selectedPaymentMethods = $selectedPaymentMethods; |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
public function addCategory(Category $category) |
324
|
|
|
{ |
325
|
|
|
$this->category->attach($category); |
326
|
|
|
} |
327
|
|
|
|
328
|
2 |
|
public function removeCategory(Category $categoryToRemove) |
329
|
|
|
{ |
330
|
2 |
|
$this->category->detach($categoryToRemove); |
331
|
2 |
|
} |
332
|
|
|
|
333
|
|
|
public function getCategory(): ?ObjectStorage |
334
|
|
|
{ |
335
|
|
|
return $this->category; |
336
|
|
|
} |
337
|
|
|
|
338
|
2 |
|
public function getCategories(): ?ObjectStorage |
339
|
|
|
{ |
340
|
2 |
|
return $this->category; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
public function setCategory(?ObjectStorage $category) |
344
|
|
|
{ |
345
|
|
|
$this->category = $category; |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
public function getRelated(): ?ObjectStorage |
349
|
|
|
{ |
350
|
2 |
|
return $this->related; |
351
|
|
|
} |
352
|
2 |
|
|
353
|
2 |
|
public function setRelated(?ObjectStorage $related) |
354
|
|
|
{ |
355
|
|
|
$this->related = $related; |
356
|
|
|
} |
357
|
|
|
|
358
|
|
|
public function addRelated(Event $event) |
359
|
|
|
{ |
360
|
2 |
|
$this->related->attach($event); |
361
|
|
|
} |
362
|
2 |
|
|
363
|
|
|
public function removeRelated(Event $event) |
364
|
|
|
{ |
365
|
|
|
$this->related->detach($event); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
public function addRegistration(Registration $registration) |
369
|
|
|
{ |
370
|
|
|
$this->registration->attach($registration); |
371
|
|
|
} |
372
|
2 |
|
|
373
|
|
|
public function removeRegistration(Registration $registrationToRemove) |
374
|
2 |
|
{ |
375
|
2 |
|
$this->registration->detach($registrationToRemove); |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
public function getRegistration(): ?ObjectStorage |
379
|
|
|
{ |
380
|
|
|
return $this->registration; |
381
|
|
|
} |
382
|
22 |
|
|
383
|
|
|
public function setRegistration(?ObjectStorage $registration) |
384
|
22 |
|
{ |
385
|
|
|
$this->registration = $registration; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
public function addImage(FileReference $image) |
389
|
|
|
{ |
390
|
|
|
$this->image->attach($image); |
391
|
|
|
} |
392
|
|
|
|
393
|
|
|
public function removeImage(FileReference $imageToRemove) |
394
|
22 |
|
{ |
395
|
|
|
$this->image->detach($imageToRemove); |
396
|
22 |
|
} |
397
|
22 |
|
|
398
|
|
|
public function getImage(): ?ObjectStorage |
399
|
|
|
{ |
400
|
|
|
return $this->image; |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
public function getImages(): ?ObjectStorage |
404
|
2 |
|
{ |
405
|
|
|
return $this->image; |
406
|
2 |
|
} |
407
|
|
|
|
408
|
|
|
public function getListViewImages(): ?ObjectStorage |
409
|
|
|
{ |
410
|
|
|
return $this->getImagesByType(ShowInPreviews::LIST_VIEWS); |
411
|
|
|
} |
412
|
|
|
|
413
|
|
|
public function getFirstListViewImage(): ?FileReference |
414
|
|
|
{ |
415
|
|
|
$images = $this->getImagesByType(ShowInPreviews::LIST_VIEWS); |
416
|
2 |
|
$image = $images->current(); |
417
|
|
|
|
418
|
2 |
|
if (is_a($image, FileReference::class)) { |
419
|
2 |
|
return $image; |
420
|
|
|
} |
421
|
|
|
return null; |
422
|
|
|
} |
423
|
|
|
|
424
|
|
|
public function getDetailViewImages(): ?ObjectStorage |
425
|
|
|
{ |
426
|
28 |
|
return $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS); |
427
|
|
|
} |
428
|
28 |
|
|
429
|
|
|
public function getFirstDetailViewImage(): ?FileReference |
430
|
|
|
{ |
431
|
|
|
$images = $this->getImagesByType(ShowInPreviews::DETAIL_VIEWS); |
432
|
|
|
$image = $images->current(); |
433
|
|
|
|
434
|
|
|
if (is_a($image, FileReference::class)) { |
435
|
|
|
return $image; |
436
|
|
|
} |
437
|
|
|
return null; |
438
|
26 |
|
} |
439
|
|
|
|
440
|
26 |
|
protected function getImagesByType(int $type): ?ObjectStorage |
441
|
26 |
|
{ |
442
|
|
|
$result = new ObjectStorage(); |
443
|
|
|
|
444
|
|
|
foreach ($this->image as $image) { |
445
|
|
|
/** @var \TYPO3\CMS\Core\Resource\FileReference $fileReference */ |
446
|
|
|
$fileReference = $image->getOriginalResource(); |
447
|
|
|
if ($fileReference !== null && $fileReference->hasProperty('show_in_views') && |
448
|
2 |
|
in_array($fileReference->getProperty('show_in_views'), [$type, ShowInPreviews::ALL_VIEWS]) |
449
|
|
|
) { |
450
|
2 |
|
$result->attach($image); |
451
|
|
|
} |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
return $result; |
455
|
|
|
} |
456
|
|
|
|
457
|
|
|
public function setImage(?ObjectStorage $image) |
458
|
|
|
{ |
459
|
|
|
$this->image = $image; |
460
|
6 |
|
} |
461
|
|
|
|
462
|
6 |
|
public function addFiles(FileReference $file) |
463
|
6 |
|
{ |
464
|
|
|
$this->files->attach($file); |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
public function removeFiles(FileReference $fileToRemove) |
468
|
|
|
{ |
469
|
|
|
$this->files->detach($fileToRemove); |
470
|
2 |
|
} |
471
|
|
|
|
472
|
2 |
|
public function getFiles(): ?ObjectStorage |
473
|
|
|
{ |
474
|
|
|
return $this->files; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
public function setFiles(?ObjectStorage $files) |
478
|
|
|
{ |
479
|
|
|
$this->files = $files; |
480
|
|
|
} |
481
|
|
|
|
482
|
2 |
|
/** |
483
|
|
|
* Returns if the registration for this event is logically possible |
484
|
2 |
|
* |
485
|
2 |
|
* @return bool |
486
|
|
|
*/ |
487
|
|
|
public function getRegistrationPossible(): bool |
488
|
|
|
{ |
489
|
|
|
$maxParticipantsNotReached = true; |
490
|
|
|
if ($this->getMaxParticipants() > 0 && $this->getRegistrations()->count() >= $this->maxParticipants) { |
491
|
|
|
$maxParticipantsNotReached = false; |
492
|
8 |
|
} |
493
|
|
|
$deadlineNotReached = true; |
494
|
8 |
|
if ($this->getRegistrationDeadline() != null && $this->getRegistrationDeadline() <= new DateTime()) { |
495
|
|
|
$deadlineNotReached = false; |
496
|
|
|
} |
497
|
|
|
$registrationStartReached = true; |
498
|
|
|
if ($this->getRegistrationStartdate() != null && $this->getRegistrationStartdate() > new DateTime()) { |
499
|
|
|
$registrationStartReached = false; |
500
|
|
|
} |
501
|
|
|
|
502
|
|
|
return ($this->getStartdate() > new DateTime()) && |
503
|
6 |
|
($maxParticipantsNotReached || $this->enableWaitlist) && |
504
|
|
|
$this->getEnableRegistration() && $deadlineNotReached && $registrationStartReached; |
505
|
6 |
|
} |
506
|
6 |
|
|
507
|
|
|
/** |
508
|
|
|
* Returns the amount of free places |
509
|
|
|
* |
510
|
|
|
* @return int |
511
|
|
|
*/ |
512
|
|
|
public function getFreePlaces(): int |
513
|
6 |
|
{ |
514
|
|
|
return $this->maxParticipants - $this->getRegistrations()->count(); |
515
|
6 |
|
} |
516
|
|
|
|
517
|
|
|
public function setLocation(?Location $location) |
518
|
|
|
{ |
519
|
|
|
$this->location = $location; |
520
|
|
|
} |
521
|
|
|
|
522
|
|
|
public function getLocation(): ?Location |
523
|
|
|
{ |
524
|
2 |
|
return $this->location; |
525
|
|
|
} |
526
|
2 |
|
|
527
|
2 |
|
public function getRoom(): string |
528
|
|
|
{ |
529
|
|
|
return $this->room; |
530
|
|
|
} |
531
|
|
|
|
532
|
|
|
public function setRoom(string $room) |
533
|
|
|
{ |
534
|
4 |
|
$this->room = $room; |
535
|
|
|
} |
536
|
4 |
|
|
537
|
|
|
public function setEnableRegistration(bool $enableRegistration) |
538
|
|
|
{ |
539
|
|
|
$this->enableRegistration = $enableRegistration; |
540
|
|
|
} |
541
|
|
|
|
542
|
|
|
public function getEnableRegistration(): bool |
543
|
|
|
{ |
544
|
|
|
return $this->enableRegistration; |
545
|
2 |
|
} |
546
|
|
|
|
547
|
2 |
|
public function getEnableWaitlist(): bool |
548
|
2 |
|
{ |
549
|
|
|
return $this->enableWaitlist; |
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
public function setEnableWaitlist(bool $enableWaitlist) |
553
|
|
|
{ |
554
|
|
|
$this->enableWaitlist = $enableWaitlist; |
555
|
|
|
} |
556
|
|
|
|
557
|
2 |
|
public function getEnableWaitlistMoveup(): bool |
558
|
|
|
{ |
559
|
2 |
|
return $this->enableWaitlistMoveup; |
560
|
2 |
|
} |
561
|
|
|
|
562
|
|
|
public function setEnableWaitlistMoveup(bool $enableWaitlistMoveup): void |
563
|
|
|
{ |
564
|
|
|
$this->enableWaitlistMoveup = $enableWaitlistMoveup; |
565
|
|
|
} |
566
|
|
|
|
567
|
|
|
public function setRegistrationStartdate(?DateTime $registrationStartdate) |
568
|
|
|
{ |
569
|
2 |
|
$this->registrationStartdate = $registrationStartdate; |
570
|
|
|
} |
571
|
2 |
|
|
572
|
2 |
|
public function getRegistrationStartdate(): ?DateTime |
573
|
|
|
{ |
574
|
|
|
return $this->registrationStartdate; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
public function setRegistrationDeadline(?DateTime $registrationDeadline) |
578
|
|
|
{ |
579
|
2 |
|
$this->registrationDeadline = $registrationDeadline; |
580
|
|
|
} |
581
|
2 |
|
|
582
|
|
|
public function getRegistrationDeadline(): ?DateTime |
583
|
|
|
{ |
584
|
|
|
return $this->registrationDeadline; |
585
|
|
|
} |
586
|
|
|
|
587
|
|
|
public function setLink(string $link) |
588
|
|
|
{ |
589
|
|
|
$this->link = $link; |
590
|
|
|
} |
591
|
6 |
|
|
592
|
|
|
public function getLink(): string |
593
|
6 |
|
{ |
594
|
6 |
|
return $this->link; |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
public function setTopEvent(bool $topEvent) |
598
|
|
|
{ |
599
|
|
|
$this->topEvent = $topEvent; |
600
|
|
|
} |
601
|
4 |
|
|
602
|
|
|
public function getTopEvent(): bool |
603
|
4 |
|
{ |
604
|
|
|
return $this->topEvent; |
605
|
|
|
} |
606
|
|
|
|
607
|
|
|
public function getMaxRegistrationsPerUser(): int |
608
|
|
|
{ |
609
|
|
|
return $this->maxRegistrationsPerUser; |
610
|
|
|
} |
611
|
|
|
|
612
|
6 |
|
public function setMaxRegistrationsPerUser(int $maxRegistrationsPerUser) |
613
|
|
|
{ |
614
|
6 |
|
$this->maxRegistrationsPerUser = $maxRegistrationsPerUser; |
615
|
6 |
|
} |
616
|
|
|
|
617
|
|
|
public function addAdditionalImage(FileReference $additionalImage) |
618
|
|
|
{ |
619
|
|
|
$this->additionalImage->attach($additionalImage); |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
public function removeAdditionalImage(FileReference $additionalImageToRemove) |
623
|
2 |
|
{ |
624
|
|
|
$this->additionalImage->detach($additionalImageToRemove); |
625
|
2 |
|
} |
626
|
2 |
|
|
627
|
|
|
public function getAdditionalImage(): ?ObjectStorage |
628
|
|
|
{ |
629
|
|
|
return $this->additionalImage; |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
public function setAdditionalImage(?ObjectStorage $additionalImage) |
633
|
|
|
{ |
634
|
2 |
|
$this->additionalImage = $additionalImage; |
635
|
|
|
} |
636
|
2 |
|
|
637
|
2 |
|
public function getOrganisator(): ?Organisator |
638
|
|
|
{ |
639
|
|
|
return $this->organisator; |
640
|
|
|
} |
641
|
|
|
|
642
|
|
|
public function setOrganisator(Organisator $organisator) |
643
|
|
|
{ |
644
|
|
|
$this->organisator = $organisator; |
645
|
|
|
} |
646
|
4 |
|
|
647
|
|
|
public function getNotifyAdmin(): bool |
648
|
4 |
|
{ |
649
|
4 |
|
return $this->notifyAdmin; |
650
|
|
|
} |
651
|
|
|
|
652
|
|
|
public function setNotifyAdmin(bool $notifyAdmin) |
653
|
|
|
{ |
654
|
|
|
$this->notifyAdmin = $notifyAdmin; |
655
|
|
|
} |
656
|
|
|
|
657
|
|
|
public function getNotifyOrganisator(): bool |
658
|
2 |
|
{ |
659
|
|
|
return $this->notifyOrganisator; |
660
|
2 |
|
} |
661
|
2 |
|
|
662
|
|
|
public function setNotifyOrganisator(bool $notifyOrganisator) |
663
|
|
|
{ |
664
|
|
|
$this->notifyOrganisator = $notifyOrganisator; |
665
|
|
|
} |
666
|
|
|
|
667
|
|
|
public function setEnableCancel(bool $enableCancel) |
668
|
24 |
|
{ |
669
|
|
|
$this->enableCancel = $enableCancel; |
670
|
24 |
|
} |
671
|
|
|
|
672
|
|
|
public function getEnableCancel(): bool |
673
|
|
|
{ |
674
|
|
|
return $this->enableCancel; |
675
|
|
|
} |
676
|
|
|
|
677
|
|
|
public function setCancelDeadline(?DateTime $cancelDeadline) |
678
|
|
|
{ |
679
|
|
|
$this->cancelDeadline = $cancelDeadline; |
680
|
18 |
|
} |
681
|
|
|
|
682
|
18 |
|
public function getCancelDeadline(): ?DateTime |
683
|
18 |
|
{ |
684
|
|
|
return $this->cancelDeadline; |
685
|
|
|
} |
686
|
|
|
|
687
|
|
|
public function getEnableAutoconfirm(): bool |
688
|
|
|
{ |
689
|
|
|
return $this->enableAutoconfirm; |
690
|
|
|
} |
691
|
|
|
|
692
|
2 |
|
public function setEnableAutoconfirm(bool $enableAutoconfirm) |
693
|
|
|
{ |
694
|
2 |
|
$this->enableAutoconfirm = $enableAutoconfirm; |
695
|
2 |
|
} |
696
|
|
|
|
697
|
|
|
public function getUniqueEmailCheck(): bool |
698
|
|
|
{ |
699
|
|
|
return $this->uniqueEmailCheck; |
700
|
|
|
} |
701
|
|
|
|
702
|
|
|
public function setUniqueEmailCheck(bool $uniqueEmailCheck) |
703
|
|
|
{ |
704
|
2 |
|
$this->uniqueEmailCheck = $uniqueEmailCheck; |
705
|
|
|
} |
706
|
2 |
|
|
707
|
2 |
|
public function getMetaKeywords(): string |
708
|
|
|
{ |
709
|
|
|
return $this->metaKeywords; |
710
|
|
|
} |
711
|
|
|
|
712
|
|
|
public function setMetaKeywords(string $metaKeywords): void |
713
|
|
|
{ |
714
|
2 |
|
$this->metaKeywords = $metaKeywords; |
715
|
|
|
} |
716
|
2 |
|
|
717
|
|
|
public function getMetaDescription(): string |
718
|
|
|
{ |
719
|
|
|
return $this->metaDescription; |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
public function setMetaDescription(string $metaDescription): void |
723
|
|
|
{ |
724
|
|
|
$this->metaDescription = $metaDescription; |
725
|
|
|
} |
726
|
6 |
|
|
727
|
|
|
public function getAlternativeTitle(): string |
728
|
6 |
|
{ |
729
|
6 |
|
return $this->alternativeTitle; |
730
|
|
|
} |
731
|
|
|
|
732
|
|
|
public function setAlternativeTitle(string $alternativeTitle): void |
733
|
|
|
{ |
734
|
|
|
$this->alternativeTitle = $alternativeTitle; |
735
|
|
|
} |
736
|
|
|
|
737
|
|
|
public function getMetaTitle(): string |
738
|
4 |
|
{ |
739
|
|
|
return $this->getAlternativeTitle() !== '' ? $this->getAlternativeTitle() : $this->getTitle(); |
740
|
4 |
|
} |
741
|
4 |
|
|
742
|
|
|
public function getPriceOptions(): ?ObjectStorage |
743
|
|
|
{ |
744
|
|
|
return $this->priceOptions; |
745
|
|
|
} |
746
|
|
|
|
747
|
|
|
public function setPriceOptions(?ObjectStorage $priceOptions) |
748
|
|
|
{ |
749
|
|
|
$this->priceOptions = $priceOptions; |
750
|
2 |
|
} |
751
|
|
|
|
752
|
2 |
|
public function addPriceOptions(PriceOption $priceOption) |
753
|
2 |
|
{ |
754
|
|
|
$this->priceOptions->attach($priceOption); |
755
|
|
|
} |
756
|
|
|
|
757
|
|
|
public function removePriceOptions(PriceOption $priceOption) |
758
|
|
|
{ |
759
|
|
|
$this->priceOptions->detach($priceOption); |
760
|
2 |
|
} |
761
|
|
|
|
762
|
2 |
|
/** |
763
|
|
|
* Returns all active price options sorted by date ASC |
764
|
|
|
* |
765
|
|
|
* @return array |
766
|
|
|
*/ |
767
|
|
|
public function getActivePriceOptions(): array |
768
|
|
|
{ |
769
|
|
|
$activePriceOptions = []; |
770
|
|
|
if ($this->getPriceOptions()) { |
771
|
|
|
$compareDate = new DateTime('today midnight'); |
772
|
6 |
|
foreach ($this->getPriceOptions() as $priceOption) { |
773
|
|
|
if ($priceOption->getValidUntil() >= $compareDate) { |
774
|
6 |
|
$activePriceOptions[$priceOption->getValidUntil()->getTimestamp()] = $priceOption; |
775
|
6 |
|
} |
776
|
|
|
} |
777
|
|
|
} |
778
|
|
|
ksort($activePriceOptions); |
779
|
|
|
|
780
|
|
|
return $activePriceOptions; |
781
|
|
|
} |
782
|
4 |
|
|
783
|
|
|
/** |
784
|
4 |
|
* Returns the current price of the event respecting possible price options |
785
|
|
|
* |
786
|
|
|
* @return float |
787
|
|
|
*/ |
788
|
|
|
public function getCurrentPrice(): float |
789
|
|
|
{ |
790
|
|
|
$activePriceOptions = $this->getActivePriceOptions(); |
791
|
|
|
if (count($activePriceOptions) >= 1) { |
792
|
|
|
// Sort active price options and return first element |
793
|
|
|
return reset($activePriceOptions)->getPrice(); |
794
|
2 |
|
} |
795
|
|
|
// Just return the price field |
796
|
2 |
|
return $this->price; |
797
|
2 |
|
} |
798
|
|
|
|
799
|
|
|
public function getRegistrationWaitlist(): ?ObjectStorage |
800
|
|
|
{ |
801
|
|
|
return $this->registrationWaitlist; |
802
|
|
|
} |
803
|
|
|
|
804
|
20 |
|
public function setRegistrationWaitlist(?ObjectStorage $registration) |
805
|
|
|
{ |
806
|
20 |
|
$this->registrationWaitlist = $registration; |
807
|
20 |
|
} |
808
|
6 |
|
|
809
|
6 |
|
public function addRegistrationWaitlist(Registration $registration) |
810
|
20 |
|
{ |
811
|
20 |
|
$this->registrationWaitlist->attach($registration); |
812
|
2 |
|
} |
813
|
2 |
|
|
814
|
20 |
|
public function removeRegistrationWaitlist(Registration $registrationToRemove) |
815
|
20 |
|
{ |
816
|
20 |
|
$this->registrationWaitlist->detach($registrationToRemove); |
817
|
|
|
} |
818
|
|
|
|
819
|
|
|
/** |
820
|
|
|
* Returns, if cancellation for registrations of the event is possible |
821
|
|
|
* |
822
|
|
|
* @return bool |
823
|
|
|
*/ |
824
|
10 |
|
public function getCancellationPossible(): bool |
825
|
|
|
{ |
826
|
10 |
|
$today = new DateTime('today'); |
827
|
|
|
|
828
|
|
|
return ($this->getEnableCancel() && $this->getCancelDeadline() > $today) || |
829
|
|
|
($this->getEnableCancel() && $this->getCancelDeadline() === null && $this->getStartdate() > $today); |
830
|
|
|
} |
831
|
|
|
|
832
|
|
|
public function getSpeaker(): ?ObjectStorage |
833
|
|
|
{ |
834
|
|
|
return $this->speaker; |
835
|
|
|
} |
836
|
2 |
|
|
837
|
|
|
public function setSpeaker(?ObjectStorage $speaker) |
838
|
2 |
|
{ |
839
|
2 |
|
$this->speaker = $speaker; |
840
|
|
|
} |
841
|
|
|
|
842
|
|
|
public function addSpeaker(Speaker $speaker) |
843
|
|
|
{ |
844
|
|
|
$this->speaker->attach($speaker); |
845
|
|
|
} |
846
|
2 |
|
|
847
|
|
|
public function removeSpeaker(Speaker $speaker) |
848
|
2 |
|
{ |
849
|
|
|
$this->speaker->detach($speaker); |
850
|
|
|
} |
851
|
|
|
|
852
|
|
|
public function getRegistrationFields(): ?ObjectStorage |
853
|
|
|
{ |
854
|
|
|
return $this->registrationFields; |
855
|
|
|
} |
856
|
|
|
|
857
|
|
|
public function setRegistrationFields(?ObjectStorage $registrationFields) |
858
|
20 |
|
{ |
859
|
|
|
$this->registrationFields = $registrationFields; |
860
|
20 |
|
} |
861
|
20 |
|
|
862
|
|
|
public function addRegistrationFields(Field $registrationField) |
863
|
|
|
{ |
864
|
|
|
$this->registrationFields->attach($registrationField); |
865
|
|
|
} |
866
|
|
|
|
867
|
|
|
public function removeRegistrationFields(Field $registrationField) |
868
|
16 |
|
{ |
869
|
|
|
$this->registrationFields->detach($registrationField); |
870
|
16 |
|
} |
871
|
|
|
|
872
|
|
|
public function getRegistrationFieldsUids(): array |
873
|
|
|
{ |
874
|
|
|
$result = []; |
875
|
|
|
foreach ($this->registrationFields as $registrationField) { |
876
|
|
|
$result[] = $registrationField->getUid(); |
877
|
|
|
} |
878
|
8 |
|
|
879
|
|
|
return $result; |
880
|
8 |
|
} |
881
|
|
|
|
882
|
|
|
/** |
883
|
|
|
* Returns an array with registration field uids and titles |
884
|
|
|
* [uid => title] |
885
|
|
|
* |
886
|
|
|
* @return array |
887
|
|
|
*/ |
888
|
|
|
public function getRegistrationFieldUidsWithTitle(): array |
889
|
10 |
|
{ |
890
|
|
|
$result = []; |
891
|
10 |
|
foreach ($this->registrationFields as $registrationField) { |
892
|
10 |
|
$result[$registrationField->getUid()] = $registrationField->getTitle(); |
893
|
|
|
} |
894
|
|
|
|
895
|
|
|
return $result; |
896
|
|
|
} |
897
|
|
|
|
898
|
|
|
/** |
899
|
|
|
* Special getter to return the amount of registrations that are saved to default language |
900
|
|
|
* Required since TYPO3 9.5 (#82363) |
901
|
6 |
|
* |
902
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
903
|
6 |
|
*/ |
904
|
6 |
|
public function getRegistrations(): ?ObjectStorage |
905
|
|
|
{ |
906
|
|
|
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
907
|
|
|
if ($languageAspect->getId() > 0) { |
908
|
|
|
return $this->getRegistrationsDefaultLanguage(false); |
909
|
|
|
} |
910
|
|
|
|
911
|
22 |
|
return $this->registration; |
912
|
|
|
} |
913
|
22 |
|
|
914
|
|
|
/** |
915
|
|
|
* Special getter to return the amount of waitlist registrations that are saved to default language |
916
|
|
|
* Required since TYPO3 9.5 (#82363) |
917
|
|
|
* |
918
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
919
|
|
|
*/ |
920
|
|
|
public function getRegistrationsWaitlist(): ?ObjectStorage |
921
|
|
|
{ |
922
|
|
|
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
923
|
24 |
|
if ($languageAspect->getId() > 0) { |
924
|
|
|
return $this->getRegistrationsDefaultLanguage(true); |
925
|
24 |
|
} |
926
|
24 |
|
|
927
|
|
|
return $this->registrationWaitlist; |
928
|
|
|
} |
929
|
|
|
|
930
|
|
|
/** |
931
|
|
|
* Returns an objectStorage object holding all registrations in the default language. |
932
|
|
|
* Ensures expected behavior of getRegistration() and getRegistrationWaitlist() since TYPO3 issue #82363 |
933
|
2 |
|
* |
934
|
|
|
* @param bool $waitlist |
935
|
2 |
|
* @return ObjectStorage |
936
|
|
|
*/ |
937
|
|
|
protected function getRegistrationsDefaultLanguage(bool $waitlist = false): ObjectStorage |
938
|
|
|
{ |
939
|
|
|
$result = GeneralUtility::makeInstance(ObjectStorage::class); |
940
|
|
|
$registrationRepository = GeneralUtility::makeInstance(RegistrationRepository::class); |
941
|
|
|
$registrations = $registrationRepository->findByEventAndWaitlist($this, $waitlist); |
942
|
|
|
foreach ($registrations as $registration) { |
943
|
2 |
|
$result->attach($registration); |
944
|
|
|
} |
945
|
2 |
|
|
946
|
|
|
return $result; |
947
|
|
|
} |
948
|
|
|
|
949
|
|
|
public function getEndsSameDay(): bool |
950
|
|
|
{ |
951
|
|
|
if ($this->enddate !== null) { |
952
|
|
|
return $this->startdate->format('d.m.Y') === $this->enddate->format('d.m.Y'); |
|
|
|
|
953
|
2 |
|
} |
954
|
|
|
|
955
|
2 |
|
return true; |
956
|
|
|
} |
957
|
|
|
|
958
|
|
|
public function getSpamCheckChallenge(): string |
959
|
|
|
{ |
960
|
|
|
return MiscUtility::getSpamCheckChallenge($this->getUid()); |
|
|
|
|
961
|
|
|
} |
962
|
|
|
|
963
|
2 |
|
/** |
964
|
|
|
* Returns a string to be used as overlay value for the <core:icon> ViewHelper in the Backend Modules |
965
|
2 |
|
* |
966
|
|
|
* @return string |
967
|
|
|
*/ |
968
|
|
|
public function getBackendIconOverlay(): string |
969
|
|
|
{ |
970
|
|
|
$date = new DateTime(); |
971
|
|
|
$overlay = ''; |
972
|
|
|
if ($this->getHidden()) { |
973
|
|
|
$overlay = 'overlay-hidden'; |
974
|
|
|
} elseif ($this->getEndtime() && $this->getEndtime() < $date) { |
975
|
|
|
$overlay = 'overlay-endtime'; |
976
|
|
|
} elseif (($this->getStarttime() && $this->getStarttime() > $date) || |
977
|
22 |
|
($this->getEndtime() && $this->getEndtime() > $date) |
978
|
|
|
) { |
979
|
22 |
|
$overlay = 'overlay-scheduled'; |
980
|
22 |
|
} |
981
|
22 |
|
|
982
|
22 |
|
return $overlay; |
983
|
22 |
|
} |
984
|
|
|
} |
985
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.