Completed
Push — master ( 558213...ef208d )
by Tim
02:11
created

BackendController::listAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * BackendController.
5
 */
6
declare(strict_types=1);
7
8
namespace HDNET\Calendarize\Controller;
9
10
use HDNET\Calendarize\Domain\Model\Index;
11
use HDNET\Calendarize\Domain\Model\Request\OptionRequest;
12
use TYPO3\CMS\Core\Messaging\FlashMessage;
13
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
14
15
/**
16
 * BackendController.
17
 */
18
class BackendController extends AbstractController
19
{
20
    /**
21
     * Basic backend list.
22
     */
23
    public function listAction()
24
    {
25
        $this->settings['timeFormat'] = 'H:i';
26
        $this->settings['dateFormat'] = 'd.m.Y';
27
28
        $this->view->assignMultiple([
29
            'indices' => $this->indexRepository->findAllForBackend(),
30
            'typeLocations' => $this->getDifferentTypesAndLocations(),
31
            'settings' => $this->settings,
32
            'options' => $this->getOptions()
33
        ]);
34
    }
35
36
    /**
37
     * Option action
38
     *
39
     * @param \HDNET\Calendarize\Domain\Model\Request\OptionRequest $options
40
     */
41
    public function optionAction(OptionRequest $options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
44
        // @todo save options
45
46
        $this->addFlashMessage('Options saved', '', FlashMessage::OK, true);
47
        $this->forward('list');
48
    }
49
50
    /**
51
     * Get option request
52
     *
53
     * @return OptionRequest
54
     */
55
    protected function getOptions()
56
    {
57
        return new OptionRequest();
58
    }
59
60
    /**
61
     * Get the differnet locations for new entries.
62
     *
63
     * @return array
64
     */
65
    protected function getDifferentTypesAndLocations()
66
    {
67
        $typeLocations = [];
68
        foreach ($this->indexRepository->findDifferentTypesAndLocations() as $entry) {
69
            $typeLocations[$entry['foreign_table']][$entry['pid']] = $entry['unique_register_key'];
70
        }
71
72
        return $typeLocations;
73
    }
74
}
75