1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Configuration for time options. |
5
|
|
|
*/ |
6
|
|
|
declare(strict_types=1); |
7
|
|
|
|
8
|
|
|
namespace HDNET\Calendarize\Domain\Model; |
9
|
|
|
|
10
|
|
|
use HDNET\Calendarize\Utility\DateTimeUtility; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Configuration for time options. |
14
|
|
|
* |
15
|
|
|
* @db |
16
|
|
|
* @smartExclude Language |
17
|
|
|
*/ |
18
|
|
|
class Configuration extends AbstractModel implements ConfigurationInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Type. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
* @db |
25
|
|
|
*/ |
26
|
|
|
protected $type = self::TYPE_TIME; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Handling. |
30
|
|
|
* |
31
|
|
|
* @var string |
32
|
|
|
* @db |
33
|
|
|
*/ |
34
|
|
|
protected $handling = self::HANDLING_INCLUDE; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* State. |
38
|
|
|
* |
39
|
|
|
* @var string |
40
|
|
|
* @db |
41
|
|
|
*/ |
42
|
|
|
protected $state = self::STATE_DEFAULT; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Start date. |
46
|
|
|
* |
47
|
|
|
* @var \DateTime |
48
|
|
|
* @db |
49
|
|
|
*/ |
50
|
|
|
protected $startDate; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* End date. |
54
|
|
|
* |
55
|
|
|
* @var \DateTime |
56
|
|
|
* @db |
57
|
|
|
*/ |
58
|
|
|
protected $endDate; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* End date dynamic. |
62
|
|
|
* |
63
|
|
|
* @var string |
64
|
|
|
* @db |
65
|
|
|
*/ |
66
|
|
|
protected $endDateDynamic; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Start time. |
70
|
|
|
* |
71
|
|
|
* @var int |
72
|
|
|
* @db |
73
|
|
|
*/ |
74
|
|
|
protected $startTime; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* End time. |
78
|
|
|
* |
79
|
|
|
* @var int |
80
|
|
|
* @db |
81
|
|
|
*/ |
82
|
|
|
protected $endTime; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* AllDay. |
86
|
|
|
* |
87
|
|
|
* @var bool |
88
|
|
|
* @db |
89
|
|
|
*/ |
90
|
|
|
protected $allDay; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* OpenEndTime. |
94
|
|
|
* |
95
|
|
|
* @var bool |
96
|
|
|
* @db |
97
|
|
|
*/ |
98
|
|
|
protected $openEndTime; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* External ICS url. |
102
|
|
|
* |
103
|
|
|
* @var string |
104
|
|
|
* @db |
105
|
|
|
*/ |
106
|
|
|
protected $externalIcsUrl; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Groups. |
110
|
|
|
* |
111
|
|
|
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\HDNET\Calendarize\Domain\Model\ConfigurationGroup> |
112
|
|
|
* @db text |
113
|
|
|
* @lazy |
114
|
|
|
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy |
115
|
|
|
*/ |
116
|
|
|
protected $groups; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* Frequency. |
120
|
|
|
* |
121
|
|
|
* @var string |
122
|
|
|
* @db |
123
|
|
|
*/ |
124
|
|
|
protected $frequency = self::FREQUENCY_NONE; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Till date. |
128
|
|
|
* |
129
|
|
|
* @var \DateTime |
130
|
|
|
* @db |
131
|
|
|
*/ |
132
|
|
|
protected $tillDate; |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Till days. |
136
|
|
|
* |
137
|
|
|
* @var int |
138
|
|
|
* @db int(11) |
139
|
|
|
*/ |
140
|
|
|
protected $tillDays; |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Till days relative. |
144
|
|
|
* |
145
|
|
|
* @var bool |
146
|
|
|
* @db tinyint(4) unsigned |
147
|
|
|
*/ |
148
|
|
|
protected $tillDaysRelative; |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* Till days past. |
152
|
|
|
* |
153
|
|
|
* @var int |
154
|
|
|
* @db int(11) |
155
|
|
|
*/ |
156
|
|
|
protected $tillDaysPast; |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Counter amount. |
160
|
|
|
* |
161
|
|
|
* @var int |
162
|
|
|
* @db |
163
|
|
|
*/ |
164
|
|
|
protected $counterAmount; |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Counter interval. |
168
|
|
|
* |
169
|
|
|
* @var int |
170
|
|
|
* @db |
171
|
|
|
*/ |
172
|
|
|
protected $counterInterval; |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* Recurrence. |
176
|
|
|
* |
177
|
|
|
* @var string |
178
|
|
|
* @db |
179
|
|
|
*/ |
180
|
|
|
protected $recurrence = self::RECURRENCE_NONE; |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* Day property. |
184
|
|
|
* |
185
|
|
|
* @var string |
186
|
|
|
* @db |
187
|
|
|
*/ |
188
|
|
|
protected $day = self::DAY_NONE; |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Import ID if the item is based on an ICS structure. |
192
|
|
|
* |
193
|
|
|
* @var string |
194
|
|
|
* @db |
195
|
|
|
*/ |
196
|
|
|
protected $importId; |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Configuration constructor. |
200
|
|
|
*/ |
201
|
|
|
public function __construct() |
202
|
|
|
{ |
203
|
|
|
$this->groups = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Get type. |
208
|
|
|
* |
209
|
|
|
* @return string |
210
|
|
|
*/ |
211
|
|
|
public function getType() |
212
|
|
|
{ |
213
|
|
|
return $this->type; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Set type. |
218
|
|
|
* |
219
|
|
|
* @param string $type |
220
|
|
|
*/ |
221
|
|
|
public function setType($type) |
222
|
|
|
{ |
223
|
|
|
$this->type = $type; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Is all day. |
228
|
|
|
* |
229
|
|
|
* @return bool |
230
|
|
|
*/ |
231
|
|
|
public function isAllDay() |
232
|
|
|
{ |
233
|
|
|
return (bool) $this->allDay; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
/** |
237
|
|
|
* Set all day. |
238
|
|
|
* |
239
|
|
|
* @param bool $allDay |
240
|
|
|
*/ |
241
|
|
|
public function setAllDay($allDay) |
242
|
|
|
{ |
243
|
|
|
$this->allDay = (bool) $allDay; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* Get end date. |
248
|
|
|
* |
249
|
|
|
* @return \DateTime |
250
|
|
|
*/ |
251
|
|
|
public function getEndDate() |
252
|
|
|
{ |
253
|
|
|
if ($this->endDate instanceof \DateTime) { |
254
|
|
|
$this->endDate->setTimezone(DateTimeUtility::getTimeZone()); |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
return $this->endDate; |
258
|
|
|
} |
259
|
|
|
|
260
|
|
|
/** |
261
|
|
|
* Set end date. |
262
|
|
|
* |
263
|
|
|
* @param \DateTime $endDate |
264
|
|
|
*/ |
265
|
|
|
public function setEndDate($endDate) |
266
|
|
|
{ |
267
|
|
|
$this->endDate = $endDate; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* Get end date dynamic. |
272
|
|
|
* |
273
|
|
|
* @return string |
274
|
|
|
*/ |
275
|
|
|
public function getEndDateDynamic() |
276
|
|
|
{ |
277
|
|
|
return $this->endDateDynamic; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Set end date dynamic. |
282
|
|
|
* |
283
|
|
|
* @param string $endDateDynamic |
284
|
|
|
*/ |
285
|
|
|
public function setEndDateDynamic($endDateDynamic) |
286
|
|
|
{ |
287
|
|
|
$this->endDateDynamic = $endDateDynamic; |
288
|
|
|
} |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* Get end time. |
292
|
|
|
* |
293
|
|
|
* @return int |
294
|
|
|
*/ |
295
|
|
|
public function getEndTime() |
296
|
|
|
{ |
297
|
|
|
return $this->endTime; |
298
|
|
|
} |
299
|
|
|
|
300
|
|
|
/** |
301
|
|
|
* Set end time. |
302
|
|
|
* |
303
|
|
|
* @param int $endTime |
304
|
|
|
*/ |
305
|
|
|
public function setEndTime($endTime) |
306
|
|
|
{ |
307
|
|
|
$this->endTime = $endTime; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* Get start date. |
312
|
|
|
* |
313
|
|
|
* @return \DateTime |
314
|
|
|
*/ |
315
|
|
|
public function getStartDate() |
316
|
|
|
{ |
317
|
|
|
if ($this->startDate instanceof \DateTime) { |
318
|
|
|
$this->startDate->setTimezone(DateTimeUtility::getTimeZone()); |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
return $this->startDate; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Set start date. |
326
|
|
|
* |
327
|
|
|
* @param \DateTime $startDate |
328
|
|
|
*/ |
329
|
|
|
public function setStartDate($startDate) |
330
|
|
|
{ |
331
|
|
|
$this->startDate = $startDate; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* Get start time. |
336
|
|
|
* |
337
|
|
|
* @return int |
338
|
|
|
*/ |
339
|
|
|
public function getStartTime() |
340
|
|
|
{ |
341
|
|
|
return $this->startTime; |
342
|
|
|
} |
343
|
|
|
|
344
|
|
|
/** |
345
|
|
|
* Set start time. |
346
|
|
|
* |
347
|
|
|
* @param int $startTime |
348
|
|
|
*/ |
349
|
|
|
public function setStartTime($startTime) |
350
|
|
|
{ |
351
|
|
|
$this->startTime = $startTime; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* Get groups. |
356
|
|
|
* |
357
|
|
|
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage |
358
|
|
|
*/ |
359
|
|
|
public function getGroups() |
360
|
|
|
{ |
361
|
|
|
if (null === $this->groups) { |
362
|
|
|
return new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
return $this->groups; |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* Set groups. |
370
|
|
|
* |
371
|
|
|
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $groups |
372
|
|
|
*/ |
373
|
|
|
public function setGroups($groups) |
374
|
|
|
{ |
375
|
|
|
$this->groups = $groups; |
376
|
|
|
} |
377
|
|
|
|
378
|
|
|
/** |
379
|
|
|
* Get frequency. |
380
|
|
|
* |
381
|
|
|
* @return string |
382
|
|
|
*/ |
383
|
|
|
public function getFrequency() |
384
|
|
|
{ |
385
|
|
|
return $this->frequency; |
386
|
|
|
} |
387
|
|
|
|
388
|
|
|
/** |
389
|
|
|
* Set frequency. |
390
|
|
|
* |
391
|
|
|
* @param string $frequency |
392
|
|
|
*/ |
393
|
|
|
public function setFrequency($frequency) |
394
|
|
|
{ |
395
|
|
|
$this->frequency = $frequency; |
396
|
|
|
} |
397
|
|
|
|
398
|
|
|
/** |
399
|
|
|
* Get till date. |
400
|
|
|
* |
401
|
|
|
* @return \DateTime |
402
|
|
|
*/ |
403
|
|
|
public function getTillDate() |
404
|
|
|
{ |
405
|
|
|
return $this->tillDate; |
406
|
|
|
} |
407
|
|
|
|
408
|
|
|
/** |
409
|
|
|
* Set till date. |
410
|
|
|
* |
411
|
|
|
* @param \DateTime $tillDate |
412
|
|
|
*/ |
413
|
|
|
public function setTillDate($tillDate) |
414
|
|
|
{ |
415
|
|
|
$this->tillDate = $tillDate; |
416
|
|
|
} |
417
|
|
|
|
418
|
|
|
/** |
419
|
|
|
* Get till days. |
420
|
|
|
* |
421
|
|
|
* @return int |
422
|
|
|
*/ |
423
|
|
|
public function getTillDays() |
424
|
|
|
{ |
425
|
|
|
return $this->tillDays; |
426
|
|
|
} |
427
|
|
|
|
428
|
|
|
/** |
429
|
|
|
* Set till days. |
430
|
|
|
* |
431
|
|
|
* @param int $tillDays |
432
|
|
|
*/ |
433
|
|
|
public function setTillDays(int $tillDays) |
434
|
|
|
{ |
435
|
|
|
$this->tillDays = $tillDays; |
436
|
|
|
} |
437
|
|
|
|
438
|
|
|
/** |
439
|
|
|
* Is till days relative. |
440
|
|
|
* |
441
|
|
|
* @return bool |
442
|
|
|
*/ |
443
|
|
|
public function isTillDaysRelative() |
444
|
|
|
{ |
445
|
|
|
return $this->tillDaysRelative; |
446
|
|
|
} |
447
|
|
|
|
448
|
|
|
/** |
449
|
|
|
* Set till days relative. |
450
|
|
|
* |
451
|
|
|
* @param bool $tillDaysRelative |
452
|
|
|
*/ |
453
|
|
|
public function setTillDaysRelative(bool $tillDaysRelative) |
454
|
|
|
{ |
455
|
|
|
$this->tillDaysRelative = $tillDaysRelative; |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* Get till days past. |
460
|
|
|
* |
461
|
|
|
* @return int |
462
|
|
|
*/ |
463
|
|
|
public function getTillDaysPast() |
464
|
|
|
{ |
465
|
|
|
return $this->tillDaysPast; |
466
|
|
|
} |
467
|
|
|
|
468
|
|
|
/** |
469
|
|
|
* Set till days past. |
470
|
|
|
* |
471
|
|
|
* @param int $tillDaysPast |
472
|
|
|
*/ |
473
|
|
|
public function setTillDaysPast(int $tillDaysPast) |
474
|
|
|
{ |
475
|
|
|
$this->tillDaysPast = $tillDaysPast; |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
/** |
479
|
|
|
* Get counter amount. |
480
|
|
|
* |
481
|
|
|
* @return int |
482
|
|
|
*/ |
483
|
|
|
public function getCounterAmount() |
484
|
|
|
{ |
485
|
|
|
return $this->counterAmount; |
486
|
|
|
} |
487
|
|
|
|
488
|
|
|
/** |
489
|
|
|
* Set counter amount. |
490
|
|
|
* |
491
|
|
|
* @param int $counterAmount |
492
|
|
|
*/ |
493
|
|
|
public function setCounterAmount($counterAmount) |
494
|
|
|
{ |
495
|
|
|
$this->counterAmount = $counterAmount; |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
/** |
499
|
|
|
* Get counter interval. |
500
|
|
|
* |
501
|
|
|
* @return int |
502
|
|
|
*/ |
503
|
|
|
public function getCounterInterval() |
504
|
|
|
{ |
505
|
|
|
return $this->counterInterval; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* Set counter interval. |
510
|
|
|
* |
511
|
|
|
* @param int $counterInterval |
512
|
|
|
*/ |
513
|
|
|
public function setCounterInterval($counterInterval) |
514
|
|
|
{ |
515
|
|
|
$this->counterInterval = $counterInterval; |
516
|
|
|
} |
517
|
|
|
|
518
|
|
|
/** |
519
|
|
|
* Get external ICS URL. |
520
|
|
|
* |
521
|
|
|
* @return string |
522
|
|
|
*/ |
523
|
|
|
public function getExternalIcsUrl() |
524
|
|
|
{ |
525
|
|
|
return $this->externalIcsUrl; |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
/** |
529
|
|
|
* Set external ICS URL. |
530
|
|
|
* |
531
|
|
|
* @param string $externalIcsUrl |
532
|
|
|
*/ |
533
|
|
|
public function setExternalIcsUrl($externalIcsUrl) |
534
|
|
|
{ |
535
|
|
|
$this->externalIcsUrl = $externalIcsUrl; |
536
|
|
|
} |
537
|
|
|
|
538
|
|
|
/** |
539
|
|
|
* Get day. |
540
|
|
|
* |
541
|
|
|
* @return string |
542
|
|
|
*/ |
543
|
|
|
public function getDay() |
544
|
|
|
{ |
545
|
|
|
return $this->day; |
546
|
|
|
} |
547
|
|
|
|
548
|
|
|
/** |
549
|
|
|
* Set day. |
550
|
|
|
* |
551
|
|
|
* @param string $day |
552
|
|
|
*/ |
553
|
|
|
public function setDay($day) |
554
|
|
|
{ |
555
|
|
|
$this->day = $day; |
556
|
|
|
} |
557
|
|
|
|
558
|
|
|
/** |
559
|
|
|
* Get recurrence. |
560
|
|
|
* |
561
|
|
|
* @return string |
562
|
|
|
*/ |
563
|
|
|
public function getRecurrence() |
564
|
|
|
{ |
565
|
|
|
return $this->recurrence; |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
/** |
569
|
|
|
* Set recurrence. |
570
|
|
|
* |
571
|
|
|
* @param string $recurrence |
572
|
|
|
*/ |
573
|
|
|
public function setRecurrence($recurrence) |
574
|
|
|
{ |
575
|
|
|
$this->recurrence = $recurrence; |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
/** |
579
|
|
|
* Get handling. |
580
|
|
|
* |
581
|
|
|
* @return string |
582
|
|
|
*/ |
583
|
|
|
public function getHandling() |
584
|
|
|
{ |
585
|
|
|
return $this->handling; |
586
|
|
|
} |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* Set handling. |
590
|
|
|
* |
591
|
|
|
* @param string $handling |
592
|
|
|
*/ |
593
|
|
|
public function setHandling($handling) |
594
|
|
|
{ |
595
|
|
|
$this->handling = $handling; |
596
|
|
|
} |
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* Get state. |
600
|
|
|
* |
601
|
|
|
* @return string |
602
|
|
|
*/ |
603
|
|
|
public function getState() |
604
|
|
|
{ |
605
|
|
|
return \trim($this->state); |
606
|
|
|
} |
607
|
|
|
|
608
|
|
|
/** |
609
|
|
|
* Set state. |
610
|
|
|
* |
611
|
|
|
* @param string $state |
612
|
|
|
*/ |
613
|
|
|
public function setState($state) |
614
|
|
|
{ |
615
|
|
|
$this->state = $state; |
616
|
|
|
} |
617
|
|
|
|
618
|
|
|
/** |
619
|
|
|
* @return bool |
620
|
|
|
*/ |
621
|
|
|
public function isOpenEndTime() |
622
|
|
|
{ |
623
|
|
|
return (bool) $this->openEndTime; |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
/** |
627
|
|
|
* @param bool $openEndTime |
628
|
|
|
*/ |
629
|
|
|
public function setOpenEndTime(bool $openEndTime) |
630
|
|
|
{ |
631
|
|
|
$this->openEndTime = $openEndTime; |
632
|
|
|
} |
633
|
|
|
} |
634
|
|
|
|