Passed
Push — master ( 22188a...e5f73b )
by Romain
02:58
created

ShowEventController::processAction()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 14
nc 4
nop 1
dl 0
loc 26
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Controller\Backend\Manager;
18
19
use CuyZ\Notiz\Controller\Backend\Menu;
20
21
/**
22
 * Show detailed information about a given event.
23
 */
24
class ShowEventController extends ManagerController
25
{
26
    /**
27
     * Show detailed information about a given event.
28
     *
29
     * @param string $eventIdentifier
30
     */
31
    public function processAction($eventIdentifier)
32
    {
33
        $definition = $this->getDefinition();
34
35
        if (!$definition->hasEventFromFullIdentifier($eventIdentifier)) {
36
            $this->addErrorMessage(
37
                'Backend/Module/Manager/ShowEvent:event_not_found',
38
                $eventIdentifier
39
            );
40
41
            $this->forward('process', 'ListEvents');
42
        }
43
44
        $eventDefinition = $definition->getEventFromFullIdentifier($eventIdentifier);
45
46
        $notifications = [];
47
48
        foreach ($definition->getListableNotifications() as $notification) {
49
            $notifications[] = [
50
                'definition' => $notification,
51
                'count' => $notification->getProcessor()->countNotificationsFromEventDefinition($eventDefinition),
52
            ];
53
        }
54
55
        $this->view->assign('eventDefinition', $eventDefinition);
56
        $this->view->assign('notifications', $notifications);
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    protected function getMenu()
63
    {
64
        return Menu::MANAGER_EVENTS;
65
    }
66
}
67