1
|
|
|
<?php |
2
|
|
|
namespace DERHANSEN\SfEventMgt\Controller; |
3
|
|
|
|
4
|
|
|
/* |
5
|
|
|
* This file is part of the Extension "sf_event_mgt" for TYPO3 CMS. |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please read the |
8
|
|
|
* LICENSE.txt file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* EventController |
15
|
|
|
* |
16
|
|
|
* @author Torben Hansen <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController |
19
|
|
|
{ |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Properties in this array will be ignored by overwriteDemandObject() |
23
|
|
|
* |
24
|
|
|
* @var array |
25
|
|
|
*/ |
26
|
|
|
protected $ignoredSettingsForOverwriteDemand = ['storagepage', 'orderfieldallowed']; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* EventRepository |
30
|
|
|
* |
31
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\EventRepository |
32
|
|
|
*/ |
33
|
|
|
protected $eventRepository = null; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Registration repository |
37
|
|
|
* |
38
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository |
39
|
|
|
*/ |
40
|
|
|
protected $registrationRepository = null; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Category repository |
44
|
|
|
* |
45
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository |
46
|
|
|
*/ |
47
|
|
|
protected $categoryRepository = null; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Location repository |
51
|
|
|
* |
52
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository |
53
|
|
|
*/ |
54
|
|
|
protected $locationRepository = null; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Organisator repository |
58
|
|
|
* |
59
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository |
60
|
|
|
*/ |
61
|
|
|
protected $organisatorRepository = null; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Notification Service |
65
|
|
|
* |
66
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\NotificationService |
67
|
|
|
*/ |
68
|
|
|
protected $notificationService = null; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* ICalendar Service |
72
|
|
|
* |
73
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\ICalendarService |
74
|
|
|
*/ |
75
|
|
|
protected $icalendarService = null; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Hash Service |
79
|
|
|
* |
80
|
|
|
* @var \TYPO3\CMS\Extbase\Security\Cryptography\HashService |
81
|
|
|
*/ |
82
|
|
|
protected $hashService; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* RegistrationService |
86
|
|
|
* |
87
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\RegistrationService |
88
|
|
|
*/ |
89
|
|
|
protected $registrationService = null; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* CalendarService |
93
|
|
|
* |
94
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\CalendarService |
95
|
|
|
*/ |
96
|
|
|
protected $calendarService = null; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* UtilityService |
100
|
|
|
* |
101
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\UtilityService |
102
|
|
|
*/ |
103
|
|
|
protected $utilityService = null; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* PaymentMethodService |
107
|
|
|
* |
108
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\PaymentService |
109
|
|
|
*/ |
110
|
|
|
protected $paymentService = null; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* FieldRepository |
114
|
|
|
* |
115
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\Registration\FieldRepository |
116
|
|
|
*/ |
117
|
|
|
protected $fieldRepository = null; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* DI for $calendarService |
121
|
|
|
* |
122
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\CalendarService $calendarService |
123
|
|
|
*/ |
124
|
|
|
public function injectCalendarService(\DERHANSEN\SfEventMgt\Service\CalendarService $calendarService) |
125
|
|
|
{ |
126
|
|
|
$this->calendarService = $calendarService; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* DI for $categoryRepository |
131
|
|
|
* |
132
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository $categoryRepository |
133
|
|
|
*/ |
134
|
|
|
public function injectCategoryRepository( |
135
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository $categoryRepository |
136
|
|
|
) { |
137
|
|
|
$this->categoryRepository = $categoryRepository; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* DI for $eventRepository |
142
|
|
|
* |
143
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\EventRepository $eventRepository |
144
|
|
|
*/ |
145
|
|
|
public function injectEventRepository(\DERHANSEN\SfEventMgt\Domain\Repository\EventRepository $eventRepository) |
146
|
|
|
{ |
147
|
|
|
$this->eventRepository = $eventRepository; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* DI for $hashService |
152
|
|
|
* |
153
|
|
|
* @param \TYPO3\CMS\Extbase\Security\Cryptography\HashService $hashService |
154
|
|
|
*/ |
155
|
|
|
public function injectHashService(\TYPO3\CMS\Extbase\Security\Cryptography\HashService $hashService) |
156
|
|
|
{ |
157
|
|
|
$this->hashService = $hashService; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* DI for $icalendarService |
162
|
|
|
* |
163
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\ICalendarService $icalendarService |
164
|
|
|
*/ |
165
|
|
|
public function injectIcalendarService(\DERHANSEN\SfEventMgt\Service\ICalendarService $icalendarService) |
166
|
|
|
{ |
167
|
|
|
$this->icalendarService = $icalendarService; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* DI for $locationRepository |
172
|
|
|
* |
173
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository $locationRepository |
174
|
|
|
*/ |
175
|
|
|
public function injectLocationRepository( |
176
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository $locationRepository |
177
|
|
|
) { |
178
|
|
|
$this->locationRepository = $locationRepository; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* DI for $notificationService |
183
|
|
|
* |
184
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\NotificationService $notificationService |
185
|
|
|
*/ |
186
|
|
|
public function injectNotificationService(\DERHANSEN\SfEventMgt\Service\NotificationService $notificationService) |
187
|
|
|
{ |
188
|
|
|
$this->notificationService = $notificationService; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* DI for $organisatorRepository |
193
|
|
|
* |
194
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository $organisatorRepository |
195
|
|
|
*/ |
196
|
|
|
public function injectOrganisatorRepository( |
197
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository $organisatorRepository |
198
|
|
|
) { |
199
|
|
|
$this->organisatorRepository = $organisatorRepository; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* DI for $paymentService |
204
|
|
|
* |
205
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\PaymentService $paymentService |
206
|
|
|
*/ |
207
|
|
|
public function injectPaymentService(\DERHANSEN\SfEventMgt\Service\PaymentService $paymentService) |
208
|
|
|
{ |
209
|
|
|
$this->paymentService = $paymentService; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* DI for $registrationRepository |
214
|
|
|
* |
215
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository $registrationRepository |
216
|
|
|
*/ |
217
|
|
|
public function injectRegistrationRepository( |
218
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository $registrationRepository |
219
|
|
|
) { |
220
|
|
|
$this->registrationRepository = $registrationRepository; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* DI for $registrationService |
225
|
|
|
* |
226
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\RegistrationService $registrationService |
227
|
|
|
*/ |
228
|
|
|
public function injectRegistrationService(\DERHANSEN\SfEventMgt\Service\RegistrationService $registrationService) |
229
|
|
|
{ |
230
|
|
|
$this->registrationService = $registrationService; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* DI for $utilityService |
235
|
|
|
* |
236
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\UtilityService $utilityService |
237
|
|
|
*/ |
238
|
|
|
public function injectUtilityService(\DERHANSEN\SfEventMgt\Service\UtilityService $utilityService) |
239
|
|
|
{ |
240
|
|
|
$this->utilityService = $utilityService; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* DI for $fieldRepository |
245
|
|
|
* |
246
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\Registration\FieldRepository $fieldRepository |
247
|
|
|
*/ |
248
|
|
|
public function injectFieldRepository( |
249
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\Registration\FieldRepository $fieldRepository |
250
|
|
|
) { |
251
|
|
|
$this->fieldRepository = $fieldRepository; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Dispatches the signal with the given name |
256
|
|
|
* |
257
|
|
|
* @param string $signalClassName |
258
|
|
|
* @param string $signalName |
259
|
|
|
* @param array $arguments |
260
|
|
|
* @return mixed |
261
|
|
|
*/ |
262
|
|
|
protected function signalDispatch($signalClassName, $signalName, array $arguments) |
263
|
|
|
{ |
264
|
|
|
return $this->signalSlotDispatcher->dispatch($signalClassName, $signalName, $arguments); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController |
269
|
|
|
*/ |
270
|
|
|
protected function getTypoScriptFrontendController() |
271
|
|
|
{ |
272
|
|
|
return $GLOBALS['TSFE'] ?: null; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* Overwrites a given demand object by an propertyName => $propertyValue array |
277
|
|
|
* |
278
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand $demand Demand |
279
|
|
|
* @param array $overwriteDemand OwerwriteDemand |
280
|
|
|
* |
281
|
|
|
* @return \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand |
282
|
|
|
*/ |
283
|
|
|
protected function overwriteEventDemandObject(EventDemand $demand, array $overwriteDemand) |
284
|
|
|
{ |
285
|
|
|
foreach ($this->ignoredSettingsForOverwriteDemand as $property) { |
286
|
|
|
unset($overwriteDemand[$property]); |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
foreach ($overwriteDemand as $propertyName => $propertyValue) { |
290
|
|
|
if (in_array(strtolower($propertyName), $this->ignoredSettingsForOverwriteDemand, true)) { |
291
|
|
|
continue; |
292
|
|
|
} |
293
|
|
|
\TYPO3\CMS\Extbase\Reflection\ObjectAccess::setProperty($demand, $propertyName, $propertyValue); |
294
|
|
|
} |
295
|
|
|
|
296
|
|
|
return $demand; |
297
|
|
|
} |
298
|
|
|
} |
299
|
|
|
|