1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Extension "sf_event_mgt" for TYPO3 CMS. |
5
|
|
|
* |
6
|
|
|
* For the full copyright and license information, please read the |
7
|
|
|
* LICENSE.txt file that was distributed with this source code. |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace DERHANSEN\SfEventMgt\Domain\Model; |
11
|
|
|
|
12
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Registration\Field; |
13
|
|
|
use DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository; |
14
|
|
|
use DERHANSEN\SfEventMgt\Utility\MiscUtility; |
15
|
|
|
use TYPO3\CMS\Core\Context\Context; |
16
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
17
|
|
|
use TYPO3\CMS\Extbase\Annotation as Extbase; |
18
|
|
|
use TYPO3\CMS\Extbase\Object\ObjectManager; |
19
|
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Event |
23
|
|
|
* |
24
|
|
|
* @author Torben Hansen <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
class Event extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* @var \DateTime |
30
|
|
|
*/ |
31
|
|
|
protected $tstamp; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Title |
35
|
|
|
* |
36
|
|
|
* @var string |
37
|
|
|
*/ |
38
|
|
|
protected $title = ''; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Teaser |
42
|
|
|
* |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $teaser = ''; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Description |
49
|
|
|
* |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
protected $description = ''; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Program/Schedule |
56
|
|
|
* |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $program = ''; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Startdate and time |
63
|
|
|
* |
64
|
|
|
* @var \DateTime |
65
|
|
|
*/ |
66
|
|
|
protected $startdate; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Enddate and time |
70
|
|
|
* |
71
|
|
|
* @var \DateTime |
72
|
|
|
*/ |
73
|
|
|
protected $enddate; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Max participants |
77
|
|
|
* |
78
|
|
|
* @var int |
79
|
|
|
*/ |
80
|
|
|
protected $maxParticipants = 0; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Max registrations per user |
84
|
|
|
* |
85
|
|
|
* @var int |
86
|
|
|
*/ |
87
|
|
|
protected $maxRegistrationsPerUser = 1; |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* Price |
91
|
|
|
* |
92
|
|
|
* @var float |
93
|
|
|
*/ |
94
|
|
|
protected $price = 0.0; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Currency |
98
|
|
|
* |
99
|
|
|
* @var string |
100
|
|
|
*/ |
101
|
|
|
protected $currency = ''; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Enable payment |
105
|
|
|
* |
106
|
|
|
* @var bool |
107
|
|
|
*/ |
108
|
|
|
protected $enablePayment = false; |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Restrict payment methods |
112
|
|
|
* |
113
|
|
|
* @var bool |
114
|
|
|
*/ |
115
|
|
|
protected $restrictPaymentMethods = false; |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Selected payment methods |
119
|
|
|
* |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
protected $selectedPaymentMethods = ''; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Category |
126
|
|
|
* |
127
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Category> |
128
|
|
|
* @Extbase\ORM\Lazy |
129
|
|
|
*/ |
130
|
|
|
protected $category; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Related |
134
|
|
|
* |
135
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Event> |
136
|
|
|
* @Extbase\ORM\Lazy |
137
|
|
|
*/ |
138
|
|
|
protected $related; |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Registration |
142
|
|
|
* |
143
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration> |
144
|
|
|
* @Extbase\ORM\Cascade("remove") |
145
|
|
|
* @Extbase\ORM\Lazy |
146
|
|
|
*/ |
147
|
|
|
protected $registration; |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Registration waitlist |
151
|
|
|
* |
152
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration> |
153
|
|
|
* @Extbase\ORM\Lazy |
154
|
|
|
*/ |
155
|
|
|
protected $registrationWaitlist; |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Registration fields |
159
|
|
|
* |
160
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Registration\Field> |
161
|
|
|
* @Extbase\ORM\Lazy |
162
|
|
|
*/ |
163
|
|
|
protected $registrationFields; |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Registration start date |
167
|
|
|
* |
168
|
|
|
* @var \DateTime |
169
|
|
|
*/ |
170
|
|
|
protected $registrationStartdate = null; |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Registration deadline date |
174
|
|
|
* |
175
|
|
|
* @var \DateTime |
176
|
|
|
*/ |
177
|
|
|
protected $registrationDeadline; |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* The image |
181
|
|
|
* |
182
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
183
|
|
|
* @Extbase\ORM\Lazy |
184
|
|
|
*/ |
185
|
|
|
protected $image; |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Additional files |
189
|
|
|
* |
190
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
191
|
|
|
* @Extbase\ORM\Lazy |
192
|
|
|
*/ |
193
|
|
|
protected $files; |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* The Location |
197
|
|
|
* |
198
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Model\Location |
199
|
|
|
*/ |
200
|
|
|
protected $location; |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Room |
204
|
|
|
* |
205
|
|
|
* @var string |
206
|
|
|
*/ |
207
|
|
|
protected $room; |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* Enable registration |
211
|
|
|
* |
212
|
|
|
* @var bool |
213
|
|
|
*/ |
214
|
|
|
protected $enableRegistration = false; |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Enable waitlist |
218
|
|
|
* |
219
|
|
|
* @var bool |
220
|
|
|
*/ |
221
|
|
|
protected $enableWaitlist = false; |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* Enable waitlist |
225
|
|
|
* |
226
|
|
|
* @var bool |
227
|
|
|
*/ |
228
|
|
|
protected $enableWaitlistMoveup = false; |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Link |
232
|
|
|
* |
233
|
|
|
* @var string |
234
|
|
|
*/ |
235
|
|
|
protected $link; |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* Top event |
239
|
|
|
* |
240
|
|
|
* @var bool |
241
|
|
|
*/ |
242
|
|
|
protected $topEvent = false; |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* The additionalImage |
246
|
|
|
* |
247
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> |
248
|
|
|
* @Extbase\ORM\Lazy |
249
|
|
|
*/ |
250
|
|
|
protected $additionalImage; |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* The organisator |
254
|
|
|
* |
255
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Model\Organisator |
256
|
|
|
*/ |
257
|
|
|
protected $organisator; |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Notify admin |
261
|
|
|
* |
262
|
|
|
* @var bool |
263
|
|
|
*/ |
264
|
|
|
protected $notifyAdmin = true; |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* Notify organisator |
268
|
|
|
* |
269
|
|
|
* @var bool |
270
|
|
|
*/ |
271
|
|
|
protected $notifyOrganisator = false; |
272
|
|
|
|
273
|
|
|
/** |
274
|
|
|
* Enable cancel of registration |
275
|
|
|
* |
276
|
|
|
* @var bool |
277
|
|
|
*/ |
278
|
|
|
protected $enableCancel = false; |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Deadline for cancel |
282
|
|
|
* |
283
|
|
|
* @var \DateTime |
284
|
|
|
*/ |
285
|
|
|
protected $cancelDeadline; |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Enable auto confirmation |
289
|
|
|
* |
290
|
|
|
* @var bool |
291
|
|
|
*/ |
292
|
|
|
protected $enableAutoconfirm = false; |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* Unique email check |
296
|
|
|
* |
297
|
|
|
* @var bool |
298
|
|
|
*/ |
299
|
|
|
protected $uniqueEmailCheck = false; |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* Price options |
303
|
|
|
* |
304
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\PriceOption> |
305
|
|
|
* @Extbase\ORM\Cascade("remove") |
306
|
|
|
* @Extbase\ORM\Lazy |
307
|
|
|
*/ |
308
|
|
|
protected $priceOptions; |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* Speaker |
312
|
|
|
* |
313
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\DERHANSEN\SfEventMgt\Domain\Model\Speaker> |
314
|
|
|
* @Extbase\ORM\Lazy |
315
|
|
|
*/ |
316
|
|
|
protected $speaker; |
317
|
|
|
|
318
|
|
|
/** |
319
|
|
|
* Constructor |
320
|
|
|
*/ |
321
|
|
|
public function __construct() |
322
|
|
|
{ |
323
|
|
|
$this->category = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
324
|
|
|
$this->related = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
325
|
|
|
$this->registration = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
326
|
|
|
$this->registrationWaitlist = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
327
|
|
|
$this->registrationFields = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
328
|
|
|
$this->image = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
329
|
|
|
$this->files = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
330
|
|
|
$this->additionalImage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
331
|
|
|
$this->priceOptions = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
332
|
|
|
$this->speaker = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* Get timestamp |
337
|
|
|
* |
338
|
|
|
* @return \DateTime |
339
|
|
|
*/ |
340
|
|
|
public function getTstamp() |
341
|
|
|
{ |
342
|
|
|
return $this->tstamp; |
343
|
|
|
} |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* Set time stamp |
347
|
|
|
* |
348
|
|
|
* @param \DateTime $tstamp time stamp |
349
|
|
|
*/ |
350
|
|
|
public function setTstamp($tstamp) |
351
|
|
|
{ |
352
|
|
|
$this->tstamp = $tstamp; |
353
|
|
|
} |
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* Returns the title |
357
|
|
|
* |
358
|
|
|
* @return string $title |
359
|
|
|
*/ |
360
|
|
|
public function getTitle() |
361
|
|
|
{ |
362
|
|
|
return $this->title; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* Sets the title |
367
|
|
|
* |
368
|
|
|
* @param string $title Title |
369
|
|
|
*/ |
370
|
|
|
public function setTitle($title) |
371
|
|
|
{ |
372
|
|
|
$this->title = $title; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* Returns the teaser |
377
|
|
|
* |
378
|
|
|
* @return string |
379
|
|
|
*/ |
380
|
|
|
public function getTeaser() |
381
|
|
|
{ |
382
|
|
|
return $this->teaser; |
383
|
|
|
} |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* Sets the teaser |
387
|
|
|
* |
388
|
|
|
* @param string $teaser Teaser |
389
|
|
|
*/ |
390
|
|
|
public function setTeaser($teaser) |
391
|
|
|
{ |
392
|
|
|
$this->teaser = $teaser; |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Returns the description |
397
|
|
|
* |
398
|
|
|
* @return string $description |
399
|
|
|
*/ |
400
|
|
|
public function getDescription() |
401
|
|
|
{ |
402
|
|
|
return $this->description; |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
/** |
406
|
|
|
* Sets the description |
407
|
|
|
* |
408
|
|
|
* @param string $description Description |
409
|
|
|
*/ |
410
|
|
|
public function setDescription($description) |
411
|
|
|
{ |
412
|
|
|
$this->description = $description; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* Returns the program |
417
|
|
|
* |
418
|
|
|
* @return string $program |
419
|
|
|
*/ |
420
|
|
|
public function getProgram() |
421
|
|
|
{ |
422
|
|
|
return $this->program; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Sets the program |
427
|
|
|
* |
428
|
|
|
* @param string $program The program |
429
|
|
|
*/ |
430
|
|
|
public function setProgram($program) |
431
|
|
|
{ |
432
|
|
|
$this->program = $program; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* Returns the startdate |
437
|
|
|
* |
438
|
|
|
* @return \DateTime $startdate |
439
|
|
|
*/ |
440
|
|
|
public function getStartdate() |
441
|
|
|
{ |
442
|
|
|
return $this->startdate; |
443
|
|
|
} |
444
|
|
|
|
445
|
|
|
/** |
446
|
|
|
* Sets the startdate |
447
|
|
|
* |
448
|
|
|
* @param \DateTime $startdate Startdate |
449
|
|
|
*/ |
450
|
|
|
public function setStartdate(\DateTime $startdate) |
451
|
|
|
{ |
452
|
|
|
$this->startdate = $startdate; |
453
|
|
|
} |
454
|
|
|
|
455
|
|
|
/** |
456
|
|
|
* Returns the enddate |
457
|
|
|
* |
458
|
|
|
* @return \DateTime $enddate |
459
|
|
|
*/ |
460
|
|
|
public function getEnddate() |
461
|
|
|
{ |
462
|
|
|
return $this->enddate; |
463
|
|
|
} |
464
|
|
|
|
465
|
|
|
/** |
466
|
|
|
* Sets the enddate |
467
|
|
|
* |
468
|
|
|
* @param \DateTime $enddate Enddate |
469
|
|
|
*/ |
470
|
|
|
public function setEnddate(\DateTime $enddate) |
471
|
|
|
{ |
472
|
|
|
$this->enddate = $enddate; |
473
|
|
|
} |
474
|
|
|
|
475
|
|
|
/** |
476
|
|
|
* Returns the participants |
477
|
|
|
* |
478
|
|
|
* @return int $participants |
479
|
|
|
*/ |
480
|
|
|
public function getMaxParticipants() |
481
|
|
|
{ |
482
|
|
|
return $this->maxParticipants; |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
/** |
486
|
|
|
* Sets the participants |
487
|
|
|
* |
488
|
|
|
* @param int $participants Participants |
489
|
|
|
*/ |
490
|
|
|
public function setMaxParticipants($participants) |
491
|
|
|
{ |
492
|
|
|
$this->maxParticipants = $participants; |
493
|
|
|
} |
494
|
|
|
|
495
|
|
|
/** |
496
|
|
|
* Returns the price |
497
|
|
|
* |
498
|
|
|
* @return float $price |
499
|
|
|
*/ |
500
|
|
|
public function getPrice() |
501
|
|
|
{ |
502
|
|
|
return $this->price; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* Sets the price |
507
|
|
|
* |
508
|
|
|
* @param float $price Price |
509
|
|
|
*/ |
510
|
|
|
public function setPrice($price) |
511
|
|
|
{ |
512
|
|
|
$this->price = $price; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* Returns the currency |
517
|
|
|
* |
518
|
|
|
* @return string $currency |
519
|
|
|
*/ |
520
|
|
|
public function getCurrency() |
521
|
|
|
{ |
522
|
|
|
return $this->currency; |
523
|
|
|
} |
524
|
|
|
|
525
|
|
|
/** |
526
|
|
|
* Sets the currency |
527
|
|
|
* |
528
|
|
|
* @param string $currency Currency |
529
|
|
|
*/ |
530
|
|
|
public function setCurrency($currency) |
531
|
|
|
{ |
532
|
|
|
$this->currency = $currency; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
/** |
536
|
|
|
* Returns if payment is enabled |
537
|
|
|
* |
538
|
|
|
* @return bool |
539
|
|
|
*/ |
540
|
|
|
public function getEnablePayment() |
541
|
|
|
{ |
542
|
|
|
return $this->enablePayment; |
543
|
|
|
} |
544
|
|
|
|
545
|
|
|
/** |
546
|
|
|
* Sets enablePayment |
547
|
|
|
* |
548
|
|
|
* @param bool $enablePayment |
549
|
|
|
*/ |
550
|
|
|
public function setEnablePayment($enablePayment) |
551
|
|
|
{ |
552
|
|
|
$this->enablePayment = $enablePayment; |
553
|
|
|
} |
554
|
|
|
|
555
|
|
|
/** |
556
|
|
|
* Returns if payment methods should be restricted |
557
|
|
|
* |
558
|
|
|
* @return bool |
559
|
|
|
*/ |
560
|
|
|
public function getRestrictPaymentMethods() |
561
|
|
|
{ |
562
|
|
|
return $this->restrictPaymentMethods; |
563
|
|
|
} |
564
|
|
|
|
565
|
|
|
/** |
566
|
|
|
* Sets if payment methods should be restricted |
567
|
|
|
* |
568
|
|
|
* @param bool $restrictPaymentMethods |
569
|
|
|
*/ |
570
|
|
|
public function setRestrictPaymentMethods($restrictPaymentMethods) |
571
|
|
|
{ |
572
|
|
|
$this->restrictPaymentMethods = $restrictPaymentMethods; |
573
|
|
|
} |
574
|
|
|
|
575
|
|
|
/** |
576
|
|
|
* Returns selected payment methods |
577
|
|
|
* |
578
|
|
|
* @return string |
579
|
|
|
*/ |
580
|
|
|
public function getSelectedPaymentMethods() |
581
|
|
|
{ |
582
|
|
|
return $this->selectedPaymentMethods; |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
/** |
586
|
|
|
* Sets selected payment methods |
587
|
|
|
* |
588
|
|
|
* @param string $selectedPaymentMethods |
589
|
|
|
*/ |
590
|
|
|
public function setSelectedPaymentMethods($selectedPaymentMethods) |
591
|
|
|
{ |
592
|
|
|
$this->selectedPaymentMethods = $selectedPaymentMethods; |
593
|
|
|
} |
594
|
|
|
|
595
|
|
|
/** |
596
|
|
|
* Adds a Category |
597
|
|
|
* |
598
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Category $category Category |
599
|
|
|
*/ |
600
|
|
|
public function addCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $category) |
601
|
|
|
{ |
602
|
|
|
$this->category->attach($category); |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* Removes a Category |
607
|
|
|
* |
608
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove The Category to be removed |
609
|
|
|
*/ |
610
|
|
|
public function removeCategory(\DERHANSEN\SfEventMgt\Domain\Model\Category $categoryToRemove) |
611
|
|
|
{ |
612
|
|
|
$this->category->detach($categoryToRemove); |
613
|
|
|
} |
614
|
|
|
|
615
|
|
|
/** |
616
|
|
|
* Returns the category |
617
|
|
|
* |
618
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
619
|
|
|
*/ |
620
|
|
|
public function getCategory() |
621
|
|
|
{ |
622
|
|
|
return $this->category; |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
/** |
626
|
|
|
* Sets the category |
627
|
|
|
* |
628
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $category Category |
629
|
|
|
*/ |
630
|
|
|
public function setCategory(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $category) |
631
|
|
|
{ |
632
|
|
|
$this->category = $category; |
633
|
|
|
} |
634
|
|
|
|
635
|
|
|
/** |
636
|
|
|
* Returns related events |
637
|
|
|
* |
638
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
639
|
|
|
*/ |
640
|
|
|
public function getRelated() |
641
|
|
|
{ |
642
|
|
|
return $this->related; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
/** |
646
|
|
|
* Sets related events |
647
|
|
|
* |
648
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $related |
649
|
|
|
*/ |
650
|
|
|
public function setRelated($related) |
651
|
|
|
{ |
652
|
|
|
$this->related = $related; |
653
|
|
|
} |
654
|
|
|
|
655
|
|
|
/** |
656
|
|
|
* Adds a related event |
657
|
|
|
* |
658
|
|
|
* @param Event $event |
659
|
|
|
*/ |
660
|
|
|
public function addRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event) |
661
|
|
|
{ |
662
|
|
|
$this->related->attach($event); |
663
|
|
|
} |
664
|
|
|
|
665
|
|
|
/** |
666
|
|
|
* Removes a related event |
667
|
|
|
* |
668
|
|
|
* @param Event $event |
669
|
|
|
*/ |
670
|
|
|
public function removeRelated(\DERHANSEN\SfEventMgt\Domain\Model\Event $event) |
671
|
|
|
{ |
672
|
|
|
$this->related->detach($event); |
673
|
|
|
} |
674
|
|
|
|
675
|
|
|
/** |
676
|
|
|
* Adds a Registration |
677
|
|
|
* |
678
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration |
679
|
|
|
*/ |
680
|
|
|
public function addRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration) |
681
|
|
|
{ |
682
|
|
|
$this->registration->attach($registration); |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
/** |
686
|
|
|
* Removes a Registration |
687
|
|
|
* |
688
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration |
689
|
|
|
*/ |
690
|
|
|
public function removeRegistration(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove) |
691
|
|
|
{ |
692
|
|
|
$this->registration->detach($registrationToRemove); |
693
|
|
|
} |
694
|
|
|
|
695
|
|
|
/** |
696
|
|
|
* Returns the Registration |
697
|
|
|
* |
698
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration |
699
|
|
|
*/ |
700
|
|
|
public function getRegistration() |
701
|
|
|
{ |
702
|
|
|
return $this->registration; |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
/** |
706
|
|
|
* Sets the Registration |
707
|
|
|
* |
708
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration |
709
|
|
|
*/ |
710
|
|
|
public function setRegistration(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration) |
711
|
|
|
{ |
712
|
|
|
$this->registration = $registration; |
713
|
|
|
} |
714
|
|
|
|
715
|
|
|
/** |
716
|
|
|
* Adds an image |
717
|
|
|
* |
718
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image Image |
719
|
|
|
*/ |
720
|
|
|
public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) |
721
|
|
|
{ |
722
|
|
|
$this->image->attach($image); |
723
|
|
|
} |
724
|
|
|
|
725
|
|
|
/** |
726
|
|
|
* Removes an image |
727
|
|
|
* |
728
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove Image |
729
|
|
|
*/ |
730
|
|
|
public function removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove) |
731
|
|
|
{ |
732
|
|
|
$this->image->detach($imageToRemove); |
733
|
|
|
} |
734
|
|
|
|
735
|
|
|
/** |
736
|
|
|
* Returns the image |
737
|
|
|
* |
738
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $image |
739
|
|
|
*/ |
740
|
|
|
public function getImage() |
741
|
|
|
{ |
742
|
|
|
return $this->image; |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
/** |
746
|
|
|
* Sets the image |
747
|
|
|
* |
748
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $image Image |
749
|
|
|
*/ |
750
|
|
|
public function setImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $image) |
751
|
|
|
{ |
752
|
|
|
$this->image = $image; |
753
|
|
|
} |
754
|
|
|
|
755
|
|
|
/** |
756
|
|
|
* Adds a file |
757
|
|
|
* |
758
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $file File |
759
|
|
|
*/ |
760
|
|
|
public function addFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $file) |
761
|
|
|
{ |
762
|
|
|
$this->files->attach($file); |
763
|
|
|
} |
764
|
|
|
|
765
|
|
|
/** |
766
|
|
|
* Removes a file |
767
|
|
|
* |
768
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove File |
769
|
|
|
*/ |
770
|
|
|
public function removeFiles(\TYPO3\CMS\Extbase\Domain\Model\FileReference $fileToRemove) |
771
|
|
|
{ |
772
|
|
|
$this->files->detach($fileToRemove); |
773
|
|
|
} |
774
|
|
|
|
775
|
|
|
/** |
776
|
|
|
* Returns the files |
777
|
|
|
* |
778
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files |
779
|
|
|
*/ |
780
|
|
|
public function getFiles() |
781
|
|
|
{ |
782
|
|
|
return $this->files; |
783
|
|
|
} |
784
|
|
|
|
785
|
|
|
/** |
786
|
|
|
* Sets the files |
787
|
|
|
* |
788
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $files Files |
789
|
|
|
*/ |
790
|
|
|
public function setFiles(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $files) |
791
|
|
|
{ |
792
|
|
|
$this->files = $files; |
793
|
|
|
} |
794
|
|
|
|
795
|
|
|
/** |
796
|
|
|
* Returns if the registration for this event is logically possible |
797
|
|
|
* |
798
|
|
|
* @return bool |
799
|
|
|
*/ |
800
|
|
|
public function getRegistrationPossible() |
801
|
|
|
{ |
802
|
|
|
$maxParticipantsNotReached = true; |
803
|
|
|
if ($this->getMaxParticipants() > 0 && $this->getRegistrations()->count() >= $this->maxParticipants) { |
804
|
|
|
$maxParticipantsNotReached = false; |
805
|
|
|
} |
806
|
|
|
$deadlineNotReached = true; |
807
|
|
|
if ($this->getRegistrationDeadline() != null && $this->getRegistrationDeadline() <= new \DateTime()) { |
808
|
|
|
$deadlineNotReached = false; |
809
|
|
|
} |
810
|
|
|
$registrationStartReached = true; |
811
|
|
|
if ($this->getRegistrationStartdate() != null && $this->getRegistrationStartdate() > new \DateTime()) { |
812
|
|
|
$registrationStartReached = false; |
813
|
|
|
} |
814
|
|
|
|
815
|
|
|
return ($this->getStartdate() > new \DateTime()) && |
816
|
|
|
($maxParticipantsNotReached || !$maxParticipantsNotReached && $this->enableWaitlist) && |
817
|
|
|
$this->getEnableRegistration() && $deadlineNotReached && $registrationStartReached; |
818
|
|
|
} |
819
|
|
|
|
820
|
|
|
/** |
821
|
|
|
* Returns the amount of free places |
822
|
|
|
* |
823
|
|
|
* @return int |
824
|
|
|
*/ |
825
|
|
|
public function getFreePlaces() |
826
|
|
|
{ |
827
|
|
|
return $this->maxParticipants - $this->getRegistrations()->count(); |
828
|
|
|
} |
829
|
|
|
|
830
|
|
|
/** |
831
|
|
|
* Sets the location |
832
|
|
|
* |
833
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Location $location Location |
834
|
|
|
*/ |
835
|
|
|
public function setLocation($location) |
836
|
|
|
{ |
837
|
|
|
$this->location = $location; |
838
|
|
|
} |
839
|
|
|
|
840
|
|
|
/** |
841
|
|
|
* Returns the location |
842
|
|
|
* |
843
|
|
|
* @return \DERHANSEN\SfEventMgt\Domain\Model\Location |
844
|
|
|
*/ |
845
|
|
|
public function getLocation() |
846
|
|
|
{ |
847
|
|
|
return $this->location; |
848
|
|
|
} |
849
|
|
|
|
850
|
|
|
/** |
851
|
|
|
* Returns the room |
852
|
|
|
* |
853
|
|
|
* @return string |
854
|
|
|
*/ |
855
|
|
|
public function getRoom() |
856
|
|
|
{ |
857
|
|
|
return $this->room; |
858
|
|
|
} |
859
|
|
|
|
860
|
|
|
/** |
861
|
|
|
* Sets the room |
862
|
|
|
* |
863
|
|
|
* @param string $room |
864
|
|
|
*/ |
865
|
|
|
public function setRoom($room) |
866
|
|
|
{ |
867
|
|
|
$this->room = $room; |
868
|
|
|
} |
869
|
|
|
|
870
|
|
|
/** |
871
|
|
|
* Sets enableRegistration |
872
|
|
|
* |
873
|
|
|
* @param bool $enableRegistration EnableRegistration |
874
|
|
|
*/ |
875
|
|
|
public function setEnableRegistration($enableRegistration) |
876
|
|
|
{ |
877
|
|
|
$this->enableRegistration = $enableRegistration; |
878
|
|
|
} |
879
|
|
|
|
880
|
|
|
/** |
881
|
|
|
* Returns if registration is enabled |
882
|
|
|
* |
883
|
|
|
* @return bool |
884
|
|
|
*/ |
885
|
|
|
public function getEnableRegistration() |
886
|
|
|
{ |
887
|
|
|
return $this->enableRegistration; |
888
|
|
|
} |
889
|
|
|
|
890
|
|
|
/** |
891
|
|
|
* Returns enableWaitlist |
892
|
|
|
* |
893
|
|
|
* @return bool |
894
|
|
|
*/ |
895
|
|
|
public function getEnableWaitlist() |
896
|
|
|
{ |
897
|
|
|
return $this->enableWaitlist; |
898
|
|
|
} |
899
|
|
|
|
900
|
|
|
/** |
901
|
|
|
* Sets enableWaitlist |
902
|
|
|
* |
903
|
|
|
* @param bool $enableWaitlist |
904
|
|
|
*/ |
905
|
|
|
public function setEnableWaitlist($enableWaitlist) |
906
|
|
|
{ |
907
|
|
|
$this->enableWaitlist = $enableWaitlist; |
908
|
|
|
} |
909
|
|
|
|
910
|
|
|
/** |
911
|
|
|
* @return bool |
912
|
|
|
*/ |
913
|
|
|
public function getEnableWaitlistMoveup(): bool |
914
|
|
|
{ |
915
|
|
|
return $this->enableWaitlistMoveup; |
916
|
|
|
} |
917
|
|
|
|
918
|
|
|
/** |
919
|
|
|
* @param bool $enableWaitlistMoveup |
920
|
|
|
*/ |
921
|
|
|
public function setEnableWaitlistMoveup($enableWaitlistMoveup): void |
922
|
|
|
{ |
923
|
|
|
$this->enableWaitlistMoveup = $enableWaitlistMoveup; |
924
|
|
|
} |
925
|
|
|
|
926
|
|
|
/** |
927
|
|
|
* Sets the registration startdate |
928
|
|
|
* |
929
|
|
|
* @param \DateTime $registrationStartdate RegistrationStartdate |
930
|
|
|
* |
931
|
|
|
* @return void |
932
|
|
|
*/ |
933
|
|
|
public function setRegistrationStartdate(\DateTime $registrationStartdate) |
934
|
|
|
{ |
935
|
|
|
$this->registrationStartdate = $registrationStartdate; |
936
|
|
|
} |
937
|
|
|
|
938
|
|
|
/** |
939
|
|
|
* Returns the registration startdate |
940
|
|
|
* |
941
|
|
|
* @return \DateTime |
942
|
|
|
*/ |
943
|
|
|
public function getRegistrationStartdate() |
944
|
|
|
{ |
945
|
|
|
return $this->registrationStartdate; |
946
|
|
|
} |
947
|
|
|
|
948
|
|
|
/** |
949
|
|
|
* Sets the registration deadline |
950
|
|
|
* |
951
|
|
|
* @param \DateTime $registrationDeadline RegistrationDeadline |
952
|
|
|
*/ |
953
|
|
|
public function setRegistrationDeadline(\DateTime $registrationDeadline) |
954
|
|
|
{ |
955
|
|
|
$this->registrationDeadline = $registrationDeadline; |
956
|
|
|
} |
957
|
|
|
|
958
|
|
|
/** |
959
|
|
|
* Returns the registration deadline |
960
|
|
|
* |
961
|
|
|
* @return \DateTime |
962
|
|
|
*/ |
963
|
|
|
public function getRegistrationDeadline() |
964
|
|
|
{ |
965
|
|
|
return $this->registrationDeadline; |
966
|
|
|
} |
967
|
|
|
|
968
|
|
|
/** |
969
|
|
|
* Sets the link |
970
|
|
|
* |
971
|
|
|
* @param string $link Link |
972
|
|
|
*/ |
973
|
|
|
public function setLink($link) |
974
|
|
|
{ |
975
|
|
|
$this->link = $link; |
976
|
|
|
} |
977
|
|
|
|
978
|
|
|
/** |
979
|
|
|
* Returns the link |
980
|
|
|
* |
981
|
|
|
* @return string |
982
|
|
|
*/ |
983
|
|
|
public function getLink() |
984
|
|
|
{ |
985
|
|
|
return $this->link; |
986
|
|
|
} |
987
|
|
|
|
988
|
|
|
/** |
989
|
|
|
* Sets topEvent |
990
|
|
|
* |
991
|
|
|
* @param bool $topEvent TopEvent |
992
|
|
|
*/ |
993
|
|
|
public function setTopEvent($topEvent) |
994
|
|
|
{ |
995
|
|
|
$this->topEvent = $topEvent; |
996
|
|
|
} |
997
|
|
|
|
998
|
|
|
/** |
999
|
|
|
* Returns if topEvent is checked |
1000
|
|
|
* |
1001
|
|
|
* @return bool |
1002
|
|
|
*/ |
1003
|
|
|
public function getTopEvent() |
1004
|
|
|
{ |
1005
|
|
|
return $this->topEvent; |
1006
|
|
|
} |
1007
|
|
|
|
1008
|
|
|
/** |
1009
|
|
|
* Returns max regisrations per user |
1010
|
|
|
* |
1011
|
|
|
* @return int |
1012
|
|
|
*/ |
1013
|
|
|
public function getMaxRegistrationsPerUser() |
1014
|
|
|
{ |
1015
|
|
|
return $this->maxRegistrationsPerUser; |
1016
|
|
|
} |
1017
|
|
|
|
1018
|
|
|
/** |
1019
|
|
|
* Sets max registrations per user |
1020
|
|
|
* |
1021
|
|
|
* @param int $maxRegistrationsPerUser MaxRegistrationsPerUser |
1022
|
|
|
*/ |
1023
|
|
|
public function setMaxRegistrationsPerUser($maxRegistrationsPerUser) |
1024
|
|
|
{ |
1025
|
|
|
$this->maxRegistrationsPerUser = $maxRegistrationsPerUser; |
1026
|
|
|
} |
1027
|
|
|
|
1028
|
|
|
/** |
1029
|
|
|
* Adds an additionalImage |
1030
|
|
|
* |
1031
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage The Image |
1032
|
|
|
*/ |
1033
|
|
|
public function addAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImage) |
1034
|
|
|
{ |
1035
|
|
|
$this->additionalImage->attach($additionalImage); |
1036
|
|
|
} |
1037
|
|
|
|
1038
|
|
|
/** |
1039
|
|
|
* Removes an additionalImage |
1040
|
|
|
* |
1041
|
|
|
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove The Image |
1042
|
|
|
*/ |
1043
|
|
|
public function removeAdditionalImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $additionalImageToRemove) |
1044
|
|
|
{ |
1045
|
|
|
$this->additionalImage->detach($additionalImageToRemove); |
1046
|
|
|
} |
1047
|
|
|
|
1048
|
|
|
/** |
1049
|
|
|
* Returns the additionalImage |
1050
|
|
|
* |
1051
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage |
1052
|
|
|
*/ |
1053
|
|
|
public function getAdditionalImage() |
1054
|
|
|
{ |
1055
|
|
|
return $this->additionalImage; |
1056
|
|
|
} |
1057
|
|
|
|
1058
|
|
|
/** |
1059
|
|
|
* Sets the additionalImage |
1060
|
|
|
* |
1061
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage The Image |
1062
|
|
|
*/ |
1063
|
|
|
public function setAdditionalImage(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $additionalImage) |
1064
|
|
|
{ |
1065
|
|
|
$this->additionalImage = $additionalImage; |
1066
|
|
|
} |
1067
|
|
|
|
1068
|
|
|
/** |
1069
|
|
|
* Returns the organisator |
1070
|
|
|
* |
1071
|
|
|
* @return Organisator |
1072
|
|
|
*/ |
1073
|
|
|
public function getOrganisator() |
1074
|
|
|
{ |
1075
|
|
|
return $this->organisator; |
1076
|
|
|
} |
1077
|
|
|
|
1078
|
|
|
/** |
1079
|
|
|
* Sets the organisator |
1080
|
|
|
* |
1081
|
|
|
* @param Organisator $organisator The organisator |
1082
|
|
|
*/ |
1083
|
|
|
public function setOrganisator($organisator) |
1084
|
|
|
{ |
1085
|
|
|
$this->organisator = $organisator; |
1086
|
|
|
} |
1087
|
|
|
|
1088
|
|
|
/** |
1089
|
|
|
* Returns notifyAdmin |
1090
|
|
|
* |
1091
|
|
|
* @return bool |
1092
|
|
|
*/ |
1093
|
|
|
public function getNotifyAdmin() |
1094
|
|
|
{ |
1095
|
|
|
return $this->notifyAdmin; |
1096
|
|
|
} |
1097
|
|
|
|
1098
|
|
|
/** |
1099
|
|
|
* Sets notifyAdmin |
1100
|
|
|
* |
1101
|
|
|
* @param bool $notifyAdmin NotifyAdmin |
1102
|
|
|
*/ |
1103
|
|
|
public function setNotifyAdmin($notifyAdmin) |
1104
|
|
|
{ |
1105
|
|
|
$this->notifyAdmin = $notifyAdmin; |
1106
|
|
|
} |
1107
|
|
|
|
1108
|
|
|
/** |
1109
|
|
|
* Returns if notifyAdmin is set |
1110
|
|
|
* |
1111
|
|
|
* @return bool |
1112
|
|
|
*/ |
1113
|
|
|
public function getNotifyOrganisator() |
1114
|
|
|
{ |
1115
|
|
|
return $this->notifyOrganisator; |
1116
|
|
|
} |
1117
|
|
|
|
1118
|
|
|
/** |
1119
|
|
|
* Sets notifyOrganisator |
1120
|
|
|
* |
1121
|
|
|
* @param bool $notifyOrganisator NotifyOrganisator |
1122
|
|
|
*/ |
1123
|
|
|
public function setNotifyOrganisator($notifyOrganisator) |
1124
|
|
|
{ |
1125
|
|
|
$this->notifyOrganisator = $notifyOrganisator; |
1126
|
|
|
} |
1127
|
|
|
|
1128
|
|
|
/** |
1129
|
|
|
* Sets enableCancel |
1130
|
|
|
* |
1131
|
|
|
* @param bool $enableCancel EnableCancel |
1132
|
|
|
*/ |
1133
|
|
|
public function setEnableCancel($enableCancel) |
1134
|
|
|
{ |
1135
|
|
|
$this->enableCancel = $enableCancel; |
1136
|
|
|
} |
1137
|
|
|
|
1138
|
|
|
/** |
1139
|
|
|
* Returns if registration can be canceled |
1140
|
|
|
* |
1141
|
|
|
* @return bool |
1142
|
|
|
*/ |
1143
|
|
|
public function getEnableCancel() |
1144
|
|
|
{ |
1145
|
|
|
return $this->enableCancel; |
1146
|
|
|
} |
1147
|
|
|
|
1148
|
|
|
/** |
1149
|
|
|
* Sets the cancel deadline |
1150
|
|
|
* |
1151
|
|
|
* @param \DateTime $cancelDeadline CancelDeadline |
1152
|
|
|
*/ |
1153
|
|
|
public function setCancelDeadline(\DateTime $cancelDeadline) |
1154
|
|
|
{ |
1155
|
|
|
$this->cancelDeadline = $cancelDeadline; |
1156
|
|
|
} |
1157
|
|
|
|
1158
|
|
|
/** |
1159
|
|
|
* Returns the cancel deadline |
1160
|
|
|
* |
1161
|
|
|
* @return \DateTime |
1162
|
|
|
*/ |
1163
|
|
|
public function getCancelDeadline() |
1164
|
|
|
{ |
1165
|
|
|
return $this->cancelDeadline; |
1166
|
|
|
} |
1167
|
|
|
|
1168
|
|
|
/** |
1169
|
|
|
* Returns if autoconfirmation is enabled |
1170
|
|
|
* |
1171
|
|
|
* @return bool |
1172
|
|
|
*/ |
1173
|
|
|
public function getEnableAutoconfirm() |
1174
|
|
|
{ |
1175
|
|
|
return $this->enableAutoconfirm; |
1176
|
|
|
} |
1177
|
|
|
|
1178
|
|
|
/** |
1179
|
|
|
* Sets enable autoconfirm |
1180
|
|
|
* |
1181
|
|
|
* @param bool $enableAutoconfirm |
1182
|
|
|
*/ |
1183
|
|
|
public function setEnableAutoconfirm($enableAutoconfirm) |
1184
|
|
|
{ |
1185
|
|
|
$this->enableAutoconfirm = $enableAutoconfirm; |
1186
|
|
|
} |
1187
|
|
|
|
1188
|
|
|
/** |
1189
|
|
|
* Returns uniqueEmailCheck |
1190
|
|
|
* |
1191
|
|
|
* @return bool |
1192
|
|
|
*/ |
1193
|
|
|
public function getUniqueEmailCheck() |
1194
|
|
|
{ |
1195
|
|
|
return $this->uniqueEmailCheck; |
1196
|
|
|
} |
1197
|
|
|
|
1198
|
|
|
/** |
1199
|
|
|
* Sets UniqueEmailCheck |
1200
|
|
|
* |
1201
|
|
|
* @param bool $uniqueEmailCheck |
1202
|
|
|
*/ |
1203
|
|
|
public function setUniqueEmailCheck($uniqueEmailCheck) |
1204
|
|
|
{ |
1205
|
|
|
$this->uniqueEmailCheck = $uniqueEmailCheck; |
1206
|
|
|
} |
1207
|
|
|
|
1208
|
|
|
/** |
1209
|
|
|
* Returns price options |
1210
|
|
|
* |
1211
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1212
|
|
|
*/ |
1213
|
|
|
public function getPriceOptions() |
1214
|
|
|
{ |
1215
|
|
|
return $this->priceOptions; |
1216
|
|
|
} |
1217
|
|
|
|
1218
|
|
|
/** |
1219
|
|
|
* Sets price options |
1220
|
|
|
* |
1221
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $priceOptions |
1222
|
|
|
*/ |
1223
|
|
|
public function setPriceOptions($priceOptions) |
1224
|
|
|
{ |
1225
|
|
|
$this->priceOptions = $priceOptions; |
1226
|
|
|
} |
1227
|
|
|
|
1228
|
|
|
/** |
1229
|
|
|
* Adds a price option |
1230
|
|
|
* |
1231
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option |
1232
|
|
|
*/ |
1233
|
|
|
public function addPriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption) |
1234
|
|
|
{ |
1235
|
|
|
$this->priceOptions->attach($priceOption); |
1236
|
|
|
} |
1237
|
|
|
|
1238
|
|
|
/** |
1239
|
|
|
* Removes a Registration |
1240
|
|
|
* |
1241
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption Price option |
1242
|
|
|
*/ |
1243
|
|
|
public function removePriceOptions(\DERHANSEN\SfEventMgt\Domain\Model\PriceOption $priceOption) |
1244
|
|
|
{ |
1245
|
|
|
$this->priceOptions->detach($priceOption); |
1246
|
|
|
} |
1247
|
|
|
|
1248
|
|
|
/** |
1249
|
|
|
* Returns all active price options sorted by date ASC |
1250
|
|
|
* |
1251
|
|
|
* @return array |
1252
|
|
|
*/ |
1253
|
|
|
public function getActivePriceOptions() |
1254
|
|
|
{ |
1255
|
|
|
$activePriceOptions = []; |
1256
|
|
|
if ($this->getPriceOptions()) { |
1257
|
|
|
$compareDate = new \DateTime('today midnight'); |
1258
|
|
|
foreach ($this->getPriceOptions() as $priceOption) { |
1259
|
|
|
if ($priceOption->getValidUntil() >= $compareDate) { |
1260
|
|
|
$activePriceOptions[$priceOption->getValidUntil()->getTimestamp()] = $priceOption; |
1261
|
|
|
} |
1262
|
|
|
} |
1263
|
|
|
} |
1264
|
|
|
ksort($activePriceOptions); |
1265
|
|
|
|
1266
|
|
|
return $activePriceOptions; |
1267
|
|
|
} |
1268
|
|
|
|
1269
|
|
|
/** |
1270
|
|
|
* Returns the current price of the event respecting possible price options |
1271
|
|
|
* |
1272
|
|
|
* @return float |
1273
|
|
|
*/ |
1274
|
|
|
public function getCurrentPrice() |
1275
|
|
|
{ |
1276
|
|
|
$activePriceOptions = $this->getActivePriceOptions(); |
1277
|
|
|
if (count($activePriceOptions) >= 1) { |
1278
|
|
|
// Sort active price options and return first element |
1279
|
|
|
return reset($activePriceOptions)->getPrice(); |
1280
|
|
|
} |
1281
|
|
|
// Just return the price field |
1282
|
|
|
return $this->price; |
1283
|
|
|
} |
1284
|
|
|
|
1285
|
|
|
/** |
1286
|
|
|
* Returns registrationWaitlist |
1287
|
|
|
* |
1288
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1289
|
|
|
*/ |
1290
|
|
|
public function getRegistrationWaitlist() |
1291
|
|
|
{ |
1292
|
|
|
return $this->registrationWaitlist; |
1293
|
|
|
} |
1294
|
|
|
|
1295
|
|
|
/** |
1296
|
|
|
* Sets registrationWaitlist |
1297
|
|
|
* |
1298
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration Registration |
1299
|
|
|
*/ |
1300
|
|
|
public function setRegistrationWaitlist(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registration) |
1301
|
|
|
{ |
1302
|
|
|
$this->registrationWaitlist = $registration; |
1303
|
|
|
} |
1304
|
|
|
|
1305
|
|
|
/** |
1306
|
|
|
* Adds a Registration to the waitlist |
1307
|
|
|
* |
1308
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration |
1309
|
|
|
*/ |
1310
|
|
|
public function addRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registration) |
1311
|
|
|
{ |
1312
|
|
|
$this->registrationWaitlist->attach($registration); |
1313
|
|
|
} |
1314
|
|
|
|
1315
|
|
|
/** |
1316
|
|
|
* Removes a Registration from the waitlist |
1317
|
|
|
* |
1318
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove Registration |
1319
|
|
|
*/ |
1320
|
|
|
public function removeRegistrationWaitlist(\DERHANSEN\SfEventMgt\Domain\Model\Registration $registrationToRemove) |
1321
|
|
|
{ |
1322
|
|
|
$this->registrationWaitlist->detach($registrationToRemove); |
1323
|
|
|
} |
1324
|
|
|
|
1325
|
|
|
/** |
1326
|
|
|
* Returns, if cancellation for registrations of the event is possible |
1327
|
|
|
* |
1328
|
|
|
* @return bool |
1329
|
|
|
*/ |
1330
|
|
|
public function getCancellationPossible() |
1331
|
|
|
{ |
1332
|
|
|
$today = new \DateTime('today'); |
1333
|
|
|
|
1334
|
|
|
return ($this->getEnableCancel() && $this->getCancelDeadline() > $today) || |
1335
|
|
|
($this->getEnableCancel() && $this->getCancelDeadline() === null && $this->getStartdate() > $today); |
1336
|
|
|
} |
1337
|
|
|
|
1338
|
|
|
/** |
1339
|
|
|
* Returns speaker |
1340
|
|
|
* |
1341
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1342
|
|
|
*/ |
1343
|
|
|
public function getSpeaker() |
1344
|
|
|
{ |
1345
|
|
|
return $this->speaker; |
1346
|
|
|
} |
1347
|
|
|
|
1348
|
|
|
/** |
1349
|
|
|
* Sets speaker |
1350
|
|
|
* |
1351
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $speaker |
1352
|
|
|
*/ |
1353
|
|
|
public function setSpeaker($speaker) |
1354
|
|
|
{ |
1355
|
|
|
$this->speaker = $speaker; |
1356
|
|
|
} |
1357
|
|
|
|
1358
|
|
|
/** |
1359
|
|
|
* Adds a speaker |
1360
|
|
|
* |
1361
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker |
1362
|
|
|
*/ |
1363
|
|
|
public function addSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker) |
1364
|
|
|
{ |
1365
|
|
|
$this->speaker->attach($speaker); |
1366
|
|
|
} |
1367
|
|
|
|
1368
|
|
|
/** |
1369
|
|
|
* Removes a speaker |
1370
|
|
|
* |
1371
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker |
1372
|
|
|
*/ |
1373
|
|
|
public function removeSpeaker(\DERHANSEN\SfEventMgt\Domain\Model\Speaker $speaker) |
1374
|
|
|
{ |
1375
|
|
|
$this->speaker->detach($speaker); |
1376
|
|
|
} |
1377
|
|
|
|
1378
|
|
|
/** |
1379
|
|
|
* Returns registrationFields |
1380
|
|
|
* |
1381
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1382
|
|
|
*/ |
1383
|
|
|
public function getRegistrationFields() |
1384
|
|
|
{ |
1385
|
|
|
return $this->registrationFields; |
1386
|
|
|
} |
1387
|
|
|
|
1388
|
|
|
/** |
1389
|
|
|
* Sets registrationWaitlist |
1390
|
|
|
* |
1391
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields |
1392
|
|
|
*/ |
1393
|
|
|
public function setRegistrationFields(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $registrationFields) |
1394
|
|
|
{ |
1395
|
|
|
$this->registrationFields = $registrationFields; |
1396
|
|
|
} |
1397
|
|
|
|
1398
|
|
|
/** |
1399
|
|
|
* Adds a registrationField |
1400
|
|
|
* |
1401
|
|
|
* @param Field $registrationField |
1402
|
|
|
*/ |
1403
|
|
|
public function addRegistrationFields(Field $registrationField) |
1404
|
|
|
{ |
1405
|
|
|
$this->registrationFields->attach($registrationField); |
1406
|
|
|
} |
1407
|
|
|
|
1408
|
|
|
/** |
1409
|
|
|
* Removed a registrationField |
1410
|
|
|
* |
1411
|
|
|
* @param Field $registrationField |
1412
|
|
|
*/ |
1413
|
|
|
public function removeRegistrationFields(Field $registrationField) |
1414
|
|
|
{ |
1415
|
|
|
$this->registrationFields->detach($registrationField); |
1416
|
|
|
} |
1417
|
|
|
|
1418
|
|
|
/** |
1419
|
|
|
* Returns an array with registration field uids |
1420
|
|
|
* |
1421
|
|
|
* @return array |
1422
|
|
|
*/ |
1423
|
|
|
public function getRegistrationFieldsUids() |
1424
|
|
|
{ |
1425
|
|
|
$result = []; |
1426
|
|
|
foreach ($this->registrationFields as $registrationField) { |
1427
|
|
|
$result[] = $registrationField->getUid(); |
1428
|
|
|
} |
1429
|
|
|
|
1430
|
|
|
return $result; |
1431
|
|
|
} |
1432
|
|
|
|
1433
|
|
|
/** |
1434
|
|
|
* Returns an array with registration field uids and titles |
1435
|
|
|
* [uid => title] |
1436
|
|
|
* |
1437
|
|
|
* @return array |
1438
|
|
|
*/ |
1439
|
|
|
public function getRegistrationFieldUidsWithTitle() |
1440
|
|
|
{ |
1441
|
|
|
$result = []; |
1442
|
|
|
foreach ($this->registrationFields as $registrationField) { |
1443
|
|
|
$result[$registrationField->getUid()] = $registrationField->getTitle(); |
1444
|
|
|
} |
1445
|
|
|
|
1446
|
|
|
return $result; |
1447
|
|
|
} |
1448
|
|
|
|
1449
|
|
|
/** |
1450
|
|
|
* Special getter to return the amount of registrations that are saved to default language |
1451
|
|
|
* Required since TYPO3 9.5 (#82363) |
1452
|
|
|
* |
1453
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1454
|
|
|
*/ |
1455
|
|
|
public function getRegistrations() |
1456
|
|
|
{ |
1457
|
|
|
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
1458
|
|
|
if ($languageAspect->getId() > 0) { |
1459
|
|
|
return $this->getRegistrationsDefaultLanguage(false); |
1460
|
|
|
} |
1461
|
|
|
|
1462
|
|
|
return $this->registration; |
1463
|
|
|
} |
1464
|
|
|
|
1465
|
|
|
/** |
1466
|
|
|
* Special getter to return the amount of waitlist registrations that are saved to default language |
1467
|
|
|
* Required since TYPO3 9.5 (#82363) |
1468
|
|
|
* |
1469
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
1470
|
|
|
*/ |
1471
|
|
|
public function getRegistrationsWaitlist() |
1472
|
|
|
{ |
1473
|
|
|
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language'); |
1474
|
|
|
if ($languageAspect->getId() > 0) { |
1475
|
|
|
return $this->getRegistrationsDefaultLanguage(true); |
1476
|
|
|
} |
1477
|
|
|
|
1478
|
|
|
return $this->registrationWaitlist; |
1479
|
|
|
} |
1480
|
|
|
|
1481
|
|
|
/** |
1482
|
|
|
* Returns an objectStorage object holding all registrations in the default language. |
1483
|
|
|
* Ensures expected behavior of getRegistration() and getRegistrationWaitlist() since TYPO3 issue #82363 |
1484
|
|
|
* |
1485
|
|
|
* @param bool $waitlist |
1486
|
|
|
* @return ObjectStorage |
1487
|
|
|
*/ |
1488
|
|
|
protected function getRegistrationsDefaultLanguage(bool $waitlist = false) |
1489
|
|
|
{ |
1490
|
|
|
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
1491
|
|
|
$result = $objectManager->get(ObjectStorage::class); |
1492
|
|
|
$registrationRepository = $objectManager->get(RegistrationRepository::class); |
1493
|
|
|
$registrations = $registrationRepository->findByEventAndWaitlist($this, $waitlist); |
1494
|
|
|
foreach ($registrations as $registration) { |
1495
|
|
|
$result->attach($registration); |
1496
|
|
|
} |
1497
|
|
|
|
1498
|
|
|
return $result; |
1499
|
|
|
} |
1500
|
|
|
|
1501
|
|
|
/** |
1502
|
|
|
* Returns if the event ends on the same day |
1503
|
|
|
* |
1504
|
|
|
* @return bool |
1505
|
|
|
*/ |
1506
|
|
|
public function getEndsSameDay(): bool |
1507
|
|
|
{ |
1508
|
|
|
if ($this->enddate !== null) { |
1509
|
|
|
return $this->startdate->format('d.m.Y') === $this->enddate->format('d.m.Y'); |
1510
|
|
|
} |
1511
|
|
|
|
1512
|
|
|
return true; |
1513
|
|
|
} |
1514
|
|
|
|
1515
|
|
|
/** |
1516
|
|
|
* Returns the challenge for the challenge/response spam check |
1517
|
|
|
* |
1518
|
|
|
* @return string |
1519
|
|
|
*/ |
1520
|
|
|
public function getSpamCheckChallenge(): string |
1521
|
|
|
{ |
1522
|
|
|
return MiscUtility::getSpamCheckChallenge($this->getUid()); |
1523
|
|
|
} |
1524
|
|
|
} |
1525
|
|
|
|