@@ -44,7 +44,7 @@ |
||
44 | 44 | { |
45 | 45 | $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ModulePreferences/Launcher.html'; |
46 | 46 | $view = $this->initializeStandaloneView($templateNameAndPath); |
47 | - $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
47 | + $view->assign('sitePath', Environment::getPublicPath().'/'); |
|
48 | 48 | return $view->render(); |
49 | 49 | } |
50 | 50 |
@@ -22,121 +22,121 @@ |
||
22 | 22 | */ |
23 | 23 | class ModulePreferencesTool extends AbstractTool |
24 | 24 | { |
25 | - /** |
|
26 | - * Display the title of the tool on the welcome screen. |
|
27 | - * |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function getTitle() |
|
31 | - { |
|
32 | - return LocalizationUtility::translate( |
|
33 | - 'module_preferences_for', |
|
34 | - 'vidi', |
|
35 | - array(Tca::table($this->getModuleLoader()->getDataType())->getTitle()) |
|
36 | - ); |
|
37 | - } |
|
38 | - |
|
39 | - /** |
|
40 | - * Display the description of the tool in the welcome screen. |
|
41 | - * |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function getDescription() |
|
45 | - { |
|
46 | - $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ModulePreferences/Launcher.html'; |
|
47 | - $view = $this->initializeStandaloneView($templateNameAndPath); |
|
48 | - $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
49 | - return $view->render(); |
|
50 | - } |
|
51 | - |
|
52 | - /** |
|
53 | - * Do the job! |
|
54 | - * |
|
55 | - * @param array $arguments |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function work(array $arguments = array()) |
|
59 | - { |
|
60 | - if (isset($arguments['save'])) { |
|
61 | - // Revert visible <-> excluded |
|
62 | - $excludedFields = array_diff( |
|
63 | - Tca::grid()->getAllFieldNames(), |
|
64 | - $arguments['excluded_fields'], |
|
65 | - $this->getExcludedFieldsFromTca() |
|
66 | - ); |
|
67 | - $arguments['excluded_fields'] = $excludedFields; |
|
68 | - $this->getModulePreferences()->save($arguments); |
|
69 | - } |
|
70 | - |
|
71 | - $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ModulePreferences/WorkResult.html'; |
|
72 | - $view = $this->initializeStandaloneView($templateNameAndPath); |
|
73 | - |
|
74 | - $view->assign('title', Tca::table($this->getModuleLoader()->getDataType())->getTitle()); |
|
75 | - |
|
76 | - // Fetch the menu of visible items. |
|
77 | - $menuVisibleItems = $this->getModulePreferences()->get(ConfigurablePart::MENU_VISIBLE_ITEMS); |
|
78 | - $view->assign(ConfigurablePart::MENU_VISIBLE_ITEMS, $menuVisibleItems); |
|
79 | - |
|
80 | - // Fetch the default number of menu visible items. |
|
81 | - $menuDefaultVisible = $this->getModulePreferences()->get(ConfigurablePart::MENU_VISIBLE_ITEMS_DEFAULT); |
|
82 | - $view->assign(ConfigurablePart::MENU_VISIBLE_ITEMS_DEFAULT, $menuDefaultVisible); |
|
83 | - |
|
84 | - // Get the visible columns |
|
85 | - $view->assign('columns', Tca::grid()->getAllFieldNames()); |
|
86 | - |
|
87 | - return $view->render(); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * @return array |
|
92 | - */ |
|
93 | - protected function getExcludedFieldsFromTca() |
|
94 | - { |
|
95 | - $tca = Tca::grid()->getTca(); |
|
96 | - $excludedFields = []; |
|
97 | - if (!empty($tca['excluded_fields'])) { |
|
98 | - $excludedFields = GeneralUtility::trimExplode(',', $tca['excluded_fields'], true); |
|
99 | - } elseif (!empty($tca['export']['excluded_fields'])) { // only for export for legacy reason. |
|
100 | - $excludedFields = GeneralUtility::trimExplode(',', $tca['export']['excluded_fields'], true); |
|
101 | - } |
|
102 | - return $excludedFields; |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * Tell whether the tools should be displayed according to the context. |
|
107 | - * |
|
108 | - * @return bool |
|
109 | - */ |
|
110 | - public function isShown() |
|
111 | - { |
|
112 | - return $this->getBackendUser()->isAdmin(); |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Get the Vidi Module Loader. |
|
117 | - * |
|
118 | - * @return ModuleLoader|object |
|
119 | - */ |
|
120 | - protected function getModuleLoader() |
|
121 | - { |
|
122 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * @return ModulePreferences|object |
|
127 | - */ |
|
128 | - protected function getModulePreferences() |
|
129 | - { |
|
130 | - return GeneralUtility::makeInstance(ModulePreferences::class); |
|
131 | - } |
|
132 | - |
|
133 | - /** |
|
134 | - * Get the Vidi Module Loader. |
|
135 | - * |
|
136 | - * @return GridAnalyserService|object |
|
137 | - */ |
|
138 | - protected function getGridAnalyserService() |
|
139 | - { |
|
140 | - return GeneralUtility::makeInstance(GridAnalyserService::class); |
|
141 | - } |
|
25 | + /** |
|
26 | + * Display the title of the tool on the welcome screen. |
|
27 | + * |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function getTitle() |
|
31 | + { |
|
32 | + return LocalizationUtility::translate( |
|
33 | + 'module_preferences_for', |
|
34 | + 'vidi', |
|
35 | + array(Tca::table($this->getModuleLoader()->getDataType())->getTitle()) |
|
36 | + ); |
|
37 | + } |
|
38 | + |
|
39 | + /** |
|
40 | + * Display the description of the tool in the welcome screen. |
|
41 | + * |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function getDescription() |
|
45 | + { |
|
46 | + $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ModulePreferences/Launcher.html'; |
|
47 | + $view = $this->initializeStandaloneView($templateNameAndPath); |
|
48 | + $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
49 | + return $view->render(); |
|
50 | + } |
|
51 | + |
|
52 | + /** |
|
53 | + * Do the job! |
|
54 | + * |
|
55 | + * @param array $arguments |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function work(array $arguments = array()) |
|
59 | + { |
|
60 | + if (isset($arguments['save'])) { |
|
61 | + // Revert visible <-> excluded |
|
62 | + $excludedFields = array_diff( |
|
63 | + Tca::grid()->getAllFieldNames(), |
|
64 | + $arguments['excluded_fields'], |
|
65 | + $this->getExcludedFieldsFromTca() |
|
66 | + ); |
|
67 | + $arguments['excluded_fields'] = $excludedFields; |
|
68 | + $this->getModulePreferences()->save($arguments); |
|
69 | + } |
|
70 | + |
|
71 | + $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ModulePreferences/WorkResult.html'; |
|
72 | + $view = $this->initializeStandaloneView($templateNameAndPath); |
|
73 | + |
|
74 | + $view->assign('title', Tca::table($this->getModuleLoader()->getDataType())->getTitle()); |
|
75 | + |
|
76 | + // Fetch the menu of visible items. |
|
77 | + $menuVisibleItems = $this->getModulePreferences()->get(ConfigurablePart::MENU_VISIBLE_ITEMS); |
|
78 | + $view->assign(ConfigurablePart::MENU_VISIBLE_ITEMS, $menuVisibleItems); |
|
79 | + |
|
80 | + // Fetch the default number of menu visible items. |
|
81 | + $menuDefaultVisible = $this->getModulePreferences()->get(ConfigurablePart::MENU_VISIBLE_ITEMS_DEFAULT); |
|
82 | + $view->assign(ConfigurablePart::MENU_VISIBLE_ITEMS_DEFAULT, $menuDefaultVisible); |
|
83 | + |
|
84 | + // Get the visible columns |
|
85 | + $view->assign('columns', Tca::grid()->getAllFieldNames()); |
|
86 | + |
|
87 | + return $view->render(); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * @return array |
|
92 | + */ |
|
93 | + protected function getExcludedFieldsFromTca() |
|
94 | + { |
|
95 | + $tca = Tca::grid()->getTca(); |
|
96 | + $excludedFields = []; |
|
97 | + if (!empty($tca['excluded_fields'])) { |
|
98 | + $excludedFields = GeneralUtility::trimExplode(',', $tca['excluded_fields'], true); |
|
99 | + } elseif (!empty($tca['export']['excluded_fields'])) { // only for export for legacy reason. |
|
100 | + $excludedFields = GeneralUtility::trimExplode(',', $tca['export']['excluded_fields'], true); |
|
101 | + } |
|
102 | + return $excludedFields; |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * Tell whether the tools should be displayed according to the context. |
|
107 | + * |
|
108 | + * @return bool |
|
109 | + */ |
|
110 | + public function isShown() |
|
111 | + { |
|
112 | + return $this->getBackendUser()->isAdmin(); |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Get the Vidi Module Loader. |
|
117 | + * |
|
118 | + * @return ModuleLoader|object |
|
119 | + */ |
|
120 | + protected function getModuleLoader() |
|
121 | + { |
|
122 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * @return ModulePreferences|object |
|
127 | + */ |
|
128 | + protected function getModulePreferences() |
|
129 | + { |
|
130 | + return GeneralUtility::makeInstance(ModulePreferences::class); |
|
131 | + } |
|
132 | + |
|
133 | + /** |
|
134 | + * Get the Vidi Module Loader. |
|
135 | + * |
|
136 | + * @return GridAnalyserService|object |
|
137 | + */ |
|
138 | + protected function getGridAnalyserService() |
|
139 | + { |
|
140 | + return GeneralUtility::makeInstance(GridAnalyserService::class); |
|
141 | + } |
|
142 | 142 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | { |
41 | 41 | $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/RelationAnalyser/Launcher.html'; |
42 | 42 | $view = $this->initializeStandaloneView($templateNameAndPath); |
43 | - $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
43 | + $view->assign('sitePath', Environment::getPublicPath().'/'); |
|
44 | 44 | $view->assign('dataType', $this->getModuleLoader()->getDataType()); |
45 | 45 | return $view->render(); |
46 | 46 | } |
@@ -19,86 +19,86 @@ |
||
19 | 19 | */ |
20 | 20 | class RelationAnalyserTool extends AbstractTool |
21 | 21 | { |
22 | - /** |
|
23 | - * Display the title of the tool on the welcome screen. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function getTitle(): string |
|
28 | - { |
|
29 | - return LocalizationUtility::translate( |
|
30 | - 'analyse_relations', |
|
31 | - 'vidi' |
|
32 | - ); |
|
33 | - } |
|
22 | + /** |
|
23 | + * Display the title of the tool on the welcome screen. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function getTitle(): string |
|
28 | + { |
|
29 | + return LocalizationUtility::translate( |
|
30 | + 'analyse_relations', |
|
31 | + 'vidi' |
|
32 | + ); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * Display the description of the tool in the welcome screen. |
|
37 | - * |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function getDescription(): string |
|
41 | - { |
|
42 | - $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/RelationAnalyser/Launcher.html'; |
|
43 | - $view = $this->initializeStandaloneView($templateNameAndPath); |
|
44 | - $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
45 | - $view->assign('dataType', $this->getModuleLoader()->getDataType()); |
|
46 | - return $view->render(); |
|
47 | - } |
|
35 | + /** |
|
36 | + * Display the description of the tool in the welcome screen. |
|
37 | + * |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function getDescription(): string |
|
41 | + { |
|
42 | + $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/RelationAnalyser/Launcher.html'; |
|
43 | + $view = $this->initializeStandaloneView($templateNameAndPath); |
|
44 | + $view->assign('sitePath', Environment::getPublicPath() . '/'); |
|
45 | + $view->assign('dataType', $this->getModuleLoader()->getDataType()); |
|
46 | + return $view->render(); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Do the job |
|
51 | - * |
|
52 | - * @param array $arguments |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function work(array $arguments = array()): string |
|
56 | - { |
|
57 | - $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/RelationAnalyser/WorkResult.html'; |
|
58 | - $view = $this->initializeStandaloneView($templateNameAndPath); |
|
49 | + /** |
|
50 | + * Do the job |
|
51 | + * |
|
52 | + * @param array $arguments |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function work(array $arguments = array()): string |
|
56 | + { |
|
57 | + $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/RelationAnalyser/WorkResult.html'; |
|
58 | + $view = $this->initializeStandaloneView($templateNameAndPath); |
|
59 | 59 | |
60 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
61 | - $analyse = $this->getGridAnalyserService()->checkRelationForTable($dataType); |
|
60 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
61 | + $analyse = $this->getGridAnalyserService()->checkRelationForTable($dataType); |
|
62 | 62 | |
63 | - if (empty($analyse)) { |
|
64 | - $result = 'No relation involved in this Grid.'; |
|
65 | - } else { |
|
66 | - $result = implode("\n", $analyse); |
|
67 | - } |
|
63 | + if (empty($analyse)) { |
|
64 | + $result = 'No relation involved in this Grid.'; |
|
65 | + } else { |
|
66 | + $result = implode("\n", $analyse); |
|
67 | + } |
|
68 | 68 | |
69 | - $view->assign('result', $result); |
|
70 | - $view->assign('dataType', $dataType); |
|
69 | + $view->assign('result', $result); |
|
70 | + $view->assign('dataType', $dataType); |
|
71 | 71 | |
72 | - return $view->render(); |
|
73 | - } |
|
72 | + return $view->render(); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Tell whether the tools should be displayed according to the context. |
|
77 | - * |
|
78 | - * @return bool |
|
79 | - */ |
|
80 | - public function isShown(): bool |
|
81 | - { |
|
82 | - return $this->getBackendUser()->isAdmin(); |
|
83 | - } |
|
75 | + /** |
|
76 | + * Tell whether the tools should be displayed according to the context. |
|
77 | + * |
|
78 | + * @return bool |
|
79 | + */ |
|
80 | + public function isShown(): bool |
|
81 | + { |
|
82 | + return $this->getBackendUser()->isAdmin(); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * Get the Vidi Module Loader. |
|
87 | - * |
|
88 | - * @return ModuleLoader|object |
|
89 | - */ |
|
90 | - protected function getModuleLoader(): ModuleLoader |
|
91 | - { |
|
92 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
93 | - } |
|
85 | + /** |
|
86 | + * Get the Vidi Module Loader. |
|
87 | + * |
|
88 | + * @return ModuleLoader|object |
|
89 | + */ |
|
90 | + protected function getModuleLoader(): ModuleLoader |
|
91 | + { |
|
92 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
93 | + } |
|
94 | 94 | |
95 | - /** |
|
96 | - * Get the Vidi Module Loader. |
|
97 | - * |
|
98 | - * @return GridAnalyserService|object |
|
99 | - */ |
|
100 | - protected function getGridAnalyserService() |
|
101 | - { |
|
102 | - return GeneralUtility::makeInstance(GridAnalyserService::class); |
|
103 | - } |
|
95 | + /** |
|
96 | + * Get the Vidi Module Loader. |
|
97 | + * |
|
98 | + * @return GridAnalyserService|object |
|
99 | + */ |
|
100 | + protected function getGridAnalyserService() |
|
101 | + { |
|
102 | + return GeneralUtility::makeInstance(GridAnalyserService::class); |
|
103 | + } |
|
104 | 104 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ConfiguredPid/Launcher.html'; |
43 | 43 | $view = $this->initializeStandaloneView($templateNameAndPath); |
44 | 44 | $view->assignMultiple([ |
45 | - 'sitePath' => Environment::getPublicPath() . '/', |
|
45 | + 'sitePath' => Environment::getPublicPath().'/', |
|
46 | 46 | 'dataType' => $this->getModuleLoader()->getDataType(), |
47 | 47 | 'configuredPid' => $this->getModulePidService()->getConfiguredNewRecordPid(), |
48 | 48 | 'errors' => $this->getModulePidService()->validateConfiguredPid(), |
@@ -19,76 +19,76 @@ |
||
19 | 19 | */ |
20 | 20 | class ConfiguredPidTool extends AbstractTool |
21 | 21 | { |
22 | - /** |
|
23 | - * Display the title of the tool on the welcome screen. |
|
24 | - * |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function getTitle(): string |
|
28 | - { |
|
29 | - return sprintf( |
|
30 | - '%s (%s)', |
|
31 | - LocalizationUtility::translate('tool.configured_pid', 'vidi'), |
|
32 | - $this->getModulePidService()->getConfiguredNewRecordPid() |
|
33 | - ); |
|
34 | - } |
|
22 | + /** |
|
23 | + * Display the title of the tool on the welcome screen. |
|
24 | + * |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function getTitle(): string |
|
28 | + { |
|
29 | + return sprintf( |
|
30 | + '%s (%s)', |
|
31 | + LocalizationUtility::translate('tool.configured_pid', 'vidi'), |
|
32 | + $this->getModulePidService()->getConfiguredNewRecordPid() |
|
33 | + ); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Display the description of the tool in the welcome screen. |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function getDescription(): string |
|
42 | - { |
|
43 | - $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ConfiguredPid/Launcher.html'; |
|
44 | - $view = $this->initializeStandaloneView($templateNameAndPath); |
|
45 | - $view->assignMultiple([ |
|
46 | - 'sitePath' => Environment::getPublicPath() . '/', |
|
47 | - 'dataType' => $this->getModuleLoader()->getDataType(), |
|
48 | - 'configuredPid' => $this->getModulePidService()->getConfiguredNewRecordPid(), |
|
49 | - 'errors' => $this->getModulePidService()->validateConfiguredPid(), |
|
50 | - ]); |
|
36 | + /** |
|
37 | + * Display the description of the tool in the welcome screen. |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function getDescription(): string |
|
42 | + { |
|
43 | + $templateNameAndPath = 'EXT:vidi/Resources/Private/Standalone/Tool/ConfiguredPid/Launcher.html'; |
|
44 | + $view = $this->initializeStandaloneView($templateNameAndPath); |
|
45 | + $view->assignMultiple([ |
|
46 | + 'sitePath' => Environment::getPublicPath() . '/', |
|
47 | + 'dataType' => $this->getModuleLoader()->getDataType(), |
|
48 | + 'configuredPid' => $this->getModulePidService()->getConfiguredNewRecordPid(), |
|
49 | + 'errors' => $this->getModulePidService()->validateConfiguredPid(), |
|
50 | + ]); |
|
51 | 51 | |
52 | - return $view->render(); |
|
53 | - } |
|
52 | + return $view->render(); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * Do the job |
|
57 | - * |
|
58 | - * @param array $arguments |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function work(array $arguments = array()): string |
|
62 | - { |
|
63 | - return ''; |
|
64 | - } |
|
55 | + /** |
|
56 | + * Do the job |
|
57 | + * |
|
58 | + * @param array $arguments |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function work(array $arguments = array()): string |
|
62 | + { |
|
63 | + return ''; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Tell whether the tools should be displayed according to the context. |
|
68 | - * |
|
69 | - * @return bool |
|
70 | - */ |
|
71 | - public function isShown(): bool |
|
72 | - { |
|
73 | - return $this->getBackendUser()->isAdmin(); |
|
74 | - } |
|
66 | + /** |
|
67 | + * Tell whether the tools should be displayed according to the context. |
|
68 | + * |
|
69 | + * @return bool |
|
70 | + */ |
|
71 | + public function isShown(): bool |
|
72 | + { |
|
73 | + return $this->getBackendUser()->isAdmin(); |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * Get the Vidi Module Loader. |
|
78 | - * |
|
79 | - * @return ModuleLoader|object |
|
80 | - */ |
|
81 | - protected function getModuleLoader(): ModuleLoader |
|
82 | - { |
|
83 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
84 | - } |
|
76 | + /** |
|
77 | + * Get the Vidi Module Loader. |
|
78 | + * |
|
79 | + * @return ModuleLoader|object |
|
80 | + */ |
|
81 | + protected function getModuleLoader(): ModuleLoader |
|
82 | + { |
|
83 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
84 | + } |
|
85 | 85 | |
86 | - /** |
|
87 | - * @return ModulePidService|object |
|
88 | - */ |
|
89 | - public function getModulePidService() |
|
90 | - { |
|
91 | - /** @var ModulePidService $modulePidService */ |
|
92 | - return GeneralUtility::makeInstance(ModulePidService::class); |
|
93 | - } |
|
86 | + /** |
|
87 | + * @return ModulePidService|object |
|
88 | + */ |
|
89 | + public function getModulePidService() |
|
90 | + { |
|
91 | + /** @var ModulePidService $modulePidService */ |
|
92 | + return GeneralUtility::makeInstance(ModulePidService::class); |
|
93 | + } |
|
94 | 94 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $pageRenderer->addJsInlineCode('vidi-inline', $content); |
34 | 34 | |
35 | 35 | $publicResourcesPath = PathUtility::getPublicResourceWebPath('EXT:vidi/Resources/Public/'); |
36 | - $configuration['paths']['Fab/Vidi'] = $publicResourcesPath . 'JavaScript'; |
|
36 | + $configuration['paths']['Fab/Vidi'] = $publicResourcesPath.'JavaScript'; |
|
37 | 37 | $pageRenderer->addRequireJsConfiguration($configuration); |
38 | 38 | $pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main'); |
39 | 39 | } |
@@ -19,21 +19,21 @@ |
||
19 | 19 | */ |
20 | 20 | class RequireJsViewHelper extends AbstractBackendViewHelper |
21 | 21 | { |
22 | - /** |
|
23 | - * Load RequireJS code. |
|
24 | - * |
|
25 | - * @return void |
|
26 | - */ |
|
27 | - public function render() |
|
28 | - { |
|
29 | - $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
22 | + /** |
|
23 | + * Load RequireJS code. |
|
24 | + * |
|
25 | + * @return void |
|
26 | + */ |
|
27 | + public function render() |
|
28 | + { |
|
29 | + $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); |
|
30 | 30 | |
31 | - $content = $this->renderChildren(); |
|
32 | - $pageRenderer->addJsInlineCode('vidi-inline', $content); |
|
31 | + $content = $this->renderChildren(); |
|
32 | + $pageRenderer->addJsInlineCode('vidi-inline', $content); |
|
33 | 33 | |
34 | - $publicResourcesPath = PathUtility::getPublicResourceWebPath('EXT:vidi/Resources/Public/'); |
|
35 | - $configuration['paths']['Fab/Vidi'] = $publicResourcesPath . 'JavaScript'; |
|
36 | - $pageRenderer->addRequireJsConfiguration($configuration); |
|
37 | - $pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main'); |
|
38 | - } |
|
34 | + $publicResourcesPath = PathUtility::getPublicResourceWebPath('EXT:vidi/Resources/Public/'); |
|
35 | + $configuration['paths']['Fab/Vidi'] = $publicResourcesPath . 'JavaScript'; |
|
36 | + $pageRenderer->addRequireJsConfiguration($configuration); |
|
37 | + $pageRenderer->loadRequireJsModule('Fab/Vidi/Vidi/Main'); |
|
38 | + } |
|
39 | 39 | } |
@@ -103,7 +103,7 @@ |
||
103 | 103 | $response->withHeader('Expires', '0'); |
104 | 104 | $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
105 | 105 | $response->withHeader('Content-Type', 'application/vnd.ms-excel'); |
106 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
106 | + $response->withHeader('Content-Disposition', 'attachment; filename="'.basename($this->exportFileNameAndPath).'"'); |
|
107 | 107 | $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
108 | 108 | $response->withHeader('Content-Description', 'File Transfer'); |
109 | 109 | $response->withHeader('Content-Transfer-Encoding', 'binary'); |
@@ -18,91 +18,91 @@ |
||
18 | 18 | */ |
19 | 19 | class ToXlsViewHelper extends AbstractToFormatViewHelper |
20 | 20 | { |
21 | - /** |
|
22 | - * Render a XLS export request. |
|
23 | - * |
|
24 | - */ |
|
25 | - public function render() |
|
26 | - { |
|
27 | - $objects = $this->templateVariableContainer->get('objects'); |
|
28 | - |
|
29 | - // Make sure we have something to process... |
|
30 | - if (!empty($objects)) { |
|
31 | - // Initialization step. |
|
32 | - $this->initializeEnvironment($objects); |
|
33 | - $this->exportFileNameAndPath .= '.xls'; // add extension to the file. |
|
34 | - |
|
35 | - // Write the exported data to a CSV file. |
|
36 | - $this->writeXlsFile($objects); |
|
37 | - |
|
38 | - // We must generate a zip archive since there are files included. |
|
39 | - if ($this->hasCollectedFiles()) { |
|
40 | - $this->writeZipFile(); |
|
41 | - $this->sendZipHttpHeaders(); |
|
42 | - |
|
43 | - readfile($this->zipFileNameAndPath); |
|
44 | - } else { |
|
45 | - $this->sendXlsHttpHeaders(); |
|
46 | - readfile($this->exportFileNameAndPath); |
|
47 | - } |
|
48 | - |
|
49 | - GeneralUtility::rmdir($this->temporaryDirectory, true); |
|
50 | - } |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Write the CSV file to a temporary location. |
|
55 | - * |
|
56 | - * @param array $objects |
|
57 | - * @return void |
|
58 | - */ |
|
59 | - protected function writeXlsFile(array $objects) |
|
60 | - { |
|
61 | - /** @var SpreadSheetService $spreadSheet */ |
|
62 | - $spreadSheet = GeneralUtility::makeInstance(SpreadSheetService::class); |
|
63 | - |
|
64 | - // Handle object header, get the first object and get the list of fields. |
|
65 | - /** @var Content $object */ |
|
66 | - $object = reset($objects); |
|
67 | - $spreadSheet->addRow($object->toFields()); |
|
68 | - |
|
69 | - $this->checkWhetherObjectMayIncludeFiles($object); |
|
70 | - |
|
71 | - foreach ($objects as $object) { |
|
72 | - if ($this->hasFileFields()) { |
|
73 | - $this->collectFiles($object); |
|
74 | - } |
|
75 | - |
|
76 | - // Make sure we have a flat array of values for the CSV purpose. |
|
77 | - $flattenValues = []; |
|
78 | - foreach ($object->toValues() as $fieldName => $value) { |
|
79 | - if (is_array($value)) { |
|
80 | - $flattenValues[$fieldName] = implode(', ', $value); |
|
81 | - } else { |
|
82 | - $flattenValues[$fieldName] = $value; |
|
83 | - } |
|
84 | - } |
|
85 | - |
|
86 | - $spreadSheet->addRow($flattenValues); |
|
87 | - } |
|
88 | - |
|
89 | - file_put_contents($this->exportFileNameAndPath, $spreadSheet->toString()); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @return void |
|
94 | - */ |
|
95 | - protected function sendXlsHttpHeaders() |
|
96 | - { |
|
97 | - /** @var Response $response */ |
|
98 | - $response = $this->templateVariableContainer->get('response'); |
|
99 | - $response->withHeader('Pragma', 'public'); |
|
100 | - $response->withHeader('Expires', '0'); |
|
101 | - $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
|
102 | - $response->withHeader('Content-Type', 'application/vnd.ms-excel'); |
|
103 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
104 | - $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
|
105 | - $response->withHeader('Content-Description', 'File Transfer'); |
|
106 | - $response->withHeader('Content-Transfer-Encoding', 'binary'); |
|
107 | - } |
|
21 | + /** |
|
22 | + * Render a XLS export request. |
|
23 | + * |
|
24 | + */ |
|
25 | + public function render() |
|
26 | + { |
|
27 | + $objects = $this->templateVariableContainer->get('objects'); |
|
28 | + |
|
29 | + // Make sure we have something to process... |
|
30 | + if (!empty($objects)) { |
|
31 | + // Initialization step. |
|
32 | + $this->initializeEnvironment($objects); |
|
33 | + $this->exportFileNameAndPath .= '.xls'; // add extension to the file. |
|
34 | + |
|
35 | + // Write the exported data to a CSV file. |
|
36 | + $this->writeXlsFile($objects); |
|
37 | + |
|
38 | + // We must generate a zip archive since there are files included. |
|
39 | + if ($this->hasCollectedFiles()) { |
|
40 | + $this->writeZipFile(); |
|
41 | + $this->sendZipHttpHeaders(); |
|
42 | + |
|
43 | + readfile($this->zipFileNameAndPath); |
|
44 | + } else { |
|
45 | + $this->sendXlsHttpHeaders(); |
|
46 | + readfile($this->exportFileNameAndPath); |
|
47 | + } |
|
48 | + |
|
49 | + GeneralUtility::rmdir($this->temporaryDirectory, true); |
|
50 | + } |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Write the CSV file to a temporary location. |
|
55 | + * |
|
56 | + * @param array $objects |
|
57 | + * @return void |
|
58 | + */ |
|
59 | + protected function writeXlsFile(array $objects) |
|
60 | + { |
|
61 | + /** @var SpreadSheetService $spreadSheet */ |
|
62 | + $spreadSheet = GeneralUtility::makeInstance(SpreadSheetService::class); |
|
63 | + |
|
64 | + // Handle object header, get the first object and get the list of fields. |
|
65 | + /** @var Content $object */ |
|
66 | + $object = reset($objects); |
|
67 | + $spreadSheet->addRow($object->toFields()); |
|
68 | + |
|
69 | + $this->checkWhetherObjectMayIncludeFiles($object); |
|
70 | + |
|
71 | + foreach ($objects as $object) { |
|
72 | + if ($this->hasFileFields()) { |
|
73 | + $this->collectFiles($object); |
|
74 | + } |
|
75 | + |
|
76 | + // Make sure we have a flat array of values for the CSV purpose. |
|
77 | + $flattenValues = []; |
|
78 | + foreach ($object->toValues() as $fieldName => $value) { |
|
79 | + if (is_array($value)) { |
|
80 | + $flattenValues[$fieldName] = implode(', ', $value); |
|
81 | + } else { |
|
82 | + $flattenValues[$fieldName] = $value; |
|
83 | + } |
|
84 | + } |
|
85 | + |
|
86 | + $spreadSheet->addRow($flattenValues); |
|
87 | + } |
|
88 | + |
|
89 | + file_put_contents($this->exportFileNameAndPath, $spreadSheet->toString()); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @return void |
|
94 | + */ |
|
95 | + protected function sendXlsHttpHeaders() |
|
96 | + { |
|
97 | + /** @var Response $response */ |
|
98 | + $response = $this->templateVariableContainer->get('response'); |
|
99 | + $response->withHeader('Pragma', 'public'); |
|
100 | + $response->withHeader('Expires', '0'); |
|
101 | + $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
|
102 | + $response->withHeader('Content-Type', 'application/vnd.ms-excel'); |
|
103 | + $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
104 | + $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
|
105 | + $response->withHeader('Content-Description', 'File Transfer'); |
|
106 | + $response->withHeader('Content-Transfer-Encoding', 'binary'); |
|
107 | + } |
|
108 | 108 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | use Fab\Vidi\Domain\Model\Content; |
18 | 18 | use Fab\Vidi\Tests\Functional\AbstractFunctionalTestCase; |
19 | 19 | |
20 | -require_once dirname(dirname(__FILE__)) . '/AbstractFunctionalTestCase.php'; |
|
20 | +require_once dirname(dirname(__FILE__)).'/AbstractFunctionalTestCase.php'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Test case for class \Fab\Vidi\Grid\CategoryRenderer. |
@@ -25,42 +25,42 @@ |
||
25 | 25 | */ |
26 | 26 | class RelationRendererTest extends AbstractFunctionalTestCase |
27 | 27 | { |
28 | - /** |
|
29 | - * @var RelationRenderer |
|
30 | - */ |
|
31 | - private $fixture; |
|
28 | + /** |
|
29 | + * @var RelationRenderer |
|
30 | + */ |
|
31 | + private $fixture; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - private $dataType = 'fe_users'; |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + private $dataType = 'fe_users'; |
|
37 | 37 | |
38 | - /** |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - private $moduleCode = 'user_VidiFeUsersM1'; |
|
38 | + /** |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + private $moduleCode = 'user_VidiFeUsersM1'; |
|
42 | 42 | |
43 | - public function setUp() |
|
44 | - { |
|
45 | - parent::setUp(); |
|
46 | - $moduleLoader = new ModuleLoader($this->dataType); |
|
47 | - $moduleLoader->register(); |
|
48 | - $GLOBALS['_GET']['M'] = $this->moduleCode; |
|
49 | - $this->fixture = new RelationRenderer(); |
|
50 | - } |
|
43 | + public function setUp() |
|
44 | + { |
|
45 | + parent::setUp(); |
|
46 | + $moduleLoader = new ModuleLoader($this->dataType); |
|
47 | + $moduleLoader->register(); |
|
48 | + $GLOBALS['_GET']['M'] = $this->moduleCode; |
|
49 | + $this->fixture = new RelationRenderer(); |
|
50 | + } |
|
51 | 51 | |
52 | - public function tearDown() |
|
53 | - { |
|
54 | - unset($this->fixture, $GLOBALS['_GET']['M']); |
|
55 | - } |
|
52 | + public function tearDown() |
|
53 | + { |
|
54 | + unset($this->fixture, $GLOBALS['_GET']['M']); |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * @test |
|
59 | - */ |
|
60 | - public function renderAssetWithNoCategoryReturnsEmpty() |
|
61 | - { |
|
62 | - $content = new Content($this->dataType); |
|
63 | - $this->markTestIncomplete(); # TCA must be faked |
|
64 | - #$actual = $this->fixture->setObject($content)->render(); |
|
65 | - } |
|
57 | + /** |
|
58 | + * @test |
|
59 | + */ |
|
60 | + public function renderAssetWithNoCategoryReturnsEmpty() |
|
61 | + { |
|
62 | + $content = new Content($this->dataType); |
|
63 | + $this->markTestIncomplete(); # TCA must be faked |
|
64 | + #$actual = $this->fixture->setObject($content)->render(); |
|
65 | + } |
|
66 | 66 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | use Fab\Vidi\Domain\Model\Selection; |
5 | 5 | |
6 | 6 | return [ |
7 | - Selection::class => [ |
|
8 | - 'tableName' => 'tx_vidi_selection', |
|
9 | - ], |
|
7 | + Selection::class => [ |
|
8 | + 'tableName' => 'tx_vidi_selection', |
|
9 | + ], |
|
10 | 10 | ]; |
@@ -123,7 +123,7 @@ |
||
123 | 123 | /** @var Response $response */ |
124 | 124 | $response = $this->templateVariableContainer->get('response'); |
125 | 125 | $response->withHeader('Content-Type', 'application/xml'); |
126 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
126 | + $response->withHeader('Content-Disposition', 'attachment; filename="'.basename($this->exportFileNameAndPath).'"'); |
|
127 | 127 | $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
128 | 128 | $response->withHeader('Content-Description', 'File Transfer'); |
129 | 129 | } |
@@ -17,109 +17,109 @@ |
||
17 | 17 | */ |
18 | 18 | class ToXmlViewHelper extends AbstractToFormatViewHelper |
19 | 19 | { |
20 | - /** |
|
21 | - * Render an XML export. |
|
22 | - * |
|
23 | - */ |
|
24 | - public function render() |
|
25 | - { |
|
26 | - $objects = $this->templateVariableContainer->get('objects'); |
|
20 | + /** |
|
21 | + * Render an XML export. |
|
22 | + * |
|
23 | + */ |
|
24 | + public function render() |
|
25 | + { |
|
26 | + $objects = $this->templateVariableContainer->get('objects'); |
|
27 | 27 | |
28 | - // Make sure we have something to process... |
|
29 | - if (!empty($objects)) { |
|
30 | - // Initialization step. |
|
31 | - $this->initializeEnvironment($objects); |
|
32 | - $this->exportFileNameAndPath .= '.xml'; // add extension to the file. |
|
28 | + // Make sure we have something to process... |
|
29 | + if (!empty($objects)) { |
|
30 | + // Initialization step. |
|
31 | + $this->initializeEnvironment($objects); |
|
32 | + $this->exportFileNameAndPath .= '.xml'; // add extension to the file. |
|
33 | 33 | |
34 | - // Write the exported data to a XML file. |
|
35 | - $this->writeXmlFile($objects); |
|
34 | + // Write the exported data to a XML file. |
|
35 | + $this->writeXmlFile($objects); |
|
36 | 36 | |
37 | - // We must generate a zip archive since there are files included. |
|
38 | - if ($this->hasCollectedFiles()) { |
|
39 | - $this->writeZipFile(); |
|
40 | - $this->sendZipHttpHeaders(); |
|
37 | + // We must generate a zip archive since there are files included. |
|
38 | + if ($this->hasCollectedFiles()) { |
|
39 | + $this->writeZipFile(); |
|
40 | + $this->sendZipHttpHeaders(); |
|
41 | 41 | |
42 | - readfile($this->zipFileNameAndPath); |
|
43 | - } else { |
|
44 | - $this->sendXmlHttpHeaders(); |
|
45 | - readfile($this->exportFileNameAndPath); |
|
46 | - } |
|
42 | + readfile($this->zipFileNameAndPath); |
|
43 | + } else { |
|
44 | + $this->sendXmlHttpHeaders(); |
|
45 | + readfile($this->exportFileNameAndPath); |
|
46 | + } |
|
47 | 47 | |
48 | - GeneralUtility::rmdir($this->temporaryDirectory, true); |
|
49 | - } |
|
50 | - } |
|
48 | + GeneralUtility::rmdir($this->temporaryDirectory, true); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Write the XML file to a temporary location. |
|
54 | - * |
|
55 | - * @param array $objects |
|
56 | - * @return void |
|
57 | - */ |
|
58 | - protected function writeXmlFile(array $objects) |
|
59 | - { |
|
60 | - // Get first object of $objects to check whether it contains possible files to include. |
|
61 | - /** @var Content $object */ |
|
62 | - $object = reset($objects); |
|
63 | - $this->checkWhetherObjectMayIncludeFiles($object); |
|
52 | + /** |
|
53 | + * Write the XML file to a temporary location. |
|
54 | + * |
|
55 | + * @param array $objects |
|
56 | + * @return void |
|
57 | + */ |
|
58 | + protected function writeXmlFile(array $objects) |
|
59 | + { |
|
60 | + // Get first object of $objects to check whether it contains possible files to include. |
|
61 | + /** @var Content $object */ |
|
62 | + $object = reset($objects); |
|
63 | + $this->checkWhetherObjectMayIncludeFiles($object); |
|
64 | 64 | |
65 | - $items = []; |
|
66 | - foreach ($objects as $object) { |
|
67 | - if ($this->hasFileFields()) { |
|
68 | - $this->collectFiles($object); |
|
69 | - } |
|
70 | - $items[] = $object->toValues(); |
|
71 | - } |
|
65 | + $items = []; |
|
66 | + foreach ($objects as $object) { |
|
67 | + if ($this->hasFileFields()) { |
|
68 | + $this->collectFiles($object); |
|
69 | + } |
|
70 | + $items[] = $object->toValues(); |
|
71 | + } |
|
72 | 72 | |
73 | - $xml = new \SimpleXMLElement('<items/>'); |
|
74 | - $xml = $this->arrayToXml($items, $xml); |
|
75 | - file_put_contents($this->exportFileNameAndPath, $this->formatXml($xml->asXML())); |
|
76 | - } |
|
73 | + $xml = new \SimpleXMLElement('<items/>'); |
|
74 | + $xml = $this->arrayToXml($items, $xml); |
|
75 | + file_put_contents($this->exportFileNameAndPath, $this->formatXml($xml->asXML())); |
|
76 | + } |
|
77 | 77 | |
78 | - /* |
|
78 | + /* |
|
79 | 79 | * Convert an array to xml |
80 | 80 | * |
81 | 81 | * @return \SimpleXMLElement |
82 | 82 | */ |
83 | - protected function arrayToXml($array, \SimpleXMLElement $xml) |
|
84 | - { |
|
85 | - foreach ($array as $key => $value) { |
|
86 | - if (is_array($value)) { |
|
87 | - $key = is_numeric($key) ? 'item' : $key; |
|
88 | - $subNode = $xml->addChild($key); |
|
89 | - $this->arrayToXml($value, $subNode); |
|
90 | - } else { |
|
91 | - $key = is_numeric($key) ? 'item' : $key; |
|
92 | - $xml->addChild($key, "$value"); |
|
93 | - } |
|
94 | - } |
|
95 | - return $xml; |
|
96 | - } |
|
83 | + protected function arrayToXml($array, \SimpleXMLElement $xml) |
|
84 | + { |
|
85 | + foreach ($array as $key => $value) { |
|
86 | + if (is_array($value)) { |
|
87 | + $key = is_numeric($key) ? 'item' : $key; |
|
88 | + $subNode = $xml->addChild($key); |
|
89 | + $this->arrayToXml($value, $subNode); |
|
90 | + } else { |
|
91 | + $key = is_numeric($key) ? 'item' : $key; |
|
92 | + $xml->addChild($key, "$value"); |
|
93 | + } |
|
94 | + } |
|
95 | + return $xml; |
|
96 | + } |
|
97 | 97 | |
98 | - /* |
|
98 | + /* |
|
99 | 99 | * Format the XML so that is looks human friendly. |
100 | 100 | * |
101 | 101 | * @param string $xml |
102 | 102 | * @return string |
103 | 103 | */ |
104 | - protected function formatXml($xml) |
|
105 | - { |
|
106 | - $dom = new \DOMDocument("1.0"); |
|
107 | - $dom->preserveWhiteSpace = false; |
|
108 | - $dom->formatOutput = true; |
|
109 | - $dom->loadXML($xml); |
|
110 | - return $dom->saveXML(); |
|
111 | - } |
|
104 | + protected function formatXml($xml) |
|
105 | + { |
|
106 | + $dom = new \DOMDocument("1.0"); |
|
107 | + $dom->preserveWhiteSpace = false; |
|
108 | + $dom->formatOutput = true; |
|
109 | + $dom->loadXML($xml); |
|
110 | + return $dom->saveXML(); |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * @return void |
|
115 | - */ |
|
116 | - protected function sendXmlHttpHeaders() |
|
117 | - { |
|
118 | - /** @var Response $response */ |
|
119 | - $response = $this->templateVariableContainer->get('response'); |
|
120 | - $response->withHeader('Content-Type', 'application/xml'); |
|
121 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
122 | - $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
|
123 | - $response->withHeader('Content-Description', 'File Transfer'); |
|
124 | - } |
|
113 | + /** |
|
114 | + * @return void |
|
115 | + */ |
|
116 | + protected function sendXmlHttpHeaders() |
|
117 | + { |
|
118 | + /** @var Response $response */ |
|
119 | + $response = $this->templateVariableContainer->get('response'); |
|
120 | + $response->withHeader('Content-Type', 'application/xml'); |
|
121 | + $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"'); |
|
122 | + $response->withHeader('Content-Length', filesize($this->exportFileNameAndPath)); |
|
123 | + $response->withHeader('Content-Description', 'File Transfer'); |
|
124 | + } |
|
125 | 125 | } |
@@ -87,15 +87,15 @@ discard block |
||
87 | 87 | /** @var Content $object */ |
88 | 88 | $object = reset($objects); |
89 | 89 | |
90 | - $this->temporaryDirectory = Environment::getPublicPath() . '/typo3temp/' . uniqid() . '/'; |
|
90 | + $this->temporaryDirectory = Environment::getPublicPath().'/typo3temp/'.uniqid().'/'; |
|
91 | 91 | GeneralUtility::mkdir($this->temporaryDirectory); |
92 | 92 | |
93 | 93 | // Compute file name and path variable |
94 | - $this->exportFileNameAndPath = $this->temporaryDirectory . $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']); |
|
94 | + $this->exportFileNameAndPath = $this->temporaryDirectory.$object->getDataType().'-'.date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']); |
|
95 | 95 | |
96 | 96 | // Compute file name and path variable for zip |
97 | - $zipFileName = $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']) . '.zip'; |
|
98 | - $this->zipFileNameAndPath = $this->temporaryDirectory . $zipFileName; |
|
97 | + $zipFileName = $object->getDataType().'-'.date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']).'.zip'; |
|
98 | + $this->zipFileNameAndPath = $this->temporaryDirectory.$zipFileName; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $response->withHeader('Expires', '0'); |
164 | 164 | $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
165 | 165 | $response->withHeader('Content-Type', 'application/zip'); |
166 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->zipFileNameAndPath) . '"'); |
|
166 | + $response->withHeader('Content-Disposition', 'attachment; filename="'.basename($this->zipFileNameAndPath).'"'); |
|
167 | 167 | $response->withHeader('Content-Length', filesize($this->zipFileNameAndPath)); |
168 | 168 | $response->withHeader('Content-Description', 'File Transfer'); |
169 | 169 | $response->withHeader('Content-Transfer-Encoding', 'binary'); |
@@ -24,154 +24,154 @@ |
||
24 | 24 | */ |
25 | 25 | abstract class AbstractToFormatViewHelper extends AbstractViewHelper |
26 | 26 | { |
27 | - /** |
|
28 | - * Store fields of type "file". |
|
29 | - * |
|
30 | - * @var array |
|
31 | - */ |
|
32 | - protected $fileTypeProperties = []; |
|
33 | - |
|
34 | - /** |
|
35 | - * @var File[] |
|
36 | - */ |
|
37 | - protected $collectedFiles = []; |
|
38 | - |
|
39 | - /** |
|
40 | - * @var string |
|
41 | - */ |
|
42 | - protected $exportFileNameAndPath; |
|
43 | - |
|
44 | - /** |
|
45 | - * @var string |
|
46 | - */ |
|
47 | - protected $zipFileNameAndPath; |
|
48 | - |
|
49 | - /** |
|
50 | - * @var string |
|
51 | - */ |
|
52 | - protected $temporaryDirectory; |
|
53 | - |
|
54 | - |
|
55 | - /** |
|
56 | - * Write the zip file to a temporary location. |
|
57 | - * |
|
58 | - * @return void |
|
59 | - * @throws \RuntimeException |
|
60 | - */ |
|
61 | - protected function writeZipFile() |
|
62 | - { |
|
63 | - $zip = new \ZipArchive(); |
|
64 | - $zip->open($this->zipFileNameAndPath, \ZipArchive::CREATE); |
|
65 | - |
|
66 | - // Add the CSV content into the zipball. |
|
67 | - $zip->addFile($this->exportFileNameAndPath, basename($this->exportFileNameAndPath)); |
|
68 | - |
|
69 | - // Add the files into the zipball. |
|
70 | - foreach ($this->collectedFiles as $file) { |
|
71 | - $zip->addFile($file->getForLocalProcessing(false), $file->getIdentifier()); |
|
72 | - } |
|
73 | - |
|
74 | - $zip->close(); |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * Initialize some properties |
|
79 | - * |
|
80 | - * @param array $objects |
|
81 | - * @return void |
|
82 | - */ |
|
83 | - protected function initializeEnvironment(array $objects) |
|
84 | - { |
|
85 | - /** @var Content $object */ |
|
86 | - $object = reset($objects); |
|
87 | - |
|
88 | - $this->temporaryDirectory = Environment::getPublicPath() . '/typo3temp/' . uniqid() . '/'; |
|
89 | - GeneralUtility::mkdir($this->temporaryDirectory); |
|
90 | - |
|
91 | - // Compute file name and path variable |
|
92 | - $this->exportFileNameAndPath = $this->temporaryDirectory . $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']); |
|
93 | - |
|
94 | - // Compute file name and path variable for zip |
|
95 | - $zipFileName = $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']) . '.zip'; |
|
96 | - $this->zipFileNameAndPath = $this->temporaryDirectory . $zipFileName; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * Fetch the files given an object. |
|
101 | - * |
|
102 | - * @param Content $object |
|
103 | - * @return void |
|
104 | - */ |
|
105 | - protected function collectFiles(Content $object) |
|
106 | - { |
|
107 | - foreach ($this->fileTypeProperties as $property) { |
|
108 | - $files = FileReferenceService::getInstance()->findReferencedBy($property, $object); |
|
109 | - foreach ($files as $file) { |
|
110 | - $this->collectedFiles[$file->getUid()] = $file; |
|
111 | - } |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * Tells whether the object has fields containing files. |
|
117 | - * |
|
118 | - * @return boolean |
|
119 | - */ |
|
120 | - protected function hasCollectedFiles() |
|
121 | - { |
|
122 | - return !empty($this->collectedFiles); |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Tells whether the object has fields containing files. |
|
127 | - * |
|
128 | - * @return boolean |
|
129 | - */ |
|
130 | - protected function hasFileFields() |
|
131 | - { |
|
132 | - return !empty($this->fileTypeProperties); |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Check whether the given object is meant to include files in some fields. |
|
137 | - * |
|
138 | - * @param Content $object |
|
139 | - */ |
|
140 | - protected function checkWhetherObjectMayIncludeFiles(Content $object) |
|
141 | - { |
|
142 | - if (Tca::grid($object->getDataType())->areFilesIncludedInExport()) { |
|
143 | - foreach ($object->toFields() as $fieldName) { |
|
144 | - $fieldType = Tca::table($object->getDataType())->field($fieldName)->getType(); |
|
145 | - |
|
146 | - if ($fieldType === FieldType::FILE) { |
|
147 | - $this->fileTypeProperties[] = GeneralUtility::camelCaseToLowerCaseUnderscored($fieldName); |
|
148 | - } |
|
149 | - } |
|
150 | - } |
|
151 | - } |
|
152 | - |
|
153 | - /** |
|
154 | - * @return void |
|
155 | - */ |
|
156 | - protected function sendZipHttpHeaders() |
|
157 | - { |
|
158 | - /** @var Response $response */ |
|
159 | - $response = $this->templateVariableContainer->get('response'); |
|
160 | - $response->withHeader('Pragma', 'public'); |
|
161 | - $response->withHeader('Expires', '0'); |
|
162 | - $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
|
163 | - $response->withHeader('Content-Type', 'application/zip'); |
|
164 | - $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->zipFileNameAndPath) . '"'); |
|
165 | - $response->withHeader('Content-Length', filesize($this->zipFileNameAndPath)); |
|
166 | - $response->withHeader('Content-Description', 'File Transfer'); |
|
167 | - $response->withHeader('Content-Transfer-Encoding', 'binary'); |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * @return Rows|object |
|
172 | - */ |
|
173 | - protected function getRowsView() |
|
174 | - { |
|
175 | - return GeneralUtility::makeInstance(Rows::class); |
|
176 | - } |
|
27 | + /** |
|
28 | + * Store fields of type "file". |
|
29 | + * |
|
30 | + * @var array |
|
31 | + */ |
|
32 | + protected $fileTypeProperties = []; |
|
33 | + |
|
34 | + /** |
|
35 | + * @var File[] |
|
36 | + */ |
|
37 | + protected $collectedFiles = []; |
|
38 | + |
|
39 | + /** |
|
40 | + * @var string |
|
41 | + */ |
|
42 | + protected $exportFileNameAndPath; |
|
43 | + |
|
44 | + /** |
|
45 | + * @var string |
|
46 | + */ |
|
47 | + protected $zipFileNameAndPath; |
|
48 | + |
|
49 | + /** |
|
50 | + * @var string |
|
51 | + */ |
|
52 | + protected $temporaryDirectory; |
|
53 | + |
|
54 | + |
|
55 | + /** |
|
56 | + * Write the zip file to a temporary location. |
|
57 | + * |
|
58 | + * @return void |
|
59 | + * @throws \RuntimeException |
|
60 | + */ |
|
61 | + protected function writeZipFile() |
|
62 | + { |
|
63 | + $zip = new \ZipArchive(); |
|
64 | + $zip->open($this->zipFileNameAndPath, \ZipArchive::CREATE); |
|
65 | + |
|
66 | + // Add the CSV content into the zipball. |
|
67 | + $zip->addFile($this->exportFileNameAndPath, basename($this->exportFileNameAndPath)); |
|
68 | + |
|
69 | + // Add the files into the zipball. |
|
70 | + foreach ($this->collectedFiles as $file) { |
|
71 | + $zip->addFile($file->getForLocalProcessing(false), $file->getIdentifier()); |
|
72 | + } |
|
73 | + |
|
74 | + $zip->close(); |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * Initialize some properties |
|
79 | + * |
|
80 | + * @param array $objects |
|
81 | + * @return void |
|
82 | + */ |
|
83 | + protected function initializeEnvironment(array $objects) |
|
84 | + { |
|
85 | + /** @var Content $object */ |
|
86 | + $object = reset($objects); |
|
87 | + |
|
88 | + $this->temporaryDirectory = Environment::getPublicPath() . '/typo3temp/' . uniqid() . '/'; |
|
89 | + GeneralUtility::mkdir($this->temporaryDirectory); |
|
90 | + |
|
91 | + // Compute file name and path variable |
|
92 | + $this->exportFileNameAndPath = $this->temporaryDirectory . $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']); |
|
93 | + |
|
94 | + // Compute file name and path variable for zip |
|
95 | + $zipFileName = $object->getDataType() . '-' . date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']) . '.zip'; |
|
96 | + $this->zipFileNameAndPath = $this->temporaryDirectory . $zipFileName; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * Fetch the files given an object. |
|
101 | + * |
|
102 | + * @param Content $object |
|
103 | + * @return void |
|
104 | + */ |
|
105 | + protected function collectFiles(Content $object) |
|
106 | + { |
|
107 | + foreach ($this->fileTypeProperties as $property) { |
|
108 | + $files = FileReferenceService::getInstance()->findReferencedBy($property, $object); |
|
109 | + foreach ($files as $file) { |
|
110 | + $this->collectedFiles[$file->getUid()] = $file; |
|
111 | + } |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * Tells whether the object has fields containing files. |
|
117 | + * |
|
118 | + * @return boolean |
|
119 | + */ |
|
120 | + protected function hasCollectedFiles() |
|
121 | + { |
|
122 | + return !empty($this->collectedFiles); |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Tells whether the object has fields containing files. |
|
127 | + * |
|
128 | + * @return boolean |
|
129 | + */ |
|
130 | + protected function hasFileFields() |
|
131 | + { |
|
132 | + return !empty($this->fileTypeProperties); |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Check whether the given object is meant to include files in some fields. |
|
137 | + * |
|
138 | + * @param Content $object |
|
139 | + */ |
|
140 | + protected function checkWhetherObjectMayIncludeFiles(Content $object) |
|
141 | + { |
|
142 | + if (Tca::grid($object->getDataType())->areFilesIncludedInExport()) { |
|
143 | + foreach ($object->toFields() as $fieldName) { |
|
144 | + $fieldType = Tca::table($object->getDataType())->field($fieldName)->getType(); |
|
145 | + |
|
146 | + if ($fieldType === FieldType::FILE) { |
|
147 | + $this->fileTypeProperties[] = GeneralUtility::camelCaseToLowerCaseUnderscored($fieldName); |
|
148 | + } |
|
149 | + } |
|
150 | + } |
|
151 | + } |
|
152 | + |
|
153 | + /** |
|
154 | + * @return void |
|
155 | + */ |
|
156 | + protected function sendZipHttpHeaders() |
|
157 | + { |
|
158 | + /** @var Response $response */ |
|
159 | + $response = $this->templateVariableContainer->get('response'); |
|
160 | + $response->withHeader('Pragma', 'public'); |
|
161 | + $response->withHeader('Expires', '0'); |
|
162 | + $response->withHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0'); |
|
163 | + $response->withHeader('Content-Type', 'application/zip'); |
|
164 | + $response->withHeader('Content-Disposition', 'attachment; filename="' . basename($this->zipFileNameAndPath) . '"'); |
|
165 | + $response->withHeader('Content-Length', filesize($this->zipFileNameAndPath)); |
|
166 | + $response->withHeader('Content-Description', 'File Transfer'); |
|
167 | + $response->withHeader('Content-Transfer-Encoding', 'binary'); |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * @return Rows|object |
|
172 | + */ |
|
173 | + protected function getRowsView() |
|
174 | + { |
|
175 | + return GeneralUtility::makeInstance(Rows::class); |
|
176 | + } |
|
177 | 177 | } |