|
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\Dto; |
|
13
|
|
|
|
|
14
|
|
|
use DateTime; |
|
15
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\FrontendUser; |
|
16
|
|
|
use DERHANSEN\SfEventMgt\Utility\PageUtility; |
|
17
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
18
|
|
|
|
|
19
|
|
|
class UserRegistrationDemand |
|
20
|
|
|
{ |
|
21
|
|
|
protected string $displayMode = 'all'; |
|
22
|
|
|
protected string $storagePage = ''; |
|
23
|
|
|
protected string $orderField = ''; |
|
24
|
|
|
protected string $orderDirection = ''; |
|
25
|
|
|
protected ?DateTime $currentDateTime = null; |
|
26
|
|
|
protected ?FrontendUser $user = null; |
|
27
|
|
|
|
|
28
|
|
|
public function getDisplayMode(): string |
|
29
|
|
|
{ |
|
30
|
|
|
return $this->displayMode; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function setDisplayMode(string $displayMode): void |
|
34
|
|
|
{ |
|
35
|
|
|
$this->displayMode = $displayMode; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getStoragePage(): string |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->storagePage; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function setStoragePage(string $storagePage): void |
|
44
|
|
|
{ |
|
45
|
|
|
$this->storagePage = $storagePage; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getOrderField(): string |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->orderField; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function setOrderField(string $orderField): void |
|
54
|
|
|
{ |
|
55
|
|
|
$this->orderField = $orderField; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getOrderDirection(): string |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->orderDirection; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function setOrderDirection(string $orderDirection): void |
|
64
|
|
|
{ |
|
65
|
|
|
$this->orderDirection = $orderDirection; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setCurrentDateTime(DateTime $currentDateTime): void |
|
69
|
|
|
{ |
|
70
|
|
|
$this->currentDateTime = $currentDateTime; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getCurrentDateTime(): DateTime |
|
74
|
|
|
{ |
|
75
|
|
|
if ($this->currentDateTime != null) { |
|
76
|
|
|
return $this->currentDateTime; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
return new DateTime(); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
public function getUser(): ?FrontendUser |
|
83
|
|
|
{ |
|
84
|
|
|
return $this->user; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
public function setUser(?FrontendUser $user): void |
|
88
|
|
|
{ |
|
89
|
|
|
$this->user = $user; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* Creates a new UserRegistrationDemand object from the given settings. Respects recursive setting for storage page |
|
94
|
|
|
* and extends all PIDs to children if set. |
|
95
|
|
|
* |
|
96
|
|
|
* @param array $settings |
|
97
|
|
|
* @return UserRegistrationDemand |
|
98
|
|
|
*/ |
|
99
|
|
|
public static function createFromSettings(array $settings = []): self |
|
100
|
|
|
{ |
|
101
|
|
|
$demand = GeneralUtility::makeInstance(UserRegistrationDemand::class); |
|
102
|
|
|
$demand->setDisplayMode($settings['userRegistration']['displayMode'] ?? 'all'); |
|
103
|
|
|
$demand->setStoragePage( |
|
104
|
|
|
PageUtility::extendPidListByChildren( |
|
105
|
|
|
(string)($settings['userRegistration']['storagePage'] ?? ''), |
|
106
|
|
|
(int)($settings['userRegistration']['recursive'] ?? 0) |
|
107
|
|
|
) |
|
108
|
|
|
); |
|
109
|
|
|
$demand->setOrderField($settings['userRegistration']['orderField'] ?? ''); |
|
110
|
|
|
$demand->setOrderDirection($settings['userRegistration']['orderDirection'] ?? ''); |
|
111
|
|
|
|
|
112
|
|
|
return $demand; |
|
113
|
|
|
} |
|
114
|
|
|
} |
|
115
|
|
|
|