@@ -21,68 +21,68 @@ |
||
21 | 21 | */ |
22 | 22 | class UserPreferencesController extends ActionController |
23 | 23 | { |
24 | - /** |
|
25 | - * @param string $key |
|
26 | - * @param string $value |
|
27 | - * @param string $preferenceSignature |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function saveAction($key, $value, $preferenceSignature): ResponseInterface |
|
31 | - { |
|
32 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
24 | + /** |
|
25 | + * @param string $key |
|
26 | + * @param string $value |
|
27 | + * @param string $preferenceSignature |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function saveAction($key, $value, $preferenceSignature): ResponseInterface |
|
31 | + { |
|
32 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
33 | 33 | |
34 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
35 | - $this->getCacheInstance()->set($key, $value, [], 0); |
|
34 | + $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
35 | + $this->getCacheInstance()->set($key, $value, [], 0); |
|
36 | 36 | |
37 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
38 | - $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
|
37 | + $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
38 | + $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
|
39 | 39 | |
40 | - return $this->htmlResponse('OK'); |
|
41 | - } |
|
40 | + return $this->htmlResponse('OK'); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @return int |
|
45 | - */ |
|
46 | - protected function getBackendUserIdentifier() |
|
47 | - { |
|
48 | - return $this->getBackendUser()->user['uid']; |
|
49 | - } |
|
43 | + /** |
|
44 | + * @return int |
|
45 | + */ |
|
46 | + protected function getBackendUserIdentifier() |
|
47 | + { |
|
48 | + return $this->getBackendUser()->user['uid']; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns an instance of the current Backend User. |
|
53 | - * |
|
54 | - * @return BackendUserAuthentication |
|
55 | - */ |
|
56 | - protected function getBackendUser() |
|
57 | - { |
|
58 | - return $GLOBALS['BE_USER']; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Returns an instance of the current Backend User. |
|
53 | + * |
|
54 | + * @return BackendUserAuthentication |
|
55 | + */ |
|
56 | + protected function getBackendUser() |
|
57 | + { |
|
58 | + return $GLOBALS['BE_USER']; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Get the Vidi Module Loader. |
|
63 | - * |
|
64 | - * @return ModuleLoader |
|
65 | - */ |
|
66 | - protected function getModuleLoader() |
|
67 | - { |
|
68 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
69 | - } |
|
61 | + /** |
|
62 | + * Get the Vidi Module Loader. |
|
63 | + * |
|
64 | + * @return ModuleLoader |
|
65 | + */ |
|
66 | + protected function getModuleLoader() |
|
67 | + { |
|
68 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
69 | + } |
|
70 | 70 | |
71 | - /** |
|
72 | - * @return AbstractFrontend |
|
73 | - */ |
|
74 | - protected function getCacheInstance() |
|
75 | - { |
|
76 | - return $this->getCacheManager()->getCache('vidi'); |
|
77 | - } |
|
71 | + /** |
|
72 | + * @return AbstractFrontend |
|
73 | + */ |
|
74 | + protected function getCacheInstance() |
|
75 | + { |
|
76 | + return $this->getCacheManager()->getCache('vidi'); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Return the Cache Manager |
|
81 | - * |
|
82 | - * @return CacheManager |
|
83 | - */ |
|
84 | - protected function getCacheManager() |
|
85 | - { |
|
86 | - return GeneralUtility::makeInstance(CacheManager::class); |
|
87 | - } |
|
79 | + /** |
|
80 | + * Return the Cache Manager |
|
81 | + * |
|
82 | + * @return CacheManager |
|
83 | + */ |
|
84 | + protected function getCacheManager() |
|
85 | + { |
|
86 | + return GeneralUtility::makeInstance(CacheManager::class); |
|
87 | + } |
|
88 | 88 | } |
@@ -31,10 +31,10 @@ |
||
31 | 31 | { |
32 | 32 | $dataType = $this->getModuleLoader()->getDataType(); |
33 | 33 | |
34 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_' . $key; |
|
34 | + $key = $dataType.'_'.$this->getBackendUserIdentifier().'_'.$key; |
|
35 | 35 | $this->getCacheInstance()->set($key, $value, [], 0); |
36 | 36 | |
37 | - $key = $dataType . '_' . $this->getBackendUserIdentifier() . '_signature'; |
|
37 | + $key = $dataType.'_'.$this->getBackendUserIdentifier().'_signature'; |
|
38 | 38 | $this->getCacheInstance()->set($key, $preferenceSignature, [], 0); |
39 | 39 | |
40 | 40 | return $this->htmlResponse('OK'); |
@@ -21,47 +21,47 @@ |
||
21 | 21 | */ |
22 | 22 | class FacetController extends ActionController |
23 | 23 | { |
24 | - /** |
|
25 | - * Suggest values according to a facet. |
|
26 | - * Output a json list of key / values. |
|
27 | - * |
|
28 | - * @param string $facet |
|
29 | - * @param string $searchTerm |
|
30 | - * @Validate("Fab\Vidi\Domain\Validator\FacetValidator", param="facet") |
|
31 | - */ |
|
32 | - public function autoSuggestAction($facet, $searchTerm) |
|
33 | - { |
|
34 | - $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet); |
|
24 | + /** |
|
25 | + * Suggest values according to a facet. |
|
26 | + * Output a json list of key / values. |
|
27 | + * |
|
28 | + * @param string $facet |
|
29 | + * @param string $searchTerm |
|
30 | + * @Validate("Fab\Vidi\Domain\Validator\FacetValidator", param="facet") |
|
31 | + */ |
|
32 | + public function autoSuggestAction($facet, $searchTerm) |
|
33 | + { |
|
34 | + $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet); |
|
35 | 35 | |
36 | 36 | |
37 | - return $this->responseFactory->createResponse() |
|
38 | - ->withAddedHeader('Content-Type', 'application/json') |
|
39 | - ->withBody($this->streamFactory->createStream(json_encode($suggestions))); |
|
40 | - } |
|
37 | + return $this->responseFactory->createResponse() |
|
38 | + ->withAddedHeader('Content-Type', 'application/json') |
|
39 | + ->withBody($this->streamFactory->createStream(json_encode($suggestions))); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * Suggest values for all configured facets in the Grid. |
|
44 | - * Output a json list of key / values. |
|
45 | - */ |
|
46 | - public function autoSuggestsAction() |
|
47 | - { |
|
48 | - $suggestions = []; |
|
49 | - foreach (Tca::grid()->getFacets() as $facet) { |
|
50 | - /** @var FacetInterface $facet */ |
|
51 | - $name = $facet->getName(); |
|
52 | - $suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name); |
|
53 | - } |
|
42 | + /** |
|
43 | + * Suggest values for all configured facets in the Grid. |
|
44 | + * Output a json list of key / values. |
|
45 | + */ |
|
46 | + public function autoSuggestsAction() |
|
47 | + { |
|
48 | + $suggestions = []; |
|
49 | + foreach (Tca::grid()->getFacets() as $facet) { |
|
50 | + /** @var FacetInterface $facet */ |
|
51 | + $name = $facet->getName(); |
|
52 | + $suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name); |
|
53 | + } |
|
54 | 54 | |
55 | - return $this->responseFactory->createResponse() |
|
56 | - ->withAddedHeader('Content-Type', 'application/json') |
|
57 | - ->withBody($this->streamFactory->createStream(json_encode($suggestions))); |
|
58 | - } |
|
55 | + return $this->responseFactory->createResponse() |
|
56 | + ->withAddedHeader('Content-Type', 'application/json') |
|
57 | + ->withBody($this->streamFactory->createStream(json_encode($suggestions))); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @return FacetSuggestionService|object |
|
62 | - */ |
|
63 | - protected function getFacetSuggestionService() |
|
64 | - { |
|
65 | - return GeneralUtility::makeInstance(FacetSuggestionService::class); |
|
66 | - } |
|
60 | + /** |
|
61 | + * @return FacetSuggestionService|object |
|
62 | + */ |
|
63 | + protected function getFacetSuggestionService() |
|
64 | + { |
|
65 | + return GeneralUtility::makeInstance(FacetSuggestionService::class); |
|
66 | + } |
|
67 | 67 | } |
@@ -22,90 +22,90 @@ |
||
22 | 22 | */ |
23 | 23 | class SelectionController extends ActionController |
24 | 24 | { |
25 | - /** |
|
26 | - * @param Selection $selection |
|
27 | - */ |
|
28 | - public function createAction(Selection $selection = null) |
|
29 | - { |
|
30 | - $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
31 | - $selection->setDataType($this->getModuleLoader()->getDataType()); |
|
25 | + /** |
|
26 | + * @param Selection $selection |
|
27 | + */ |
|
28 | + public function createAction(Selection $selection = null) |
|
29 | + { |
|
30 | + $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
31 | + $selection->setDataType($this->getModuleLoader()->getDataType()); |
|
32 | 32 | |
33 | - $selection->setOwner($this->getBackendUser()->user['uid']); |
|
34 | - $selectionRepository->add($selection); |
|
35 | - $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); |
|
36 | - } |
|
33 | + $selection->setOwner($this->getBackendUser()->user['uid']); |
|
34 | + $selectionRepository->add($selection); |
|
35 | + $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * @param Selection $selection |
|
40 | - * @return string |
|
41 | - */ |
|
42 | - public function deleteAction(Selection $selection): ResponseInterface |
|
43 | - { |
|
44 | - $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
45 | - $selectionRepository->remove($selection); |
|
46 | - return $this->htmlResponse('ok'); |
|
47 | - } |
|
38 | + /** |
|
39 | + * @param Selection $selection |
|
40 | + * @return string |
|
41 | + */ |
|
42 | + public function deleteAction(Selection $selection): ResponseInterface |
|
43 | + { |
|
44 | + $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
45 | + $selectionRepository->remove($selection); |
|
46 | + return $this->htmlResponse('ok'); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @param Selection $selection |
|
51 | - */ |
|
52 | - public function updateAction(Selection $selection) |
|
53 | - { |
|
54 | - $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
55 | - $selectionRepository->update($selection); |
|
56 | - $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); |
|
57 | - } |
|
49 | + /** |
|
50 | + * @param Selection $selection |
|
51 | + */ |
|
52 | + public function updateAction(Selection $selection) |
|
53 | + { |
|
54 | + $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
55 | + $selectionRepository->update($selection); |
|
56 | + $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * @param Selection $selection |
|
61 | - */ |
|
62 | - public function showAction(Selection $selection): ResponseInterface |
|
63 | - { |
|
64 | - $this->view->assign('selection', $selection); |
|
65 | - return $this->htmlResponse(); |
|
66 | - } |
|
59 | + /** |
|
60 | + * @param Selection $selection |
|
61 | + */ |
|
62 | + public function showAction(Selection $selection): ResponseInterface |
|
63 | + { |
|
64 | + $this->view->assign('selection', $selection); |
|
65 | + return $this->htmlResponse(); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Returns an editing form for a given data type. |
|
70 | - * |
|
71 | - * @param string $dataType |
|
72 | - */ |
|
73 | - public function editAction($dataType): ResponseInterface |
|
74 | - { |
|
75 | - $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
76 | - $selections = $selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
77 | - $this->view->assign('selections', $selections); |
|
78 | - return $this->htmlResponse(); |
|
79 | - } |
|
68 | + /** |
|
69 | + * Returns an editing form for a given data type. |
|
70 | + * |
|
71 | + * @param string $dataType |
|
72 | + */ |
|
73 | + public function editAction($dataType): ResponseInterface |
|
74 | + { |
|
75 | + $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
76 | + $selections = $selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
77 | + $this->view->assign('selections', $selections); |
|
78 | + return $this->htmlResponse(); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param string $dataType |
|
83 | - */ |
|
84 | - public function listAction($dataType): ResponseInterface |
|
85 | - { |
|
86 | - $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
87 | - $selections = $selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
88 | - $this->view->assign('selections', $selections); |
|
89 | - return $this->htmlResponse(); |
|
90 | - } |
|
81 | + /** |
|
82 | + * @param string $dataType |
|
83 | + */ |
|
84 | + public function listAction($dataType): ResponseInterface |
|
85 | + { |
|
86 | + $selectionRepository = GeneralUtility::makeInstance(SelectionRepository::class); |
|
87 | + $selections = $selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
88 | + $this->view->assign('selections', $selections); |
|
89 | + return $this->htmlResponse(); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Get the Vidi Module Loader. |
|
94 | - * |
|
95 | - * @return ModuleLoader |
|
96 | - */ |
|
97 | - protected function getModuleLoader() |
|
98 | - { |
|
99 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
100 | - } |
|
92 | + /** |
|
93 | + * Get the Vidi Module Loader. |
|
94 | + * |
|
95 | + * @return ModuleLoader |
|
96 | + */ |
|
97 | + protected function getModuleLoader() |
|
98 | + { |
|
99 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
100 | + } |
|
101 | 101 | |
102 | - /** |
|
103 | - * Returns an instance of the current Backend User. |
|
104 | - * |
|
105 | - * @return BackendUserAuthentication |
|
106 | - */ |
|
107 | - protected function getBackendUser() |
|
108 | - { |
|
109 | - return $GLOBALS['BE_USER']; |
|
110 | - } |
|
102 | + /** |
|
103 | + * Returns an instance of the current Backend User. |
|
104 | + * |
|
105 | + * @return BackendUserAuthentication |
|
106 | + */ |
|
107 | + protected function getBackendUser() |
|
108 | + { |
|
109 | + return $GLOBALS['BE_USER']; |
|
110 | + } |
|
111 | 111 | } |
@@ -21,47 +21,47 @@ |
||
21 | 21 | */ |
22 | 22 | class ToolController extends ActionController |
23 | 23 | { |
24 | - /** |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function welcomeAction(): ResponseInterface |
|
28 | - { |
|
29 | - $items = []; |
|
30 | - $tools = ToolRegistry::getInstance()->getTools($this->getModuleLoader()->getDataType()); |
|
24 | + /** |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function welcomeAction(): ResponseInterface |
|
28 | + { |
|
29 | + $items = []; |
|
30 | + $tools = ToolRegistry::getInstance()->getTools($this->getModuleLoader()->getDataType()); |
|
31 | 31 | |
32 | - foreach ($tools as $index => $tool) { |
|
33 | - $item = []; |
|
34 | - $item['title'] = $tool->getTitle(); |
|
35 | - $item['description'] = $tool->getDescription(); |
|
32 | + foreach ($tools as $index => $tool) { |
|
33 | + $item = []; |
|
34 | + $item['title'] = $tool->getTitle(); |
|
35 | + $item['description'] = $tool->getDescription(); |
|
36 | 36 | |
37 | - $items[] = $item; |
|
38 | - } |
|
39 | - $this->view->assign('items', $items); |
|
40 | - return $this->htmlResponse(); |
|
41 | - } |
|
37 | + $items[] = $item; |
|
38 | + } |
|
39 | + $this->view->assign('items', $items); |
|
40 | + return $this->htmlResponse(); |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $tool |
|
45 | - * @param array $arguments |
|
46 | - * @return void |
|
47 | - * @Extbase\Validate("Fab\Vidi\Domain\Validator\ToolValidator", param="tool") |
|
48 | - */ |
|
49 | - public function workAction(string $tool, array $arguments = array()): ResponseInterface |
|
50 | - { |
|
51 | - /** @var ToolInterface $tool */ |
|
52 | - $tool = GeneralUtility::makeInstance($tool); |
|
53 | - $workResult = $tool->work($arguments); |
|
54 | - $this->view->assign('result', $workResult); |
|
55 | - return $this->htmlResponse(); |
|
56 | - } |
|
43 | + /** |
|
44 | + * @param string $tool |
|
45 | + * @param array $arguments |
|
46 | + * @return void |
|
47 | + * @Extbase\Validate("Fab\Vidi\Domain\Validator\ToolValidator", param="tool") |
|
48 | + */ |
|
49 | + public function workAction(string $tool, array $arguments = array()): ResponseInterface |
|
50 | + { |
|
51 | + /** @var ToolInterface $tool */ |
|
52 | + $tool = GeneralUtility::makeInstance($tool); |
|
53 | + $workResult = $tool->work($arguments); |
|
54 | + $this->view->assign('result', $workResult); |
|
55 | + return $this->htmlResponse(); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * Get the Vidi Module Loader. |
|
60 | - * |
|
61 | - * @return ModuleLoader|object |
|
62 | - */ |
|
63 | - protected function getModuleLoader() |
|
64 | - { |
|
65 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
66 | - } |
|
58 | + /** |
|
59 | + * Get the Vidi Module Loader. |
|
60 | + * |
|
61 | + * @return ModuleLoader|object |
|
62 | + */ |
|
63 | + protected function getModuleLoader() |
|
64 | + { |
|
65 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
66 | + } |
|
67 | 67 | } |
@@ -20,77 +20,77 @@ |
||
20 | 20 | */ |
21 | 21 | class ClipboardController extends ActionController |
22 | 22 | { |
23 | - /** |
|
24 | - * Save data into the clipboard. |
|
25 | - * |
|
26 | - * @param array $matches |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function saveAction(array $matches = array()): ResponseInterface |
|
30 | - { |
|
31 | - $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); |
|
32 | - $this->getClipboardService()->save($matcher); |
|
23 | + /** |
|
24 | + * Save data into the clipboard. |
|
25 | + * |
|
26 | + * @param array $matches |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function saveAction(array $matches = array()): ResponseInterface |
|
30 | + { |
|
31 | + $matcher = MatcherObjectFactory::getInstance()->getMatcher($matches); |
|
32 | + $this->getClipboardService()->save($matcher); |
|
33 | 33 | |
34 | - // Fetch objects via the Content Service. |
|
35 | - $contentService = $this->getContentService()->findBy($matcher); |
|
36 | - $numberOfObjects = $contentService->getNumberOfObjects(); |
|
34 | + // Fetch objects via the Content Service. |
|
35 | + $contentService = $this->getContentService()->findBy($matcher); |
|
36 | + $numberOfObjects = $contentService->getNumberOfObjects(); |
|
37 | 37 | |
38 | - if ($numberOfObjects === 0) { |
|
39 | - $this->getClipboardService()->flush(); |
|
40 | - } |
|
38 | + if ($numberOfObjects === 0) { |
|
39 | + $this->getClipboardService()->flush(); |
|
40 | + } |
|
41 | 41 | |
42 | - # Json header is not automatically sent in the BE... |
|
43 | - $this->response->setHeader('Content-Type', 'application/json'); |
|
44 | - $this->response->sendHeaders(); |
|
45 | - return $this->jsonResponse(json_encode($numberOfObjects)); |
|
46 | - } |
|
42 | + # Json header is not automatically sent in the BE... |
|
43 | + $this->response->setHeader('Content-Type', 'application/json'); |
|
44 | + $this->response->sendHeaders(); |
|
45 | + return $this->jsonResponse(json_encode($numberOfObjects)); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Completely flush the clipboard. |
|
50 | - * |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - public function flushAction(): ResponseInterface |
|
54 | - { |
|
55 | - $this->getClipboardService()->flush(); |
|
48 | + /** |
|
49 | + * Completely flush the clipboard. |
|
50 | + * |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + public function flushAction(): ResponseInterface |
|
54 | + { |
|
55 | + $this->getClipboardService()->flush(); |
|
56 | 56 | |
57 | - # Json header is not automatically sent in the BE... |
|
58 | - $this->response->setHeader('Content-Type', 'application/json'); |
|
59 | - $this->response->sendHeaders(); |
|
60 | - return $this->jsonResponse(json_encode(true)); |
|
61 | - } |
|
57 | + # Json header is not automatically sent in the BE... |
|
58 | + $this->response->setHeader('Content-Type', 'application/json'); |
|
59 | + $this->response->sendHeaders(); |
|
60 | + return $this->jsonResponse(json_encode(true)); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Show the content of the clipboard. |
|
65 | - */ |
|
66 | - public function showAction(): ResponseInterface |
|
67 | - { |
|
68 | - // Retrieve matcher object from clipboard. |
|
69 | - $matcher = $this->getClipboardService()->getMatcher(); |
|
63 | + /** |
|
64 | + * Show the content of the clipboard. |
|
65 | + */ |
|
66 | + public function showAction(): ResponseInterface |
|
67 | + { |
|
68 | + // Retrieve matcher object from clipboard. |
|
69 | + $matcher = $this->getClipboardService()->getMatcher(); |
|
70 | 70 | |
71 | - // Fetch objects via the Content Service. |
|
72 | - $contentService = $this->getContentService()->findBy($matcher); |
|
71 | + // Fetch objects via the Content Service. |
|
72 | + $contentService = $this->getContentService()->findBy($matcher); |
|
73 | 73 | |
74 | - // count number of items and display it. |
|
75 | - $this->view->assign('target', GeneralUtility::_GP('id')); |
|
76 | - $this->view->assign('numberOfObjects', $contentService->getNumberOfObjects()); |
|
77 | - $this->view->assign('objects', $contentService->getObjects()); |
|
78 | - return $this->htmlResponse(); |
|
79 | - } |
|
74 | + // count number of items and display it. |
|
75 | + $this->view->assign('target', GeneralUtility::_GP('id')); |
|
76 | + $this->view->assign('numberOfObjects', $contentService->getNumberOfObjects()); |
|
77 | + $this->view->assign('objects', $contentService->getObjects()); |
|
78 | + return $this->htmlResponse(); |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @return ClipboardService|object |
|
83 | - */ |
|
84 | - protected function getClipboardService() |
|
85 | - { |
|
86 | - return GeneralUtility::makeInstance(ClipboardService::class); |
|
87 | - } |
|
81 | + /** |
|
82 | + * @return ClipboardService|object |
|
83 | + */ |
|
84 | + protected function getClipboardService() |
|
85 | + { |
|
86 | + return GeneralUtility::makeInstance(ClipboardService::class); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @return ContentService|object |
|
91 | - */ |
|
92 | - protected function getContentService() |
|
93 | - { |
|
94 | - return GeneralUtility::makeInstance(ContentService::class); |
|
95 | - } |
|
89 | + /** |
|
90 | + * @return ContentService|object |
|
91 | + */ |
|
92 | + protected function getContentService() |
|
93 | + { |
|
94 | + return GeneralUtility::makeInstance(ContentService::class); |
|
95 | + } |
|
96 | 96 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | */ |
17 | 17 | class SavingBehavior extends Enumeration |
18 | 18 | { |
19 | - public const REMOVE = 'remove'; |
|
19 | + public const REMOVE = 'remove'; |
|
20 | 20 | |
21 | - public const APPEND = 'append'; |
|
21 | + public const APPEND = 'append'; |
|
22 | 22 | |
23 | - public const REPLACE = 'replace'; |
|
23 | + public const REPLACE = 'replace'; |
|
24 | 24 | } |
@@ -14,32 +14,32 @@ |
||
14 | 14 | */ |
15 | 15 | interface ToolInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * Display the title of the tool on the welcome screen. |
|
19 | - * |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function getTitle(); |
|
17 | + /** |
|
18 | + * Display the title of the tool on the welcome screen. |
|
19 | + * |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function getTitle(); |
|
23 | 23 | |
24 | - /** |
|
25 | - * Display the description of the tool on the welcome screen. |
|
26 | - * |
|
27 | - * @return string |
|
28 | - */ |
|
29 | - public function getDescription(); |
|
24 | + /** |
|
25 | + * Display the description of the tool on the welcome screen. |
|
26 | + * |
|
27 | + * @return string |
|
28 | + */ |
|
29 | + public function getDescription(); |
|
30 | 30 | |
31 | - /** |
|
32 | - * Do the job. |
|
33 | - * |
|
34 | - * @param array $arguments |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function work(array $arguments = array()); |
|
31 | + /** |
|
32 | + * Do the job. |
|
33 | + * |
|
34 | + * @param array $arguments |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function work(array $arguments = array()); |
|
38 | 38 | |
39 | - /** |
|
40 | - * Tell whether the tools should be displayed. |
|
41 | - * |
|
42 | - * @return bool |
|
43 | - */ |
|
44 | - public function isShown(); |
|
39 | + /** |
|
40 | + * Tell whether the tools should be displayed. |
|
41 | + * |
|
42 | + * @return bool |
|
43 | + */ |
|
44 | + public function isShown(); |
|
45 | 45 | } |
@@ -18,40 +18,40 @@ |
||
18 | 18 | */ |
19 | 19 | abstract class AbstractTool implements ToolInterface |
20 | 20 | { |
21 | - /** |
|
22 | - * @param string $templateNameAndPath |
|
23 | - * @return StandaloneView |
|
24 | - * @throws \InvalidArgumentException |
|
25 | - */ |
|
26 | - protected function initializeStandaloneView($templateNameAndPath) |
|
27 | - { |
|
28 | - $templateNameAndPath = GeneralUtility::getFileAbsFileName($templateNameAndPath); |
|
21 | + /** |
|
22 | + * @param string $templateNameAndPath |
|
23 | + * @return StandaloneView |
|
24 | + * @throws \InvalidArgumentException |
|
25 | + */ |
|
26 | + protected function initializeStandaloneView($templateNameAndPath) |
|
27 | + { |
|
28 | + $templateNameAndPath = GeneralUtility::getFileAbsFileName($templateNameAndPath); |
|
29 | 29 | |
30 | - /** @var StandaloneView $view */ |
|
31 | - $view = GeneralUtility::makeInstance(StandaloneView::class); |
|
30 | + /** @var StandaloneView $view */ |
|
31 | + $view = GeneralUtility::makeInstance(StandaloneView::class); |
|
32 | 32 | |
33 | - $view->setTemplatePathAndFilename($templateNameAndPath); |
|
34 | - return $view; |
|
35 | - } |
|
33 | + $view->setTemplatePathAndFilename($templateNameAndPath); |
|
34 | + return $view; |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * Returns an instance of the current Backend User. |
|
39 | - * |
|
40 | - * @return BackendUserAuthentication |
|
41 | - */ |
|
42 | - protected function getBackendUser() |
|
43 | - { |
|
44 | - return $GLOBALS['BE_USER']; |
|
45 | - } |
|
37 | + /** |
|
38 | + * Returns an instance of the current Backend User. |
|
39 | + * |
|
40 | + * @return BackendUserAuthentication |
|
41 | + */ |
|
42 | + protected function getBackendUser() |
|
43 | + { |
|
44 | + return $GLOBALS['BE_USER']; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get the Vidi Module Loader. |
|
49 | - * |
|
50 | - * @return ModuleLoader |
|
51 | - * @throws \InvalidArgumentException |
|
52 | - */ |
|
53 | - protected function getModuleLoader() |
|
54 | - { |
|
55 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
56 | - } |
|
47 | + /** |
|
48 | + * Get the Vidi Module Loader. |
|
49 | + * |
|
50 | + * @return ModuleLoader |
|
51 | + * @throws \InvalidArgumentException |
|
52 | + */ |
|
53 | + protected function getModuleLoader() |
|
54 | + { |
|
55 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
56 | + } |
|
57 | 57 | } |
@@ -18,173 +18,173 @@ |
||
18 | 18 | */ |
19 | 19 | class ToolRegistry implements SingletonInterface |
20 | 20 | { |
21 | - /** |
|
22 | - * @var array |
|
23 | - */ |
|
24 | - protected $tools = []; |
|
25 | - |
|
26 | - /** |
|
27 | - * @var array |
|
28 | - */ |
|
29 | - protected $overriddenPermissions = []; |
|
30 | - |
|
31 | - /** |
|
32 | - * Returns a class instance. |
|
33 | - * |
|
34 | - * @return \Fab\Vidi\Tool\ToolRegistry|object |
|
35 | - */ |
|
36 | - public static function getInstance() |
|
37 | - { |
|
38 | - return GeneralUtility::makeInstance(\Fab\Vidi\Tool\ToolRegistry::class); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Register a tool for a data type. |
|
43 | - * |
|
44 | - * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
45 | - * @param string $toolName class name which must implement "ToolInterface". |
|
46 | - * @return $this |
|
47 | - */ |
|
48 | - public function register($dataType, $toolName) |
|
49 | - { |
|
50 | - if (!isset($this->tools[$dataType])) { |
|
51 | - $this->tools[$dataType] = []; |
|
52 | - } |
|
53 | - |
|
54 | - $this->tools[$dataType][] = $toolName; |
|
55 | - return $this; |
|
56 | - } |
|
57 | - |
|
58 | - /** |
|
59 | - * Override permissions for a tool by passing a Closure that will be evaluated when checking permissions. |
|
60 | - * |
|
61 | - * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
62 | - * @param string $toolName class name which must implement "ToolInterface". |
|
63 | - * @param $permission |
|
64 | - * @return $this |
|
65 | - */ |
|
66 | - public function overridePermission($dataType, $toolName, Closure $permission) |
|
67 | - { |
|
68 | - if (empty($this->overriddenPermissions[$dataType])) { |
|
69 | - $this->overriddenPermissions[$dataType] = []; |
|
70 | - } |
|
71 | - |
|
72 | - $this->overriddenPermissions[$dataType][$toolName] = $permission; |
|
73 | - return $this; |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * Un-Register a tool for a given data type. |
|
78 | - * |
|
79 | - * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
80 | - * @param string $toolName class name which must implement "ToolInterface". |
|
81 | - * @return $this |
|
82 | - */ |
|
83 | - public function unRegister($dataType, $toolName) |
|
84 | - { |
|
85 | - if ($this->hasTools($dataType, $toolName)) { |
|
86 | - $toolPosition = array_search($toolName, $this->tools['*']); |
|
87 | - if ($toolPosition !== false) { |
|
88 | - unset($this->tools['*'][$toolPosition]); |
|
89 | - } |
|
90 | - |
|
91 | - $toolPosition = array_search($toolName, $this->tools[$dataType]); |
|
92 | - if ($toolPosition !== false) { |
|
93 | - unset($this->tools[$dataType][$toolPosition]); |
|
94 | - } |
|
95 | - } |
|
96 | - |
|
97 | - return $this; |
|
98 | - } |
|
99 | - |
|
100 | - /** |
|
101 | - * Tell whether the given data type has any tools registered. |
|
102 | - * |
|
103 | - * @param string $dataType |
|
104 | - * @return bool |
|
105 | - */ |
|
106 | - public function hasAnyTools($dataType) |
|
107 | - { |
|
108 | - $tools = $this->getTools($dataType); |
|
109 | - return !empty($tools); |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * Tell whether the given data type has this $tool. |
|
114 | - * |
|
115 | - * @param string $dataType |
|
116 | - * @param string $tool |
|
117 | - * @return bool |
|
118 | - */ |
|
119 | - public function hasTools($dataType, $tool) |
|
120 | - { |
|
121 | - return in_array($tool, $this->tools['*']) || in_array($tool, $this->tools[$dataType]); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Tell whether the given tool is allowed for this data type. |
|
126 | - * |
|
127 | - * @param string $dataType |
|
128 | - * @param string $toolName |
|
129 | - * @return bool |
|
130 | - */ |
|
131 | - public function isAllowed($dataType, $toolName) |
|
132 | - { |
|
133 | - $isAllowed = false; |
|
134 | - |
|
135 | - if ($this->hasTools($dataType, $toolName)) { |
|
136 | - $permission = $this->getOverriddenPermission($dataType, $toolName); |
|
137 | - if (!is_null($permission)) { |
|
138 | - $isAllowed = $permission(); |
|
139 | - } else { |
|
140 | - /** @var ToolInterface $toolName */ |
|
141 | - $toolName = GeneralUtility::makeInstance($toolName); |
|
142 | - $isAllowed = $toolName->isShown(); |
|
143 | - } |
|
144 | - } |
|
145 | - return $isAllowed; |
|
146 | - } |
|
147 | - |
|
148 | - /** |
|
149 | - * Get Registered tools. |
|
150 | - * |
|
151 | - * @param string $dataType |
|
152 | - * @return ToolInterface[] |
|
153 | - */ |
|
154 | - public function getTools($dataType) |
|
155 | - { |
|
156 | - $tools = []; |
|
157 | - |
|
158 | - foreach (array($dataType, '*') as $toolSource) { |
|
159 | - if (isset($this->tools[$toolSource])) { |
|
160 | - $toolNames = $this->tools[$toolSource]; |
|
161 | - |
|
162 | - foreach ($toolNames as $toolName) { |
|
163 | - /** @var ToolInterface $tool */ |
|
164 | - if ($this->isAllowed($dataType, $toolName)) { |
|
165 | - $tools[] = GeneralUtility::makeInstance($toolName); |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - } |
|
170 | - return $tools; |
|
171 | - } |
|
172 | - |
|
173 | - /** |
|
174 | - * Get the proper permission for a tool. |
|
175 | - * |
|
176 | - * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
177 | - * @param string $toolName class name which must implement "ToolInterface". |
|
178 | - * @return null|Closure |
|
179 | - */ |
|
180 | - protected function getOverriddenPermission($dataType, $toolName) |
|
181 | - { |
|
182 | - $permission = null; |
|
183 | - if (isset($this->overriddenPermissions[$dataType][$toolName])) { |
|
184 | - $permission = $this->overriddenPermissions[$dataType][$toolName]; |
|
185 | - } elseif (isset($this->overriddenPermissions['*'][$toolName])) { |
|
186 | - $permission = $this->overriddenPermissions['*'][$toolName]; |
|
187 | - } |
|
188 | - return $permission; |
|
189 | - } |
|
21 | + /** |
|
22 | + * @var array |
|
23 | + */ |
|
24 | + protected $tools = []; |
|
25 | + |
|
26 | + /** |
|
27 | + * @var array |
|
28 | + */ |
|
29 | + protected $overriddenPermissions = []; |
|
30 | + |
|
31 | + /** |
|
32 | + * Returns a class instance. |
|
33 | + * |
|
34 | + * @return \Fab\Vidi\Tool\ToolRegistry|object |
|
35 | + */ |
|
36 | + public static function getInstance() |
|
37 | + { |
|
38 | + return GeneralUtility::makeInstance(\Fab\Vidi\Tool\ToolRegistry::class); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Register a tool for a data type. |
|
43 | + * |
|
44 | + * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
45 | + * @param string $toolName class name which must implement "ToolInterface". |
|
46 | + * @return $this |
|
47 | + */ |
|
48 | + public function register($dataType, $toolName) |
|
49 | + { |
|
50 | + if (!isset($this->tools[$dataType])) { |
|
51 | + $this->tools[$dataType] = []; |
|
52 | + } |
|
53 | + |
|
54 | + $this->tools[$dataType][] = $toolName; |
|
55 | + return $this; |
|
56 | + } |
|
57 | + |
|
58 | + /** |
|
59 | + * Override permissions for a tool by passing a Closure that will be evaluated when checking permissions. |
|
60 | + * |
|
61 | + * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
62 | + * @param string $toolName class name which must implement "ToolInterface". |
|
63 | + * @param $permission |
|
64 | + * @return $this |
|
65 | + */ |
|
66 | + public function overridePermission($dataType, $toolName, Closure $permission) |
|
67 | + { |
|
68 | + if (empty($this->overriddenPermissions[$dataType])) { |
|
69 | + $this->overriddenPermissions[$dataType] = []; |
|
70 | + } |
|
71 | + |
|
72 | + $this->overriddenPermissions[$dataType][$toolName] = $permission; |
|
73 | + return $this; |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * Un-Register a tool for a given data type. |
|
78 | + * |
|
79 | + * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
80 | + * @param string $toolName class name which must implement "ToolInterface". |
|
81 | + * @return $this |
|
82 | + */ |
|
83 | + public function unRegister($dataType, $toolName) |
|
84 | + { |
|
85 | + if ($this->hasTools($dataType, $toolName)) { |
|
86 | + $toolPosition = array_search($toolName, $this->tools['*']); |
|
87 | + if ($toolPosition !== false) { |
|
88 | + unset($this->tools['*'][$toolPosition]); |
|
89 | + } |
|
90 | + |
|
91 | + $toolPosition = array_search($toolName, $this->tools[$dataType]); |
|
92 | + if ($toolPosition !== false) { |
|
93 | + unset($this->tools[$dataType][$toolPosition]); |
|
94 | + } |
|
95 | + } |
|
96 | + |
|
97 | + return $this; |
|
98 | + } |
|
99 | + |
|
100 | + /** |
|
101 | + * Tell whether the given data type has any tools registered. |
|
102 | + * |
|
103 | + * @param string $dataType |
|
104 | + * @return bool |
|
105 | + */ |
|
106 | + public function hasAnyTools($dataType) |
|
107 | + { |
|
108 | + $tools = $this->getTools($dataType); |
|
109 | + return !empty($tools); |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * Tell whether the given data type has this $tool. |
|
114 | + * |
|
115 | + * @param string $dataType |
|
116 | + * @param string $tool |
|
117 | + * @return bool |
|
118 | + */ |
|
119 | + public function hasTools($dataType, $tool) |
|
120 | + { |
|
121 | + return in_array($tool, $this->tools['*']) || in_array($tool, $this->tools[$dataType]); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Tell whether the given tool is allowed for this data type. |
|
126 | + * |
|
127 | + * @param string $dataType |
|
128 | + * @param string $toolName |
|
129 | + * @return bool |
|
130 | + */ |
|
131 | + public function isAllowed($dataType, $toolName) |
|
132 | + { |
|
133 | + $isAllowed = false; |
|
134 | + |
|
135 | + if ($this->hasTools($dataType, $toolName)) { |
|
136 | + $permission = $this->getOverriddenPermission($dataType, $toolName); |
|
137 | + if (!is_null($permission)) { |
|
138 | + $isAllowed = $permission(); |
|
139 | + } else { |
|
140 | + /** @var ToolInterface $toolName */ |
|
141 | + $toolName = GeneralUtility::makeInstance($toolName); |
|
142 | + $isAllowed = $toolName->isShown(); |
|
143 | + } |
|
144 | + } |
|
145 | + return $isAllowed; |
|
146 | + } |
|
147 | + |
|
148 | + /** |
|
149 | + * Get Registered tools. |
|
150 | + * |
|
151 | + * @param string $dataType |
|
152 | + * @return ToolInterface[] |
|
153 | + */ |
|
154 | + public function getTools($dataType) |
|
155 | + { |
|
156 | + $tools = []; |
|
157 | + |
|
158 | + foreach (array($dataType, '*') as $toolSource) { |
|
159 | + if (isset($this->tools[$toolSource])) { |
|
160 | + $toolNames = $this->tools[$toolSource]; |
|
161 | + |
|
162 | + foreach ($toolNames as $toolName) { |
|
163 | + /** @var ToolInterface $tool */ |
|
164 | + if ($this->isAllowed($dataType, $toolName)) { |
|
165 | + $tools[] = GeneralUtility::makeInstance($toolName); |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + } |
|
170 | + return $tools; |
|
171 | + } |
|
172 | + |
|
173 | + /** |
|
174 | + * Get the proper permission for a tool. |
|
175 | + * |
|
176 | + * @param string $dataType corresponds to the table name or can be "*" for all data types. |
|
177 | + * @param string $toolName class name which must implement "ToolInterface". |
|
178 | + * @return null|Closure |
|
179 | + */ |
|
180 | + protected function getOverriddenPermission($dataType, $toolName) |
|
181 | + { |
|
182 | + $permission = null; |
|
183 | + if (isset($this->overriddenPermissions[$dataType][$toolName])) { |
|
184 | + $permission = $this->overriddenPermissions[$dataType][$toolName]; |
|
185 | + } elseif (isset($this->overriddenPermissions['*'][$toolName])) { |
|
186 | + $permission = $this->overriddenPermissions['*'][$toolName]; |
|
187 | + } |
|
188 | + return $permission; |
|
189 | + } |
|
190 | 190 | } |