1 | <?php |
||
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 | $options = $this->getOptions(); |
||
29 | $typeLocations = $this->getDifferentTypesAndLocations(); |
||
30 | |||
31 | $pids = $this->getPids($typeLocations); |
||
32 | if ($pids) { |
||
|
|||
33 | $indices = $this->indexRepository->findAllForBackend($options, $pids); |
||
34 | } else { |
||
35 | $indices = []; |
||
36 | } |
||
37 | |||
38 | $this->view->assignMultiple([ |
||
39 | 'indices' => $indices, |
||
40 | 'typeLocations' => $typeLocations, |
||
41 | 'pids' => $this->getPageTitles($pids), |
||
42 | 'settings' => $this->settings, |
||
43 | 'options' => $options, |
||
44 | ]); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Option action. |
||
49 | * |
||
50 | * @param \HDNET\Calendarize\Domain\Model\Request\OptionRequest $options |
||
51 | */ |
||
52 | public function optionAction(OptionRequest $options) |
||
58 | |||
59 | protected function getPids(array $typeLocations) |
||
69 | |||
70 | protected function getPageTitles(array $pids): array |
||
84 | |||
85 | /** |
||
86 | * Get option request. |
||
87 | * |
||
88 | * @return OptionRequest |
||
89 | */ |
||
90 | protected function getOptions() |
||
104 | |||
105 | /** |
||
106 | * Get the differnet locations for new entries. |
||
107 | * |
||
108 | * @return array |
||
109 | */ |
||
110 | protected function getDifferentTypesAndLocations() |
||
127 | |||
128 | /** |
||
129 | * Check if access to page is allowed for current user. |
||
130 | * |
||
131 | * @param int $pageId |
||
132 | * @param array $mountPoints |
||
133 | * @return bool |
||
134 | */ |
||
135 | protected function isPageAllowed(int $pageId, array $mountPoints):bool |
||
150 | |||
151 | /** |
||
152 | * Get allowed mountpoints. Returns temporary mountpoint when temporary mountpoint is used. |
||
153 | * |
||
154 | * copied from core TreeController |
||
155 | * |
||
156 | * @return int[] |
||
157 | */ |
||
158 | protected function getAllowedDbMounts(): array |
||
167 | |||
168 | /** |
||
169 | * @return BackendUserAuthentication |
||
170 | */ |
||
171 | protected function getBackendUser(): BackendUserAuthentication |
||
175 | |||
176 | } |
||
177 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.