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
|
|
|
* Properties in this array will be ignored by overwriteDemandObject() |
22
|
|
|
* |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
protected $ignoredSettingsForOverwriteDemand = ['storagepage', 'orderfieldallowed']; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* EventRepository |
29
|
|
|
* |
30
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\EventRepository |
31
|
|
|
*/ |
32
|
|
|
protected $eventRepository = null; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Registration repository |
36
|
|
|
* |
37
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository |
38
|
|
|
*/ |
39
|
|
|
protected $registrationRepository = null; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Category repository |
43
|
|
|
* |
44
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository |
45
|
|
|
*/ |
46
|
|
|
protected $categoryRepository = null; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Location repository |
50
|
|
|
* |
51
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository |
52
|
|
|
*/ |
53
|
|
|
protected $locationRepository = null; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Organisator repository |
57
|
|
|
* |
58
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository |
59
|
|
|
*/ |
60
|
|
|
protected $organisatorRepository = null; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Speaker repository |
64
|
|
|
* |
65
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\SpeakerRepository |
66
|
|
|
*/ |
67
|
|
|
protected $speakerRepository = null; |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* Notification Service |
71
|
|
|
* |
72
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\NotificationService |
73
|
|
|
*/ |
74
|
|
|
protected $notificationService = null; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* ICalendar Service |
78
|
|
|
* |
79
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\ICalendarService |
80
|
|
|
*/ |
81
|
|
|
protected $icalendarService = null; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Hash Service |
85
|
|
|
* |
86
|
|
|
* @var \TYPO3\CMS\Extbase\Security\Cryptography\HashService |
87
|
|
|
*/ |
88
|
|
|
protected $hashService; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* RegistrationService |
92
|
|
|
* |
93
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\RegistrationService |
94
|
|
|
*/ |
95
|
|
|
protected $registrationService = null; |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* CalendarService |
99
|
|
|
* |
100
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\CalendarService |
101
|
|
|
*/ |
102
|
|
|
protected $calendarService = null; |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* PaymentMethodService |
106
|
|
|
* |
107
|
|
|
* @var \DERHANSEN\SfEventMgt\Service\PaymentService |
108
|
|
|
*/ |
109
|
|
|
protected $paymentService = null; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* FieldRepository |
113
|
|
|
* |
114
|
|
|
* @var \DERHANSEN\SfEventMgt\Domain\Repository\Registration\FieldRepository |
115
|
|
|
*/ |
116
|
|
|
protected $fieldRepository = null; |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* DI for $calendarService |
120
|
|
|
* |
121
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\CalendarService $calendarService |
122
|
|
|
*/ |
123
|
|
|
public function injectCalendarService(\DERHANSEN\SfEventMgt\Service\CalendarService $calendarService) |
124
|
|
|
{ |
125
|
|
|
$this->calendarService = $calendarService; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* DI for $categoryRepository |
130
|
|
|
* |
131
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository $categoryRepository |
132
|
|
|
*/ |
133
|
|
|
public function injectCategoryRepository( |
134
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\CategoryRepository $categoryRepository |
135
|
|
|
) { |
136
|
|
|
$this->categoryRepository = $categoryRepository; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* DI for $eventRepository |
141
|
|
|
* |
142
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\EventRepository $eventRepository |
143
|
|
|
*/ |
144
|
|
|
public function injectEventRepository(\DERHANSEN\SfEventMgt\Domain\Repository\EventRepository $eventRepository) |
145
|
|
|
{ |
146
|
|
|
$this->eventRepository = $eventRepository; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* DI for $hashService |
151
|
|
|
* |
152
|
|
|
* @param \TYPO3\CMS\Extbase\Security\Cryptography\HashService $hashService |
153
|
|
|
*/ |
154
|
|
|
public function injectHashService(\TYPO3\CMS\Extbase\Security\Cryptography\HashService $hashService) |
155
|
|
|
{ |
156
|
|
|
$this->hashService = $hashService; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* DI for $icalendarService |
161
|
|
|
* |
162
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\ICalendarService $icalendarService |
163
|
|
|
*/ |
164
|
|
|
public function injectIcalendarService(\DERHANSEN\SfEventMgt\Service\ICalendarService $icalendarService) |
165
|
|
|
{ |
166
|
|
|
$this->icalendarService = $icalendarService; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* DI for $locationRepository |
171
|
|
|
* |
172
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository $locationRepository |
173
|
|
|
*/ |
174
|
|
|
public function injectLocationRepository( |
175
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\LocationRepository $locationRepository |
176
|
|
|
) { |
177
|
|
|
$this->locationRepository = $locationRepository; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* DI for $notificationService |
182
|
|
|
* |
183
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\NotificationService $notificationService |
184
|
|
|
*/ |
185
|
|
|
public function injectNotificationService(\DERHANSEN\SfEventMgt\Service\NotificationService $notificationService) |
186
|
|
|
{ |
187
|
|
|
$this->notificationService = $notificationService; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* DI for $organisatorRepository |
192
|
|
|
* |
193
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository $organisatorRepository |
194
|
|
|
*/ |
195
|
|
|
public function injectOrganisatorRepository( |
196
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\OrganisatorRepository $organisatorRepository |
197
|
|
|
) { |
198
|
|
|
$this->organisatorRepository = $organisatorRepository; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* DI for $speakerRepository |
203
|
|
|
* |
204
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\SpeakerRepository $speakerRepository |
205
|
|
|
*/ |
206
|
|
|
public function injectSpeakerRepository( |
207
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\SpeakerRepository $speakerRepository |
208
|
|
|
) { |
209
|
|
|
$this->speakerRepository = $speakerRepository; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* DI for $paymentService |
214
|
|
|
* |
215
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\PaymentService $paymentService |
216
|
|
|
*/ |
217
|
|
|
public function injectPaymentService(\DERHANSEN\SfEventMgt\Service\PaymentService $paymentService) |
218
|
|
|
{ |
219
|
|
|
$this->paymentService = $paymentService; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* DI for $registrationRepository |
224
|
|
|
* |
225
|
|
|
* @param \DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository $registrationRepository |
226
|
|
|
*/ |
227
|
|
|
public function injectRegistrationRepository( |
228
|
|
|
\DERHANSEN\SfEventMgt\Domain\Repository\RegistrationRepository $registrationRepository |
229
|
|
|
) { |
230
|
|
|
$this->registrationRepository = $registrationRepository; |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* DI for $registrationService |
235
|
|
|
* |
236
|
|
|
* @param \DERHANSEN\SfEventMgt\Service\RegistrationService $registrationService |
237
|
|
|
*/ |
238
|
|
|
public function injectRegistrationService(\DERHANSEN\SfEventMgt\Service\RegistrationService $registrationService) |
239
|
|
|
{ |
240
|
|
|
$this->registrationService = $registrationService; |
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
|
|
|
|