|
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\Icon; |
|
35
|
|
|
use TYPO3\CMS\Core\Imaging\IconFactory; |
|
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
|
|
|
if ($this->isButtonDisabledBySetting($tableConfiguration['label'])) { |
|
139
|
|
|
continue; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
$title = $this->getLanguageService()->sL(self::LANG_FILE . $tableConfiguration['label']); |
|
143
|
|
|
$icon = $this->iconFactory->getIcon($tableConfiguration['icon'], Icon::SIZE_SMALL); |
|
144
|
|
|
$viewButton = $buttonBar->makeLinkButton() |
|
145
|
|
|
->setHref($tableConfiguration['link']) |
|
146
|
|
|
->setDataAttributes([ |
|
147
|
|
|
'toggle' => 'tooltip', |
|
148
|
|
|
'placement' => 'bottom', |
|
149
|
|
|
'title' => $title, |
|
150
|
|
|
]) |
|
151
|
|
|
->setTitle($title) |
|
152
|
|
|
->setIcon($icon); |
|
153
|
|
|
$buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, $tableConfiguration['group']); |
|
154
|
|
|
} |
|
155
|
|
|
} |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* Returns, if the given button is disabled by the setting |
|
160
|
|
|
*/ |
|
161
|
|
|
private function isButtonDisabledBySetting(string $buttonLabel): bool |
|
162
|
|
|
{ |
|
163
|
|
|
$disabledButtons = $this->settings['disableButtons'] ?? []; |
|
164
|
|
|
$buttonIdentifier = str_replace('administration.', '', $buttonLabel); |
|
165
|
|
|
return isset($disabledButtons[$buttonIdentifier]) && (int)($disabledButtons[$buttonIdentifier]) === 1; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* Returns the create new record URL for the given table |
|
170
|
|
|
*/ |
|
171
|
|
|
private function getCreateNewRecordUri(string $table): string |
|
172
|
|
|
{ |
|
173
|
|
|
$pid = $this->pid; |
|
174
|
|
|
$tsConfig = BackendUtility::getPagesTSconfig(0); |
|
175
|
|
|
if ($pid === 0 && isset($tsConfig['defaultPid.']) |
|
176
|
|
|
&& is_array($tsConfig['defaultPid.']) |
|
177
|
|
|
&& isset($tsConfig['defaultPid.'][$table]) |
|
178
|
|
|
) { |
|
179
|
|
|
$pid = (int)$tsConfig['defaultPid.'][$table]; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
|
183
|
|
|
|
|
184
|
|
|
return (string)$uriBuilder->buildUriFromRoute('record_edit', [ |
|
185
|
|
|
'edit[' . $table . '][' . $pid . ']' => 'new', |
|
186
|
|
|
'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'), |
|
187
|
|
|
]); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* Initializes module template and returns a response which must be used as response for any extbase action |
|
192
|
|
|
* that should render a view. |
|
193
|
|
|
*/ |
|
194
|
|
|
protected function initModuleTemplateAndReturnResponse(string $templateFileName, array $variables = []): ResponseInterface |
|
195
|
|
|
{ |
|
196
|
|
|
$moduleTemplate = $this->moduleTemplateFactory->create($this->request); |
|
197
|
|
|
$this->pageRenderer->addCssFile('EXT:sf_event_mgt/Resources/Public/Css/administration.css'); |
|
198
|
|
|
|
|
199
|
|
|
$this->pageRenderer->loadJavaScriptModule('@derhansen/sf_event_mgt/administration-module.js'); |
|
200
|
|
|
|
|
201
|
|
|
$this->registerDocHeaderButtons($moduleTemplate); |
|
202
|
|
|
|
|
203
|
|
|
$moduleTemplate->setFlashMessageQueue($this->getFlashMessageQueue()); |
|
204
|
|
|
|
|
205
|
|
|
$initAdministrationModuleTemplateEvent = new InitAdministrationModuleTemplateEvent( |
|
206
|
|
|
$moduleTemplate, |
|
207
|
|
|
$this->uriBuilder, |
|
208
|
|
|
$this |
|
209
|
|
|
); |
|
210
|
|
|
$this->eventDispatcher->dispatch($initAdministrationModuleTemplateEvent); |
|
211
|
|
|
|
|
212
|
|
|
$variables['settings'] = $this->settings; |
|
213
|
|
|
$moduleTemplate->assignMultiple($variables); |
|
214
|
|
|
|
|
215
|
|
|
return $moduleTemplate->renderResponse($templateFileName); |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
public function initializeAction(): void |
|
219
|
|
|
{ |
|
220
|
|
|
$this->pid = (int)($this->request->getQueryParams()['id'] ?? 0); |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* Set date format for fields startDate and endDate |
|
225
|
|
|
*/ |
|
226
|
|
|
public function initializeListAction(): void |
|
227
|
|
|
{ |
|
228
|
|
|
// Static format needed for date picker (flatpickr), see BackendController::generateJavascript() and #91606 |
|
229
|
|
|
if (!empty($this->settings)) { |
|
230
|
|
|
$this->settings['search']['dateFormat'] = 'H:i d-m-Y'; |
|
|
|
|
|
|
231
|
|
|
} |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
/** |
|
235
|
|
|
* List action for backend module |
|
236
|
|
|
*/ |
|
237
|
|
|
public function listAction(?SearchDemand $searchDemand = null, array $overwriteDemand = []): ResponseInterface |
|
238
|
|
|
{ |
|
239
|
|
|
if (empty($this->settings)) { |
|
240
|
|
|
return $this->redirect('settingsError'); |
|
241
|
|
|
} |
|
242
|
|
|
|
|
243
|
|
|
if ($searchDemand !== null) { |
|
244
|
|
|
$searchDemand->setFields($this->settings['search']['fields'] ?? 'title'); |
|
245
|
|
|
|
|
246
|
|
|
$sessionData = []; |
|
247
|
|
|
$sessionData['searchDemand'] = $searchDemand->toArray(); |
|
248
|
|
|
$sessionData['overwriteDemand'] = $overwriteDemand; |
|
249
|
|
|
$this->beUserSessionService->saveSessionData($sessionData); |
|
250
|
|
|
} else { |
|
251
|
|
|
// Try to restore search demand from Session |
|
252
|
|
|
$sessionSearchDemand = $this->beUserSessionService->getSessionDataByKey('searchDemand') ?? []; |
|
253
|
|
|
$searchDemand = SearchDemand::fromArray($sessionSearchDemand); |
|
254
|
|
|
$overwriteDemand = $this->beUserSessionService->getSessionDataByKey('overwriteDemand'); |
|
255
|
|
|
} |
|
256
|
|
|
|
|
257
|
|
|
if ($this->isResetFilter()) { |
|
258
|
|
|
$searchDemand = GeneralUtility::makeInstance(SearchDemand::class); |
|
259
|
|
|
$overwriteDemand = []; |
|
260
|
|
|
|
|
261
|
|
|
$sessionData = []; |
|
262
|
|
|
$sessionData['searchDemand'] = $searchDemand->toArray(); |
|
263
|
|
|
$sessionData['overwriteDemand'] = $overwriteDemand; |
|
264
|
|
|
$this->beUserSessionService->saveSessionData($sessionData); |
|
265
|
|
|
} |
|
266
|
|
|
|
|
267
|
|
|
// Initialize default ordering when no overwriteDemand is available |
|
268
|
|
|
if (empty($overwriteDemand)) { |
|
269
|
|
|
$overwriteDemand = [ |
|
270
|
|
|
'orderField' => $this->settings['defaultSorting']['orderField'] ?? 'title', |
|
271
|
|
|
'orderDirection' => $this->settings['defaultSorting']['orderDirection'] ?? 'asc', |
|
272
|
|
|
]; |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
$events = []; |
|
276
|
|
|
$pagination = null; |
|
277
|
|
|
$pageUids = $this->resolveSearchPageUids((int)($overwriteDemand['recursive'] ?? 0)); |
|
278
|
|
|
if ($pageUids !== '' && |
|
279
|
|
|
$this->getBackendUser()->check('tables_select', 'tx_sfeventmgt_domain_model_event') |
|
280
|
|
|
) { |
|
281
|
|
|
$eventDemand = GeneralUtility::makeInstance(EventDemand::class); |
|
282
|
|
|
$eventDemand = $this->overwriteEventDemandObject($eventDemand, $overwriteDemand); |
|
|
|
|
|
|
283
|
|
|
$eventDemand->setOrderFieldAllowed($this->settings['orderFieldAllowed'] ?? ''); |
|
284
|
|
|
$eventDemand->setSearchDemand($searchDemand); |
|
285
|
|
|
$eventDemand->setIgnoreEnableFields(true); |
|
286
|
|
|
$eventDemand->setStoragePage($pageUids); |
|
287
|
|
|
|
|
288
|
|
|
$events = $this->eventRepository->findDemanded($eventDemand); |
|
289
|
|
|
$pagination = $this->getPagination($events, $this->settings['pagination'] ?? []); |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
$modifyAdministrationListViewVariablesEvent = new ModifyAdministrationListViewVariablesEvent( |
|
293
|
|
|
[ |
|
294
|
|
|
'pid' => $this->pid, |
|
295
|
|
|
'events' => $events, |
|
296
|
|
|
'searchDemand' => $searchDemand, |
|
297
|
|
|
'orderByFields' => $this->getOrderByFields(), |
|
298
|
|
|
'orderDirections' => $this->getOrderDirections(), |
|
299
|
|
|
'recursiveLevels' => $this->getRecursiveLevels(), |
|
300
|
|
|
'overwriteDemand' => $overwriteDemand, |
|
301
|
|
|
'pagination' => $pagination, |
|
302
|
|
|
], |
|
303
|
|
|
$this |
|
304
|
|
|
); |
|
305
|
|
|
$this->eventDispatcher->dispatch($modifyAdministrationListViewVariablesEvent); |
|
306
|
|
|
$variables = $modifyAdministrationListViewVariablesEvent->getVariables(); |
|
307
|
|
|
|
|
308
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/List', $variables); |
|
309
|
|
|
} |
|
310
|
|
|
|
|
311
|
|
|
/** |
|
312
|
|
|
* Resolves the page UIDs to search in respecting the given recursive option and additionally checking, if |
|
313
|
|
|
* the current backend user is allowed to affected pages |
|
314
|
|
|
*/ |
|
315
|
|
|
private function resolveSearchPageUids(int $recursive): string |
|
316
|
|
|
{ |
|
317
|
|
|
$extendedPageUids = PageUtility::extendPidListByChildren( |
|
318
|
|
|
(string)$this->pid, |
|
319
|
|
|
$recursive |
|
320
|
|
|
); |
|
321
|
|
|
$extendedPageUids = GeneralUtility::intExplode(',', $extendedPageUids, true); |
|
|
|
|
|
|
322
|
|
|
|
|
323
|
|
|
$pageUids = []; |
|
324
|
|
|
foreach ($extendedPageUids as $extendedPageUid) { |
|
325
|
|
|
if (!in_array($extendedPageUid, $pageUids, true) && |
|
326
|
|
|
$this->getBackendUser()->isInWebMount($extendedPageUid) |
|
|
|
|
|
|
327
|
|
|
) { |
|
328
|
|
|
$pageUids[] = $extendedPageUid; |
|
329
|
|
|
} |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
return implode(',', $pageUids); |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* Returns, if reset filter operation has been used |
|
337
|
|
|
*/ |
|
338
|
|
|
private function isResetFilter(): bool |
|
339
|
|
|
{ |
|
340
|
|
|
$resetFilter = false; |
|
341
|
|
|
if ($this->request->hasArgument('operation')) { |
|
342
|
|
|
$resetFilter = $this->request->getArgument('operation') === 'reset-filters'; |
|
343
|
|
|
} |
|
344
|
|
|
|
|
345
|
|
|
return $resetFilter; |
|
346
|
|
|
} |
|
347
|
|
|
|
|
348
|
|
|
/** |
|
349
|
|
|
* Export registrations for a given event |
|
350
|
|
|
*/ |
|
351
|
|
|
public function exportAction(int $eventUid): void |
|
352
|
|
|
{ |
|
353
|
|
|
/** @var Event $event */ |
|
354
|
|
|
$event = $this->eventRepository->findByUidIncludeHidden($eventUid); |
|
355
|
|
|
if ($event !== null && $this->checkEventAccess($event)) { |
|
356
|
|
|
$this->exportService->downloadRegistrationsCsv($eventUid, $this->settings['csvExport'] ?? []); |
|
357
|
|
|
} |
|
358
|
|
|
exit(); |
|
|
|
|
|
|
359
|
|
|
} |
|
360
|
|
|
|
|
361
|
|
|
/** |
|
362
|
|
|
* Handles expired registrations |
|
363
|
|
|
*/ |
|
364
|
|
|
public function handleExpiredRegistrationsAction(): ResponseInterface |
|
365
|
|
|
{ |
|
366
|
|
|
$delete = (bool)($this->settings['registration']['deleteExpiredRegistrations'] ?? false); |
|
367
|
|
|
$this->maintenanceService->handleExpiredRegistrations($delete); |
|
368
|
|
|
|
|
369
|
|
|
$this->addFlashMessage( |
|
370
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-1.content'), |
|
371
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-1.title') |
|
372
|
|
|
); |
|
373
|
|
|
|
|
374
|
|
|
return $this->redirect('list'); |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
/** |
|
378
|
|
|
* The index notify action |
|
379
|
|
|
*/ |
|
380
|
|
|
public function indexNotifyAction(Event $event): ResponseInterface |
|
381
|
|
|
{ |
|
382
|
|
|
if (!$this->checkEventAccess($event)) { |
|
383
|
|
|
return $this->redirect('list'); |
|
384
|
|
|
} |
|
385
|
|
|
|
|
386
|
|
|
$customNotification = GeneralUtility::makeInstance(CustomNotification::class); |
|
387
|
|
|
$customNotifications = $this->settingsService->getCustomNotifications($this->settings); |
|
388
|
|
|
$logEntries = $this->customNotificationLogRepository->findBy(['event' => $event]); |
|
389
|
|
|
|
|
390
|
|
|
$modifyAdministrationIndexNotifyViewVariablesEvent = new ModifyAdministrationIndexNotifyViewVariablesEvent( |
|
391
|
|
|
[ |
|
392
|
|
|
'event' => $event, |
|
393
|
|
|
'recipients' => $this->getNotificationRecipients(), |
|
394
|
|
|
'customNotification' => $customNotification, |
|
395
|
|
|
'customNotifications' => $customNotifications, |
|
396
|
|
|
'logEntries' => $logEntries, |
|
397
|
|
|
], |
|
398
|
|
|
$this |
|
399
|
|
|
); |
|
400
|
|
|
$this->eventDispatcher->dispatch($modifyAdministrationIndexNotifyViewVariablesEvent); |
|
401
|
|
|
$variables = $modifyAdministrationIndexNotifyViewVariablesEvent->getVariables(); |
|
402
|
|
|
|
|
403
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/IndexNotify', $variables); |
|
404
|
|
|
} |
|
405
|
|
|
|
|
406
|
|
|
/** |
|
407
|
|
|
* Returns an array of recipient option for the indexNotify action |
|
408
|
|
|
*/ |
|
409
|
|
|
public function getNotificationRecipients(): array |
|
410
|
|
|
{ |
|
411
|
|
|
return [ |
|
412
|
|
|
[ |
|
413
|
|
|
'value' => CustomNotification::RECIPIENTS_ALL, |
|
414
|
|
|
'label' => $this->getLanguageService()->sL( |
|
415
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_ALL |
|
416
|
|
|
), |
|
417
|
|
|
], |
|
418
|
|
|
[ |
|
419
|
|
|
'value' => CustomNotification::RECIPIENTS_CONFIRMED, |
|
420
|
|
|
'label' => $this->getLanguageService()->sL( |
|
421
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_CONFIRMED |
|
422
|
|
|
), |
|
423
|
|
|
], |
|
424
|
|
|
[ |
|
425
|
|
|
'value' => CustomNotification::RECIPIENTS_UNCONFIRMED, |
|
426
|
|
|
'label' => $this->getLanguageService()->sL( |
|
427
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_UNCONFIRMED |
|
428
|
|
|
), |
|
429
|
|
|
], |
|
430
|
|
|
[ |
|
431
|
|
|
'value' => CustomNotification::RECIPIENTS_WAITLIST_CONFIRMED, |
|
432
|
|
|
'label' => $this->getLanguageService()->sL( |
|
433
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_WAITLIST_CONFIRMED |
|
434
|
|
|
), |
|
435
|
|
|
], |
|
436
|
|
|
[ |
|
437
|
|
|
'value' => CustomNotification::RECIPIENTS_WAITLIST_UNCONFIRMED, |
|
438
|
|
|
'label' => $this->getLanguageService()->sL( |
|
439
|
|
|
self::LANG_FILE . 'administration.notify.recipients.' . CustomNotification::RECIPIENTS_WAITLIST_UNCONFIRMED |
|
440
|
|
|
), |
|
441
|
|
|
], |
|
442
|
|
|
]; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/** |
|
446
|
|
|
* Notify action |
|
447
|
|
|
*/ |
|
448
|
|
|
public function notifyAction(Event $event, CustomNotification $customNotification): ResponseInterface |
|
449
|
|
|
{ |
|
450
|
|
|
if (!$this->checkEventAccess($event)) { |
|
451
|
|
|
return $this->redirect('list'); |
|
452
|
|
|
} |
|
453
|
|
|
|
|
454
|
|
|
$customNotifications = $this->settingsService->getCustomNotifications($this->settings); |
|
455
|
|
|
$result = $this->notificationService->sendCustomNotification($event, $customNotification, $this->settings); |
|
456
|
|
|
$this->notificationService->createCustomNotificationLogentry( |
|
457
|
|
|
$event, |
|
458
|
|
|
$customNotifications[$customNotification->getTemplate()], |
|
459
|
|
|
$result, |
|
460
|
|
|
$customNotification |
|
461
|
|
|
); |
|
462
|
|
|
$this->addFlashMessage( |
|
463
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-2.content'), |
|
464
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.message-2.title') |
|
465
|
|
|
); |
|
466
|
|
|
return $this->redirect('list'); |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
/** |
|
470
|
|
|
* Checks if the current backend user has access to the PID of the event and if not, enqueue an |
|
471
|
|
|
* access denied flash message |
|
472
|
|
|
*/ |
|
473
|
|
|
public function checkEventAccess(Event $event): bool |
|
474
|
|
|
{ |
|
475
|
|
|
if ($this->getBackendUser()->isInWebMount($event->getPid()) === null) { |
|
476
|
|
|
$this->addFlashMessage( |
|
477
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.accessdenied.content'), |
|
478
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.accessdenied.title'), |
|
479
|
|
|
ContextualFeedbackSeverity::ERROR |
|
480
|
|
|
); |
|
481
|
|
|
return false; |
|
482
|
|
|
} |
|
483
|
|
|
|
|
484
|
|
|
return true; |
|
485
|
|
|
} |
|
486
|
|
|
|
|
487
|
|
|
/** |
|
488
|
|
|
* Shows the settings error view |
|
489
|
|
|
*/ |
|
490
|
|
|
public function settingsErrorAction(): ResponseInterface |
|
491
|
|
|
{ |
|
492
|
|
|
return $this->initModuleTemplateAndReturnResponse('Administration/SettingsError'); |
|
493
|
|
|
} |
|
494
|
|
|
|
|
495
|
|
|
/** |
|
496
|
|
|
* Suppress default validation messages |
|
497
|
|
|
*/ |
|
498
|
|
|
protected function getErrorFlashMessage(): bool |
|
499
|
|
|
{ |
|
500
|
|
|
return false; |
|
501
|
|
|
} |
|
502
|
|
|
|
|
503
|
|
|
/** |
|
504
|
|
|
* Returns an array with possible order directions |
|
505
|
|
|
*/ |
|
506
|
|
|
public function getOrderDirections(): array |
|
507
|
|
|
{ |
|
508
|
|
|
return [ |
|
509
|
|
|
'asc' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.sortOrder.asc'), |
|
510
|
|
|
'desc' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.sortOrder.desc'), |
|
511
|
|
|
]; |
|
512
|
|
|
} |
|
513
|
|
|
|
|
514
|
|
|
/** |
|
515
|
|
|
* Returns an array with possible recursive levels |
|
516
|
|
|
*/ |
|
517
|
|
|
public function getRecursiveLevels(): array |
|
518
|
|
|
{ |
|
519
|
|
|
return [ |
|
520
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.current'), |
|
521
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level1'), |
|
522
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level2'), |
|
523
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level3'), |
|
524
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level4'), |
|
525
|
|
|
$this->getLanguageService()->sL(self::LANG_FILE . 'administration.recursiveLevel.level5'), |
|
526
|
|
|
]; |
|
527
|
|
|
} |
|
528
|
|
|
|
|
529
|
|
|
/** |
|
530
|
|
|
* Returns an array with possible orderBy fields |
|
531
|
|
|
*/ |
|
532
|
|
|
public function getOrderByFields(): array |
|
533
|
|
|
{ |
|
534
|
|
|
return [ |
|
535
|
|
|
'title' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.title'), |
|
536
|
|
|
'startdate' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.startdate'), |
|
537
|
|
|
'enddate' => $this->getLanguageService()->sL(self::LANG_FILE . 'administration.orderBy.enddate'), |
|
538
|
|
|
]; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
protected function getLanguageService(): LanguageService |
|
542
|
|
|
{ |
|
543
|
|
|
return $GLOBALS['LANG']; |
|
544
|
|
|
} |
|
545
|
|
|
|
|
546
|
|
|
protected function getBackendUser(): BackendUserAuthentication |
|
547
|
|
|
{ |
|
548
|
|
|
return $GLOBALS['BE_USER']; |
|
549
|
|
|
} |
|
550
|
|
|
} |
|
551
|
|
|
|
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