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\Controller; |
13
|
|
|
|
14
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Dto\CustomNotification; |
15
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand; |
16
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Dto\SearchDemand; |
17
|
|
|
use DERHANSEN\SfEventMgt\Domain\Model\Event; |
18
|
|
|
use DERHANSEN\SfEventMgt\Domain\Repository\CustomNotificationLogRepository; |
19
|
|
|
use DERHANSEN\SfEventMgt\Event\InitAdministrationModuleTemplateEvent; |
|
|
|
|
20
|
|
|
use DERHANSEN\SfEventMgt\Event\ModifyAdministrationIndexNotifyViewVariablesEvent; |
21
|
|
|
use DERHANSEN\SfEventMgt\Event\ModifyAdministrationListViewVariablesEvent; |
22
|
|
|
use DERHANSEN\SfEventMgt\Service\BeUserSessionService; |
23
|
|
|
use DERHANSEN\SfEventMgt\Service\ExportService; |
24
|
|
|
use DERHANSEN\SfEventMgt\Service\MaintenanceService; |
25
|
|
|
use DERHANSEN\SfEventMgt\Service\SettingsService; |
26
|
|
|
use DERHANSEN\SfEventMgt\Utility\PageUtility; |
27
|
|
|
use Psr\Http\Message\ResponseInterface; |
28
|
|
|
use TYPO3\CMS\Backend\Routing\UriBuilder; |
|
|
|
|
29
|
|
|
use TYPO3\CMS\Backend\Template\Components\ButtonBar; |
|
|
|
|
30
|
|
|
use TYPO3\CMS\Backend\Template\ModuleTemplate; |
|
|
|
|
31
|
|
|
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; |
|
|
|
|
32
|
|
|
use TYPO3\CMS\Backend\Utility\BackendUtility; |
|
|
|
|
33
|
|
|
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; |
34
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
35
|
|
|
use TYPO3\CMS\Core\Imaging\IconSize; |
36
|
|
|
use TYPO3\CMS\Core\Localization\LanguageService; |
37
|
|
|
use TYPO3\CMS\Core\Page\PageRenderer; |
38
|
|
|
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; |
39
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
40
|
|
|
|
41
|
|
|
class AdministrationController extends AbstractController |
42
|
|
|
{ |
43
|
|
|
private const LANG_FILE = 'LLL:EXT:sf_event_mgt/Resources/Private/Language/locallang_be.xlf:'; |
44
|
|
|
|
45
|
|
|
protected ModuleTemplateFactory $moduleTemplateFactory; |
46
|
|
|
protected CustomNotificationLogRepository $customNotificationLogRepository; |
47
|
|
|
protected ExportService $exportService; |
48
|
|
|
protected SettingsService $settingsService; |
49
|
|
|
protected BeUserSessionService $beUserSessionService; |
50
|
|
|
protected MaintenanceService $maintenanceService; |
51
|
|
|
protected IconFactory $iconFactory; |
52
|
|
|
protected PageRenderer $pageRenderer; |
53
|
|
|
protected int $pid = 0; |
54
|
|
|
|
55
|
|
|
public function injectCustomNotificationLogRepository( |
56
|
|
|
CustomNotificationLogRepository $customNotificationLogRepository |
57
|
|
|
): void { |
58
|
|
|
$this->customNotificationLogRepository = $customNotificationLogRepository; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function injectExportService(ExportService $exportService): void |
62
|
|
|
{ |
63
|
|
|
$this->exportService = $exportService; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function injectSettingsService(SettingsService $settingsService): void |
67
|
|
|
{ |
68
|
|
|
$this->settingsService = $settingsService; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function injectBeUserSessionService(BeUserSessionService $beUserSessionService): void |
72
|
|
|
{ |
73
|
|
|
$this->beUserSessionService = $beUserSessionService; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function injectIconFactory(IconFactory $iconFactory): void |
77
|
|
|
{ |
78
|
|
|
$this->iconFactory = $iconFactory; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function injectMaintenanceService(MaintenanceService $maintenanceService): void |
82
|
|
|
{ |
83
|
|
|
$this->maintenanceService = $maintenanceService; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function injectModuleTemplateFactory(ModuleTemplateFactory $moduleTemplateFactory): void |
87
|
|
|
{ |
88
|
|
|
$this->moduleTemplateFactory = $moduleTemplateFactory; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function injectPageRenderer(PageRenderer $pageRenderer): void |
92
|
|
|
{ |
93
|
|
|
$this->pageRenderer = $pageRenderer; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Register docHeaderButtons |
98
|
|
|
*/ |
99
|
|
|
protected function registerDocHeaderButtons(ModuleTemplate $moduleTemplate): void |
100
|
|
|
{ |
101
|
|
|
$buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar(); |
102
|
|
|
|
103
|
|
|
if ($this->request->getControllerActionName() === 'list') { |
104
|
|
|
$buttons = [ |
105
|
|
|
[ |
106
|
|
|
'label' => 'administration.newEvent', |
107
|
|
|
'link' => $this->getCreateNewRecordUri('tx_sfeventmgt_domain_model_event'), |
108
|
|
|
'icon' => 'ext-sfeventmgt-event', |
109
|
|
|
'group' => 1, |
110
|
|
|
], |
111
|
|
|
[ |
112
|
|
|
'label' => 'administration.newLocation', |
113
|
|
|
'link' => $this->getCreateNewRecordUri('tx_sfeventmgt_domain_model_location'), |
114
|
|
|
'icon' => 'ext-sfeventmgt-location', |
115
|
|
|
'group' => 1, |
116
|
|
|
], |
117
|
|
|
[ |
118
|
|
|
'label' => 'administration.newOrganisator', |
119
|
|
|
'link' => $this->getCreateNewRecordUri('tx_sfeventmgt_domain_model_organisator'), |
120
|
|
|
'icon' => 'ext-sfeventmgt-organisator', |
121
|
|
|
'group' => 1, |
122
|
|
|
], |
123
|
|
|
[ |
124
|
|
|
'label' => 'administration.newSpeaker', |
125
|
|
|
'link' => $this->getCreateNewRecordUri('tx_sfeventmgt_domain_model_speaker'), |
126
|
|
|
'icon' => 'ext-sfeventmgt-speaker', |
127
|
|
|
'group' => 1, |
128
|
|
|
], |
129
|
|
|
[ |
130
|
|
|
'label' => 'administration.handleExpiredRegistrations', |
131
|
|
|
'link' => $this->uriBuilder->reset()->setRequest($this->request) |
132
|
|
|
->uriFor('handleExpiredRegistrations', [], 'Administration'), |
133
|
|
|
'icon' => 'ext-sfeventmgt-action-handle-expired', |
134
|
|
|
'group' => 2, |
135
|
|
|
], |
136
|
|
|
]; |
137
|
|
|
foreach ($buttons as $tableConfiguration) { |
138
|
|
|
$title = $this->getLanguageService()->sL(self::LANG_FILE . $tableConfiguration['label']); |
139
|
|
|
$icon = $this->iconFactory->getIcon($tableConfiguration['icon'], IconSize::SMALL); |
140
|
|
|
$viewButton = $buttonBar->makeLinkButton() |
141
|
|
|
->setHref($tableConfiguration['link']) |
142
|
|
|
->setDataAttributes([ |
143
|
|
|
'toggle' => 'tooltip', |
144
|
|
|
'placement' => 'bottom', |
145
|
|
|
'title' => $title, |
146
|
|
|
]) |
147
|
|
|
->setTitle($title) |
148
|
|
|
->setIcon($icon); |
149
|
|
|
$buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, $tableConfiguration['group']); |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Returns the create new record URL for the given table |
156
|
|
|
*/ |
157
|
|
|
private function getCreateNewRecordUri(string $table): string |
158
|
|
|
{ |
159
|
|
|
$pid = $this->pid; |
160
|
|
|
$tsConfig = BackendUtility::getPagesTSconfig(0); |
161
|
|
|
if ($pid === 0 && isset($tsConfig['defaultPid.']) |
162
|
|
|
&& is_array($tsConfig['defaultPid.']) |
163
|
|
|
&& isset($tsConfig['defaultPid.'][$table]) |
164
|
|
|
) { |
165
|
|
|
$pid = (int)$tsConfig['defaultPid.'][$table]; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
169
|
|
|
|
170
|
|
|
return (string)$uriBuilder->buildUriFromRoute('record_edit', [ |
171
|
|
|
'edit[' . $table . '][' . $pid . ']' => 'new', |
172
|
|
|
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'), |
173
|
|
|
]); |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Initializes module template and returns a response which must be used as response for any extbase action |
178
|
|
|
* that should render a view. |
179
|
|
|
*/ |
180
|
|
|
protected function initModuleTemplateAndReturnResponse(string $templateFileName, array $variables = []): ResponseInterface |
181
|
|
|
{ |
182
|
|
|
$moduleTemplate = $this->moduleTemplateFactory->create($this->request); |
183
|
|
|
$this->pageRenderer->addCssFile('EXT:sf_event_mgt/Resources/Public/Css/administration.css'); |
184
|
|
|
|
185
|
|
|
$this->pageRenderer->loadJavaScriptModule('@derhansen/sf_event_mgt/administration-module.js'); |
186
|
|
|
|
187
|
|
|
$this->registerDocHeaderButtons($moduleTemplate); |
188
|
|
|
|
189
|
|
|
$moduleTemplate->setFlashMessageQueue($this->getFlashMessageQueue()); |
190
|
|
|
|
191
|
|
|
$initAdministrationModuleTemplateEvent = new InitAdministrationModuleTemplateEvent( |
192
|
|
|
$moduleTemplate, |
193
|
|
|
$this->uriBuilder, |
194
|
|
|
$this, |
195
|
|
|
$this->request |
196
|
|
|
); |
197
|
|
|
$this->eventDispatcher->dispatch($initAdministrationModuleTemplateEvent); |
198
|
|
|
|
199
|
|
|
$variables['settings'] = $this->settings; |
200
|
|
|
$moduleTemplate->assignMultiple($variables); |
201
|
|
|
|
202
|
|
|
return $moduleTemplate->renderResponse($templateFileName); |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function initializeAction(): void |
206
|
|
|
{ |
207
|
|
|
$this->pid = (int)($this->request->getQueryParams()['id'] ?? 0); |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Set date format for fields startDate and endDate |
212
|
|
|
*/ |
213
|
|
|
public function initializeListAction(): void |
214
|
|
|
{ |
215
|
|
|
// Static format needed for date picker (flatpickr), see BackendController::generateJavascript() and #91606 |
216
|
|
|
if (!empty($this->settings)) { |
217
|
|
|
$this->settings['search']['dateFormat'] = 'H:i d-m-Y'; |
|
|
|
|
218
|
|
|
} |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* List action for backend module |
223
|
|
|
*/ |
224
|
|
|
public function listAction(?SearchDemand $searchDemand = null, array $overwriteDemand = []): ResponseInterface |
225
|
|
|
{ |
226
|
|
|
if (empty($this->settings)) { |
227
|
|
|
return $this->redirect('settingsError'); |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
if ($searchDemand !== null) { |
231
|
|
|
$searchDemand->setFields($this->settings['search']['fields'] ?? 'title'); |
232
|
|
|
|
233
|
|
|
$sessionData = []; |
234
|
|
|
$sessionData['searchDemand'] = $searchDemand->toArray(); |
235
|
|
|
$sessionData['overwriteDemand'] = $overwriteDemand; |
236
|
|
|
$this->beUserSessionService->saveSessionData($sessionData); |
237
|
|
|
} else { |
238
|
|
|
// Try to restore search demand from Session |
239
|
|
|
$sessionSearchDemand = $this->beUserSessionService->getSessionDataByKey('searchDemand') ?? []; |
240
|
|
|
$searchDemand = SearchDemand::fromArray($sessionSearchDemand); |
241
|
|
|
$overwriteDemand = $this->beUserSessionService->getSessionDataByKey('overwriteDemand'); |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
if ($this->isResetFilter()) { |
245
|
|
|
$searchDemand = GeneralUtility::makeInstance(SearchDemand::class); |
246
|
|
|
$overwriteDemand = []; |
247
|
|
|
|
248
|
|
|
$sessionData = []; |
249
|
|
|
$sessionData['searchDemand'] = $searchDemand->toArray(); |
250
|
|
|
$sessionData['overwriteDemand'] = $overwriteDemand; |
251
|
|
|
$this->beUserSessionService->saveSessionData($sessionData); |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
// Initialize default ordering when no overwriteDemand is available |
255
|
|
|
if (empty($overwriteDemand)) { |
256
|
|
|
$overwriteDemand = [ |
257
|
|
|
'orderField' => $this->settings['defaultSorting']['orderField'] ?? 'title', |
258
|
|
|
'orderDirection' => $this->settings['defaultSorting']['orderDirection'] ?? 'asc', |
259
|
|
|
]; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
$events = []; |
263
|
|
|
$pagination = null; |
264
|
|
|
$pageUids = $this->resolveSearchPageUids((int)($overwriteDemand['recursive'] ?? 0)); |
265
|
|
|
if ($pageUids !== '' && |
266
|
|
|
$this->getBackendUser()->check('tables_select', 'tx_sfeventmgt_domain_model_event') |
267
|
|
|
) { |
268
|
|
|
$eventDemand = GeneralUtility::makeInstance(EventDemand::class); |
269
|
|
|
$eventDemand = $this->overwriteEventDemandObject($eventDemand, $overwriteDemand); |
|
|
|
|
270
|
|
|
$eventDemand->setOrderFieldAllowed($this->settings['orderFieldAllowed'] ?? ''); |
271
|
|
|
$eventDemand->setSearchDemand($searchDemand); |
272
|
|
|
$eventDemand->setIgnoreEnableFields(true); |
273
|
|
|
$eventDemand->setStoragePage($pageUids); |
274
|
|
|
|
275
|
|
|
$events = $this->eventRepository->findDemanded($eventDemand); |
276
|
|
|
$pagination = $this->getPagination($events, $this->settings['pagination'] ?? []); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
$modifyAdministrationListViewVariablesEvent = new ModifyAdministrationListViewVariablesEvent( |
280
|
|
|
[ |
281
|
|
|
'pid' => $this->pid, |
282
|
|
|
'events' => $events, |
283
|
|
|
'searchDemand' => $searchDemand, |
284
|
|
|
'orderByFields' => $this->getOrderByFields(), |
285
|
|
|
'orderDirections' => $this->getOrderDirections(), |
286
|
|
|
'recursiveLevels' => $this->getRecursiveLevels(), |
287
|
|
|
'overwriteDemand' => $overwriteDemand, |
288
|
|
|
'pagination' => $pagination, |
289
|
|
|
], |
290
|
|
|
$this, |
291
|
|
|
$this->request |
292
|
|
|
); |
293
|
|
|
$this->eventDispatcher->dispatch($modifyAdministrationListViewVariablesEvent); |
294
|
|
|
$variables = $modifyAdministrationListViewVariablesEvent->getVariables(); |
295
|
|
|
|
296
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/List', $variables); |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Resolves the page UIDs to search in respecting the given recursive option and additionally checking, if |
301
|
|
|
* the current backend user is allowed to affected pages |
302
|
|
|
*/ |
303
|
|
|
private function resolveSearchPageUids(int $recursive): string |
304
|
|
|
{ |
305
|
|
|
$extendedPageUids = PageUtility::extendPidListByChildren( |
306
|
|
|
(string)$this->pid, |
307
|
|
|
$recursive |
308
|
|
|
); |
309
|
|
|
$extendedPageUids = GeneralUtility::intExplode(',', $extendedPageUids, true); |
310
|
|
|
|
311
|
|
|
$pageUids = []; |
312
|
|
|
foreach ($extendedPageUids as $extendedPageUid) { |
313
|
|
|
if (!in_array($extendedPageUid, $pageUids, true) && |
314
|
|
|
$this->getBackendUser()->isInWebMount($extendedPageUid) |
|
|
|
|
315
|
|
|
) { |
316
|
|
|
$pageUids[] = $extendedPageUid; |
317
|
|
|
} |
318
|
|
|
} |
319
|
|
|
|
320
|
|
|
return implode(',', $pageUids); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Returns, if reset filter operation has been used |
325
|
|
|
*/ |
326
|
|
|
private function isResetFilter(): bool |
327
|
|
|
{ |
328
|
|
|
$resetFilter = false; |
329
|
|
|
if ($this->request->hasArgument('operation')) { |
330
|
|
|
$resetFilter = $this->request->getArgument('operation') === 'reset-filters'; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
return $resetFilter; |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
/** |
337
|
|
|
* Export registrations for a given event |
338
|
|
|
*/ |
339
|
|
|
public function exportAction(int $eventUid): void |
340
|
|
|
{ |
341
|
|
|
/** @var Event $event */ |
342
|
|
|
$event = $this->eventRepository->findByUidIncludeHidden($eventUid); |
343
|
|
|
if ($event !== null && $this->checkEventAccess($event)) { |
344
|
|
|
$this->exportService->downloadRegistrationsCsv($eventUid, $this->settings['csvExport'] ?? []); |
345
|
|
|
} |
346
|
|
|
exit(); |
|
|
|
|
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* Handles expired registrations |
351
|
|
|
*/ |
352
|
|
|
public function handleExpiredRegistrationsAction(): ResponseInterface |
353
|
|
|
{ |
354
|
|
|
$delete = (bool)($this->settings['registration']['deleteExpiredRegistrations'] ?? false); |
355
|
|
|
$this->maintenanceService->handleExpiredRegistrations($delete); |
356
|
|
|
|
357
|
|
|
$this->addFlashMessage( |
358
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-1.content'), |
359
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-1.title') |
360
|
|
|
); |
361
|
|
|
|
362
|
|
|
return $this->redirect('list'); |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* The index notify action |
367
|
|
|
*/ |
368
|
|
|
public function indexNotifyAction(Event $event): ResponseInterface |
369
|
|
|
{ |
370
|
|
|
if (!$this->checkEventAccess($event)) { |
371
|
|
|
return $this->redirect('list'); |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
$customNotification = GeneralUtility::makeInstance(CustomNotification::class); |
375
|
|
|
$customNotifications = $this->settingsService->getCustomNotifications($this->settings); |
376
|
|
|
$logEntries = $this->customNotificationLogRepository->findBy(['event' => $event]); |
377
|
|
|
|
378
|
|
|
$modifyAdministrationIndexNotifyViewVariablesEvent = new ModifyAdministrationIndexNotifyViewVariablesEvent( |
379
|
|
|
[ |
380
|
|
|
'event' => $event, |
381
|
|
|
'recipients' => $this->getNotificationRecipients(), |
382
|
|
|
'customNotification' => $customNotification, |
383
|
|
|
'customNotifications' => $customNotifications, |
384
|
|
|
'logEntries' => $logEntries, |
385
|
|
|
], |
386
|
|
|
$this, |
387
|
|
|
$this->request |
388
|
|
|
); |
389
|
|
|
$this->eventDispatcher->dispatch($modifyAdministrationIndexNotifyViewVariablesEvent); |
390
|
|
|
$variables = $modifyAdministrationIndexNotifyViewVariablesEvent->getVariables(); |
391
|
|
|
|
392
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/IndexNotify', $variables); |
393
|
|
|
} |
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* Returns an array of recipient option for the indexNotify action |
397
|
|
|
*/ |
398
|
|
|
public function getNotificationRecipients(): array |
399
|
|
|
{ |
400
|
|
|
return [ |
401
|
|
|
[ |
402
|
|
|
'value' => CustomNotification::RECIPIENTS_ALL, |
403
|
|
|
'label' => $this->getLanguageService()->sL( |
404
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_ALL |
405
|
|
|
), |
406
|
|
|
], |
407
|
|
|
[ |
408
|
|
|
'value' => CustomNotification::RECIPIENTS_CONFIRMED, |
409
|
|
|
'label' => $this->getLanguageService()->sL( |
410
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_CONFIRMED |
411
|
|
|
), |
412
|
|
|
], |
413
|
|
|
[ |
414
|
|
|
'value' => CustomNotification::RECIPIENTS_UNCONFIRMED, |
415
|
|
|
'label' => $this->getLanguageService()->sL( |
416
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_UNCONFIRMED |
417
|
|
|
), |
418
|
|
|
], |
419
|
|
|
[ |
420
|
|
|
'value' => CustomNotification::RECIPIENTS_WAITLIST_CONFIRMED, |
421
|
|
|
'label' => $this->getLanguageService()->sL( |
422
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_WAITLIST_CONFIRMED |
423
|
|
|
), |
424
|
|
|
], |
425
|
|
|
[ |
426
|
|
|
'value' => CustomNotification::RECIPIENTS_WAITLIST_UNCONFIRMED, |
427
|
|
|
'label' => $this->getLanguageService()->sL( |
428
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_WAITLIST_UNCONFIRMED |
429
|
|
|
), |
430
|
|
|
], |
431
|
|
|
]; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* Notify action |
436
|
|
|
*/ |
437
|
|
|
public function notifyAction(Event $event, CustomNotification $customNotification): ResponseInterface |
438
|
|
|
{ |
439
|
|
|
if (!$this->checkEventAccess($event)) { |
440
|
|
|
return $this->redirect('list'); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
$customNotifications = $this->settingsService->getCustomNotifications($this->settings); |
444
|
|
|
$result = $this->notificationService->sendCustomNotification( |
445
|
|
|
$this->request, |
446
|
|
|
$event, |
447
|
|
|
$customNotification, |
448
|
|
|
$this->settings |
449
|
|
|
); |
450
|
|
|
$this->notificationService->createCustomNotificationLogentry( |
451
|
|
|
$event, |
452
|
|
|
$customNotifications[$customNotification->getTemplate()], |
453
|
|
|
$result, |
454
|
|
|
$customNotification |
455
|
|
|
); |
456
|
|
|
$this->addFlashMessage( |
457
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-2.content'), |
458
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-2.title') |
459
|
|
|
); |
460
|
|
|
return $this->redirect('list'); |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* Checks if the current backend user has access to the PID of the event and if not, enqueue an |
465
|
|
|
* access denied flash message |
466
|
|
|
*/ |
467
|
|
|
public function checkEventAccess(Event $event): bool |
468
|
|
|
{ |
469
|
|
|
if ($this->getBackendUser()->isInWebMount($event->getPid()) === null) { |
470
|
|
|
$this->addFlashMessage( |
471
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.accessdenied.content'), |
472
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.accessdenied.title'), |
473
|
|
|
ContextualFeedbackSeverity::ERROR |
474
|
|
|
); |
475
|
|
|
return false; |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
return true; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* Shows the settings error view |
483
|
|
|
*/ |
484
|
|
|
public function settingsErrorAction(): ResponseInterface |
485
|
|
|
{ |
486
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/SettingsError'); |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* Suppress default validation messages |
491
|
|
|
*/ |
492
|
|
|
protected function getErrorFlashMessage(): bool |
493
|
|
|
{ |
494
|
|
|
return false; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* Returns an array with possible order directions |
499
|
|
|
*/ |
500
|
|
|
public function getOrderDirections(): array |
501
|
|
|
{ |
502
|
|
|
return [ |
503
|
|
|
'asc' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.sortOrder.asc'), |
504
|
|
|
'desc' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.sortOrder.desc'), |
505
|
|
|
]; |
506
|
|
|
} |
507
|
|
|
|
508
|
|
|
/** |
509
|
|
|
* Returns an array with possible recursive levels |
510
|
|
|
*/ |
511
|
|
|
public function getRecursiveLevels(): array |
512
|
|
|
{ |
513
|
|
|
return [ |
514
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.current'), |
515
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level1'), |
516
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level2'), |
517
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level3'), |
518
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level4'), |
519
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level5'), |
520
|
|
|
]; |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
/** |
524
|
|
|
* Returns an array with possible orderBy fields |
525
|
|
|
*/ |
526
|
|
|
public function getOrderByFields(): array |
527
|
|
|
{ |
528
|
|
|
return [ |
529
|
|
|
'title' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.title'), |
530
|
|
|
'startdate' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.startdate'), |
531
|
|
|
'enddate' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.enddate'), |
532
|
|
|
]; |
533
|
|
|
} |
534
|
|
|
|
535
|
|
|
protected function getLanguageService(): LanguageService |
536
|
|
|
{ |
537
|
|
|
return $GLOBALS['LANG']; |
538
|
|
|
} |
539
|
|
|
|
540
|
|
|
protected function getBackendUser(): BackendUserAuthentication |
541
|
|
|
{ |
542
|
|
|
return $GLOBALS['BE_USER']; |
543
|
|
|
} |
544
|
|
|
} |
545
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths