Completed
Push — master ( c66703...668741 )
by Fabien
03:49
created
ext_tables.php 1 patch
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -1,179 +1,179 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if (!defined('TYPO3_MODE')) {
4
-    die ('Access denied.');
4
+	die ('Access denied.');
5 5
 }
6 6
 
7 7
 // Check from Vidi configuration what default module should be loaded.
8 8
 // Make sure the class exists to avoid a Runtime Error
9 9
 if (TYPO3_MODE === 'BE') {
10 10
 
11
-    // Add content main module before 'user'
12
-    if (!isset($GLOBALS['TBE_MODULES']['content'])) {
13
-
14
-        // Position module "content" after module "user" manually. No API is available for that, it seems...
15
-        $modules = [];
16
-        foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
17
-            if ($key === 'user') {
18
-                $modules['content'] = '';
19
-            }
20
-            $modules[$key] = $val;
21
-        }
22
-        $GLOBALS['TBE_MODULES'] = $modules;
23
-
24
-        // Register "data management" module.
25
-        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
26
-            'content',
27
-            '',
28
-            '',
29
-            '',
30
-            [
31
-                'name' => 'content',
32
-                'access' => 'user,group',
33
-                'labels' => [
34
-                    'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf',
35
-                ],
36
-            ]
37
-        );
38
-    }
39
-
40
-    /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
41
-    $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
42
-
43
-    /** @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility $configurationUtility */
44
-    $configurationUtility = $objectManager->get('TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility');
45
-    $configuration = $configurationUtility->getCurrentConfiguration('vidi');
46
-
47
-    $pids = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configuration['default_pid']['value'], true);
48
-    $defaultPid = array_shift($pids);
49
-    $defaultPids = [];
50
-    foreach ($pids as $dataTypeAndPid) {
51
-        $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $dataTypeAndPid);
52
-        if (count($parts) === 2) {
53
-            $defaultPids[$parts[0]] = $parts[1];
54
-        }
55
-    }
56
-
57
-    // Loop around the data types and register them to be displayed within a BE module.
58
-    if ($configuration['data_types']['value']) {
59
-
60
-        $dataTypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configuration['data_types']['value'], true);
61
-        foreach ($dataTypes as $dataType) {
62
-
63
-            /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
64
-            $moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader', $dataType);
65
-
66
-            // Special case already defined in Vidi.
67
-            if ($dataType === 'fe_users') {
68
-                $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf';
69
-                $icon = 'EXT:core/Resources/Public/Icons/T3Icons/status/status-user-frontend.svg';
70
-                $icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg';
71
-            } elseif ($dataType === 'fe_groups') {
72
-                $languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf';
73
-                $icon = 'EXT:core/Resources/Public/Icons/T3Icons/status/status-user-group-frontend.svg';
74
-                $icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg';
75
-            } else {
76
-                /** @var \Fab\Vidi\Backend\LanguageFileGenerator $languageService */
77
-                $languageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Fab\Vidi\Backend\LanguageFileGenerator::class);
78
-                $languageFile = $languageService->generate($dataType);
79
-                $icon = '';
80
-            }
81
-
82
-            $pid = isset($defaultPids[$dataType]) ? $defaultPids[$dataType] : $defaultPid;
83
-
84
-            /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
85
-            $moduleLoader->setIcon($icon)
86
-                ->setModuleLanguageFile($languageFile)
87
-                ->setDefaultPid($pid)
88
-                ->register();
89
-        }
90
-    }
91
-
92
-    // Possible Static TS loading
93
-    if (true === isset($configuration['autoload_typoscript']['value']) && false === (bool)$configuration['autoload_typoscript']['value']) {
94
-        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display');
95
-    }
96
-
97
-    // Register List2 only if beta feature is enabled.
98
-    // @todo let see what we do with that
99
-    #if ($configuration['activate_beta_features']['value']) {
100
-    #	$labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf';
101
-    #
102
-    #	if (!$configuration['hide_module_list']['value']) {
103
-    #		$labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf';
104
-    #	}
105
-    #
106
-    #	\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
107
-    #		'vidi',
108
-    #		'web', // Make module a submodule of 'web'
109
-    #		'm1', // Submodule key
110
-    #		'after:list', // Position
111
-    #		array(
112
-    #			'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard',
113
-    #			'Tool' => 'welcome, work',
114
-    #			'Facet' => 'autoSuggest, autoSuggests',
115
-    #			'Selection' => 'edit, update, create, delete, list, show',
116
-    #			'UserPreferences' => 'save',
117
-    #			'Clipboard' => 'save, flush, show',
118
-    #		), array(
119
-    #			'access' => 'user,group',
120
-    #			'icon' => 'EXT:vidi/Resources/Public/Images/list.png',
121
-    #			'labels' => $labelFile,
122
-    #		)
123
-    #	);
124
-    #}
125
-    #if ($configuration['hide_module_list']['value']) {
126
-    #
127
-    #	// Default User TSConfig to be added in any case.
128
-    #	TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('
129
-    #
130
-    #		# Hide the module in the BE.
131
-    #		options.hideModules.web := addToList(list)
132
-    #	');
133
-    #}
134
-
135
-    /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
136
-    $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
137
-
138
-    /** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */
139
-    $signalSlotDispatcher = $objectManager->get('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
140
-
141
-    // Connect "processContentData" signal slot with the "ContentObjectProcessor".
142
-    $signalSlotDispatcher->connect(
143
-        'Fab\Vidi\Controller\Backend\ContentController',
144
-        'processContentData',
145
-        'Fab\Vidi\Processor\ContentObjectProcessor',
146
-        'processRelations',
147
-        true
148
-    );
149
-
150
-    // Connect "processContentData" signal with the "MarkerProcessor".
151
-    $signalSlotDispatcher->connect(
152
-        'Fab\Vidi\Controller\Backend\ContentController',
153
-        'processContentData',
154
-        'Fab\Vidi\Processor\MarkerProcessor',
155
-        'processMarkers',
156
-        true
157
-    );
158
-
159
-    // Register default Tools for Vidi.
160
-    \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('*', 'Fab\Vidi\Tool\ModulePreferencesTool');
161
-    \Fab\Vidi\Tool\ToolRegistry::getInstance()->register('*', 'Fab\Vidi\Tool\RelationAnalyserTool');
11
+	// Add content main module before 'user'
12
+	if (!isset($GLOBALS['TBE_MODULES']['content'])) {
13
+
14
+		// Position module "content" after module "user" manually. No API is available for that, it seems...
15
+		$modules = [];
16
+		foreach ($GLOBALS['TBE_MODULES'] as $key => $val) {
17
+			if ($key === 'user') {
18
+				$modules['content'] = '';
19
+			}
20
+			$modules[$key] = $val;
21
+		}
22
+		$GLOBALS['TBE_MODULES'] = $modules;
23
+
24
+		// Register "data management" module.
25
+		\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
26
+			'content',
27
+			'',
28
+			'',
29
+			'',
30
+			[
31
+				'name' => 'content',
32
+				'access' => 'user,group',
33
+				'labels' => [
34
+					'll_ref' => 'LLL:EXT:vidi/Resources/Private/Language/content_module.xlf',
35
+				],
36
+			]
37
+		);
38
+	}
39
+
40
+	/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
41
+	$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
42
+
43
+	/** @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility $configurationUtility */
44
+	$configurationUtility = $objectManager->get('TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility');
45
+	$configuration = $configurationUtility->getCurrentConfiguration('vidi');
46
+
47
+	$pids = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configuration['default_pid']['value'], true);
48
+	$defaultPid = array_shift($pids);
49
+	$defaultPids = [];
50
+	foreach ($pids as $dataTypeAndPid) {
51
+		$parts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $dataTypeAndPid);
52
+		if (count($parts) === 2) {
53
+			$defaultPids[$parts[0]] = $parts[1];
54
+		}
55
+	}
56
+
57
+	// Loop around the data types and register them to be displayed within a BE module.
58
+	if ($configuration['data_types']['value']) {
59
+
60
+		$dataTypes = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $configuration['data_types']['value'], true);
61
+		foreach ($dataTypes as $dataType) {
62
+
63
+			/** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
64
+			$moduleLoader = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader', $dataType);
65
+
66
+			// Special case already defined in Vidi.
67
+			if ($dataType === 'fe_users') {
68
+				$languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_users.xlf';
69
+				$icon = 'EXT:core/Resources/Public/Icons/T3Icons/status/status-user-frontend.svg';
70
+				$icon = 'EXT:vidi/Resources/Public/Images/fe_users.svg';
71
+			} elseif ($dataType === 'fe_groups') {
72
+				$languageFile = 'LLL:EXT:vidi/Resources/Private/Language/fe_groups.xlf';
73
+				$icon = 'EXT:core/Resources/Public/Icons/T3Icons/status/status-user-group-frontend.svg';
74
+				$icon = 'EXT:vidi/Resources/Public/Images/fe_groups.svg';
75
+			} else {
76
+				/** @var \Fab\Vidi\Backend\LanguageFileGenerator $languageService */
77
+				$languageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(Fab\Vidi\Backend\LanguageFileGenerator::class);
78
+				$languageFile = $languageService->generate($dataType);
79
+				$icon = '';
80
+			}
81
+
82
+			$pid = isset($defaultPids[$dataType]) ? $defaultPids[$dataType] : $defaultPid;
83
+
84
+			/** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */
85
+			$moduleLoader->setIcon($icon)
86
+				->setModuleLanguageFile($languageFile)
87
+				->setDefaultPid($pid)
88
+				->register();
89
+		}
90
+	}
91
+
92
+	// Possible Static TS loading
93
+	if (true === isset($configuration['autoload_typoscript']['value']) && false === (bool)$configuration['autoload_typoscript']['value']) {
94
+		\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('vidi', 'Configuration/TypoScript', 'Vidi: versatile and interactive display');
95
+	}
96
+
97
+	// Register List2 only if beta feature is enabled.
98
+	// @todo let see what we do with that
99
+	#if ($configuration['activate_beta_features']['value']) {
100
+	#	$labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module.xlf';
101
+	#
102
+	#	if (!$configuration['hide_module_list']['value']) {
103
+	#		$labelFile = 'LLL:EXT:vidi/Resources/Private/Language/locallang_module_transitional.xlf';
104
+	#	}
105
+	#
106
+	#	\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
107
+	#		'vidi',
108
+	#		'web', // Make module a submodule of 'web'
109
+	#		'm1', // Submodule key
110
+	#		'after:list', // Position
111
+	#		array(
112
+	#			'Content' => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard',
113
+	#			'Tool' => 'welcome, work',
114
+	#			'Facet' => 'autoSuggest, autoSuggests',
115
+	#			'Selection' => 'edit, update, create, delete, list, show',
116
+	#			'UserPreferences' => 'save',
117
+	#			'Clipboard' => 'save, flush, show',
118
+	#		), array(
119
+	#			'access' => 'user,group',
120
+	#			'icon' => 'EXT:vidi/Resources/Public/Images/list.png',
121
+	#			'labels' => $labelFile,
122
+	#		)
123
+	#	);
124
+	#}
125
+	#if ($configuration['hide_module_list']['value']) {
126
+	#
127
+	#	// Default User TSConfig to be added in any case.
128
+	#	TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('
129
+	#
130
+	#		# Hide the module in the BE.
131
+	#		options.hideModules.web := addToList(list)
132
+	#	');
133
+	#}
134
+
135
+	/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
136
+	$objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
137
+
138
+	/** @var $signalSlotDispatcher \TYPO3\CMS\Extbase\SignalSlot\Dispatcher */
139
+	$signalSlotDispatcher = $objectManager->get('TYPO3\CMS\Extbase\SignalSlot\Dispatcher');
140
+
141
+	// Connect "processContentData" signal slot with the "ContentObjectProcessor".
142
+	$signalSlotDispatcher->connect(
143
+		'Fab\Vidi\Controller\Backend\ContentController',
144
+		'processContentData',
145
+		'Fab\Vidi\Processor\ContentObjectProcessor',
146
+		'processRelations',
147
+		true
148
+	);
149
+
150
+	// Connect "processContentData" signal with the "MarkerProcessor".
151
+	$signalSlotDispatcher->connect(
152
+		'Fab\Vidi\Controller\Backend\ContentController',
153
+		'processContentData',
154
+		'Fab\Vidi\Processor\MarkerProcessor',
155
+		'processMarkers',
156
+		true
157
+	);
158
+
159
+	// Register default Tools for Vidi.
160
+	\Fab\Vidi\Tool\ToolRegistry::getInstance()->register('*', 'Fab\Vidi\Tool\ModulePreferencesTool');
161
+	\Fab\Vidi\Tool\ToolRegistry::getInstance()->register('*', 'Fab\Vidi\Tool\RelationAnalyserTool');
162 162
 }
163 163
 
164 164
 // Add new sprite icon.
165 165
 $icons = [
166
-    'go' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/bullet_go.png',
167
-    'query' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/drive_disk.png',
166
+	'go' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/bullet_go.png',
167
+	'query' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/drive_disk.png',
168 168
 ];
169 169
 /** @var \TYPO3\CMS\Core\Imaging\IconRegistry $iconRegistry */
170 170
 $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
171 171
 foreach ($icons as $key => $icon) {
172
-    $iconRegistry->registerIcon('extensions-' . $_EXTKEY . '-' . $key,
173
-        \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
174
-        [
175
-            'source' => $icon
176
-        ]
177
-    );
172
+	$iconRegistry->registerIcon('extensions-' . $_EXTKEY . '-' . $key,
173
+		\TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
174
+		[
175
+			'source' => $icon
176
+		]
177
+	);
178 178
 }
179 179
 unset($iconRegistry);
Please login to merge, or discard this patch.
Classes/ViewHelpers/Link/BackViewHelper.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -19,30 +19,30 @@
 block discarded – undo
19 19
 class BackViewHelper extends AbstractViewHelper
20 20
 {
21 21
 
22
-    /**
23
-     * Returns the "back" buttons to be placed in the doc header.
24
-     *
25
-     * @return string
26
-     */
27
-    public function render()
28
-    {
22
+	/**
23
+	 * Returns the "back" buttons to be placed in the doc header.
24
+	 *
25
+	 * @return string
26
+	 */
27
+	public function render()
28
+	{
29 29
 
30
-        $result = '';
31
-        if (GeneralUtility::_GET('returnUrl')) {
32
-            $result = sprintf('<a href="%s" class="btn btn-default btn-sm btn-return-top">%s</a>',
33
-                GeneralUtility::_GP('returnUrl'),
34
-                $this->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL)
35
-            );
36
-        }
30
+		$result = '';
31
+		if (GeneralUtility::_GET('returnUrl')) {
32
+			$result = sprintf('<a href="%s" class="btn btn-default btn-sm btn-return-top">%s</a>',
33
+				GeneralUtility::_GP('returnUrl'),
34
+				$this->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL)
35
+			);
36
+		}
37 37
 
38
-        return $result;
39
-    }
38
+		return $result;
39
+	}
40 40
 
41
-    /**
42
-     * @return IconFactory
43
-     */
44
-    protected function getIconFactory()
45
-    {
46
-        return GeneralUtility::makeInstance(IconFactory::class);
47
-    }
41
+	/**
42
+	 * @return IconFactory
43
+	 */
44
+	protected function getIconFactory()
45
+	{
46
+		return GeneralUtility::makeInstance(IconFactory::class);
47
+	}
48 48
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Result/ToJsonViewHelper.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -18,58 +18,58 @@
 block discarded – undo
18 18
 class ToJsonViewHelper extends AbstractViewHelper
19 19
 {
20 20
 
21
-    /**
22
-     * Render a Json response
23
-     *
24
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
25
-     */
26
-    public function render()
27
-    {
21
+	/**
22
+	 * Render a Json response
23
+	 *
24
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
25
+	 */
26
+	public function render()
27
+	{
28 28
 
29
-        $objects = $this->templateVariableContainer->get('objects');
30
-        $columns = $this->templateVariableContainer->get('columns');
31
-        $output = array(
32
-            'sEcho' => $this->getNextTransactionId(),
33
-            'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'),
34
-            'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'),
35
-            'iNumberOfRecords' => count($objects),
36
-            'aaData' => $this->getRowsViewHelper()->render($objects, $columns),
37
-        );
29
+		$objects = $this->templateVariableContainer->get('objects');
30
+		$columns = $this->templateVariableContainer->get('columns');
31
+		$output = array(
32
+			'sEcho' => $this->getNextTransactionId(),
33
+			'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'),
34
+			'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'),
35
+			'iNumberOfRecords' => count($objects),
36
+			'aaData' => $this->getRowsViewHelper()->render($objects, $columns),
37
+		);
38 38
 
39
-        $this->setHttpHeaders();
40
-        print json_encode($output);
41
-    }
39
+		$this->setHttpHeaders();
40
+		print json_encode($output);
41
+	}
42 42
 
43
-    /**
44
-     * @return int
45
-     */
46
-    protected function getNextTransactionId()
47
-    {
48
-        $transaction = 0;
49
-        if (GeneralUtility::_GET('sEcho')) {
50
-            $transaction = (int)GeneralUtility::_GET('sEcho') + 1;
51
-        }
52
-        return $transaction;
53
-    }
43
+	/**
44
+	 * @return int
45
+	 */
46
+	protected function getNextTransactionId()
47
+	{
48
+		$transaction = 0;
49
+		if (GeneralUtility::_GET('sEcho')) {
50
+			$transaction = (int)GeneralUtility::_GET('sEcho') + 1;
51
+		}
52
+		return $transaction;
53
+	}
54 54
 
55
-    /**
56
-     * @return void
57
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
58
-     * @throws \InvalidArgumentException
59
-     */
60
-    protected function setHttpHeaders()
61
-    {
62
-        /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
63
-        $response = $this->templateVariableContainer->get('response');
64
-        $response->setHeader('Content-Type', 'application/json');
65
-        $response->sendHeaders();
66
-    }
55
+	/**
56
+	 * @return void
57
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
58
+	 * @throws \InvalidArgumentException
59
+	 */
60
+	protected function setHttpHeaders()
61
+	{
62
+		/** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
63
+		$response = $this->templateVariableContainer->get('response');
64
+		$response->setHeader('Content-Type', 'application/json');
65
+		$response->sendHeaders();
66
+	}
67 67
 
68
-    /**
69
-     * @return RowsViewHelper
70
-     */
71
-    protected function getRowsViewHelper()
72
-    {
73
-        return $this->objectManager->get(RowsViewHelper::class);
74
-    }
68
+	/**
69
+	 * @return RowsViewHelper
70
+	 */
71
+	protected function getRowsViewHelper()
72
+	{
73
+		return $this->objectManager->get(RowsViewHelper::class);
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Result/ToXmlViewHelper.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -16,120 +16,120 @@
 block discarded – undo
16 16
 class ToXmlViewHelper extends AbstractToFormatViewHelper
17 17
 {
18 18
 
19
-    /**
20
-     * Render an XML export.
21
-     *
22
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
23
-     */
24
-    public function render()
25
-    {
26
-
27
-        $objects = $this->templateVariableContainer->get('objects');
28
-
29
-        // Make sure we have something to process...
30
-        if (!empty($objects)) {
31
-
32
-            // Initialization step.
33
-            $this->initializeEnvironment($objects);
34
-            $this->exportFileNameAndPath .= '.xml'; // add extension to the file.
35
-
36
-            // Write the exported data to a XML file.
37
-            $this->writeXmlFile($objects);
38
-
39
-            // We must generate a zip archive since there are files included.
40
-            if ($this->hasCollectedFiles()) {
41
-
42
-                $this->writeZipFile();
43
-                $this->sendZipHttpHeaders();
44
-
45
-                readfile($this->zipFileNameAndPath);
46
-            } else {
47
-                $this->sendXmlHttpHeaders();
48
-                readfile($this->exportFileNameAndPath);
49
-            }
50
-
51
-            GeneralUtility::rmdir($this->temporaryDirectory, true);
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Write the XML file to a temporary location.
57
-     *
58
-     * @param array $objects
59
-     * @return void
60
-     */
61
-    protected function writeXmlFile(array $objects)
62
-    {
63
-
64
-        // Get first object of $objects to check whether it contains possible files to include.
65
-        /** @var \Fab\Vidi\Domain\Model\Content $object */
66
-        $object = reset($objects);
67
-        $this->checkWhetherObjectMayIncludeFiles($object);
68
-
69
-        $items = [];
70
-        foreach ($objects as $object) {
71
-            if ($this->hasFileFields()) {
72
-                $this->collectFiles($object);
73
-            }
74
-            $items[] = $object->toValues();
75
-        }
76
-
77
-        $xml = new \SimpleXMLElement('<items/>');
78
-        $xml = $this->arrayToXml($items, $xml);
79
-        file_put_contents($this->exportFileNameAndPath, $this->formatXml($xml->asXML()));
80
-    }
81
-
82
-    /*
19
+	/**
20
+	 * Render an XML export.
21
+	 *
22
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
23
+	 */
24
+	public function render()
25
+	{
26
+
27
+		$objects = $this->templateVariableContainer->get('objects');
28
+
29
+		// Make sure we have something to process...
30
+		if (!empty($objects)) {
31
+
32
+			// Initialization step.
33
+			$this->initializeEnvironment($objects);
34
+			$this->exportFileNameAndPath .= '.xml'; // add extension to the file.
35
+
36
+			// Write the exported data to a XML file.
37
+			$this->writeXmlFile($objects);
38
+
39
+			// We must generate a zip archive since there are files included.
40
+			if ($this->hasCollectedFiles()) {
41
+
42
+				$this->writeZipFile();
43
+				$this->sendZipHttpHeaders();
44
+
45
+				readfile($this->zipFileNameAndPath);
46
+			} else {
47
+				$this->sendXmlHttpHeaders();
48
+				readfile($this->exportFileNameAndPath);
49
+			}
50
+
51
+			GeneralUtility::rmdir($this->temporaryDirectory, true);
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Write the XML file to a temporary location.
57
+	 *
58
+	 * @param array $objects
59
+	 * @return void
60
+	 */
61
+	protected function writeXmlFile(array $objects)
62
+	{
63
+
64
+		// Get first object of $objects to check whether it contains possible files to include.
65
+		/** @var \Fab\Vidi\Domain\Model\Content $object */
66
+		$object = reset($objects);
67
+		$this->checkWhetherObjectMayIncludeFiles($object);
68
+
69
+		$items = [];
70
+		foreach ($objects as $object) {
71
+			if ($this->hasFileFields()) {
72
+				$this->collectFiles($object);
73
+			}
74
+			$items[] = $object->toValues();
75
+		}
76
+
77
+		$xml = new \SimpleXMLElement('<items/>');
78
+		$xml = $this->arrayToXml($items, $xml);
79
+		file_put_contents($this->exportFileNameAndPath, $this->formatXml($xml->asXML()));
80
+	}
81
+
82
+	/*
83 83
      * Convert an array to xml
84 84
      *
85 85
      * @return \SimpleXMLElement
86 86
      */
87
-    protected function arrayToXml($array, \SimpleXMLElement $xml)
88
-    {
89
-        foreach ($array as $key => $value) {
90
-            if (is_array($value)) {
91
-                $key = is_numeric($key) ? 'item' : $key;
92
-                $subNode = $xml->addChild($key);
93
-                $this->arrayToXml($value, $subNode);
94
-            } else {
95
-                $key = is_numeric($key) ? 'item' : $key;
96
-                $xml->addChild($key, "$value");
97
-            }
98
-        }
99
-        return $xml;
100
-    }
101
-
102
-    /*
87
+	protected function arrayToXml($array, \SimpleXMLElement $xml)
88
+	{
89
+		foreach ($array as $key => $value) {
90
+			if (is_array($value)) {
91
+				$key = is_numeric($key) ? 'item' : $key;
92
+				$subNode = $xml->addChild($key);
93
+				$this->arrayToXml($value, $subNode);
94
+			} else {
95
+				$key = is_numeric($key) ? 'item' : $key;
96
+				$xml->addChild($key, "$value");
97
+			}
98
+		}
99
+		return $xml;
100
+	}
101
+
102
+	/*
103 103
      * Format the XML so that is looks human friendly.
104 104
      *
105 105
      * @param string $xml
106 106
      * @return string
107 107
      */
108
-    protected function formatXml($xml)
109
-    {
110
-        $dom = new \DOMDocument("1.0");
111
-        $dom->preserveWhiteSpace = false;
112
-        $dom->formatOutput = true;
113
-        $dom->loadXML($xml);
114
-        return $dom->saveXML();
115
-    }
116
-
117
-    /**
118
-     * @return void
119
-     * @throws \InvalidArgumentException
120
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
121
-     */
122
-    protected function sendXmlHttpHeaders()
123
-    {
124
-
125
-        /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
126
-        $response = $this->templateVariableContainer->get('response');
127
-        $response->setHeader('Content-Type', 'application/xml');
128
-        $response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
129
-        $response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
130
-        $response->setHeader('Content-Description', 'File Transfer');
131
-
132
-        $response->sendHeaders();
133
-    }
108
+	protected function formatXml($xml)
109
+	{
110
+		$dom = new \DOMDocument("1.0");
111
+		$dom->preserveWhiteSpace = false;
112
+		$dom->formatOutput = true;
113
+		$dom->loadXML($xml);
114
+		return $dom->saveXML();
115
+	}
116
+
117
+	/**
118
+	 * @return void
119
+	 * @throws \InvalidArgumentException
120
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
121
+	 */
122
+	protected function sendXmlHttpHeaders()
123
+	{
124
+
125
+		/** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
126
+		$response = $this->templateVariableContainer->get('response');
127
+		$response->setHeader('Content-Type', 'application/xml');
128
+		$response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
129
+		$response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
130
+		$response->setHeader('Content-Description', 'File Transfer');
131
+
132
+		$response->sendHeaders();
133
+	}
134 134
 
135 135
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Result/ToCsvViewHelper.php 1 patch
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -16,99 +16,99 @@
 block discarded – undo
16 16
 class ToCsvViewHelper extends AbstractToFormatViewHelper
17 17
 {
18 18
 
19
-    /**
20
-     * Render a CSV export request.
21
-     *
22
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
23
-     */
24
-    public function render()
25
-    {
26
-
27
-        $objects = $this->templateVariableContainer->get('objects');
28
-
29
-        // Make sure we have something to process...
30
-        if (!empty($objects)) {
31
-
32
-            // Initialization step.
33
-            $this->initializeEnvironment($objects);
34
-            $this->exportFileNameAndPath .= '.csv'; // add extension to the file.
35
-
36
-            // Write the exported data to a CSV file.
37
-            $this->writeCsvFile($objects);
38
-
39
-            // We must generate a zip archive since there are files included.
40
-            if ($this->hasCollectedFiles()) {
41
-
42
-                $this->writeZipFile();
43
-                $this->sendZipHttpHeaders();
44
-
45
-                readfile($this->zipFileNameAndPath);
46
-            } else {
47
-                $this->sendCsvHttpHeaders();
48
-                readfile($this->exportFileNameAndPath);
49
-            }
50
-
51
-            GeneralUtility::rmdir($this->temporaryDirectory, true);
52
-        }
53
-    }
54
-
55
-    /**
56
-     * Write the CSV file to a temporary location.
57
-     *
58
-     * @param array $objects
59
-     * @return void
60
-     * @throws \Exception
61
-     */
62
-    protected function writeCsvFile(array $objects)
63
-    {
64
-
65
-        // Create a file pointer
66
-        $output = fopen($this->exportFileNameAndPath, 'w');
67
-
68
-        // Handle CSV header, get the first object and get the list of fields.
69
-        /** @var \Fab\Vidi\Domain\Model\Content $object */
70
-        $object = reset($objects);
71
-        fputcsv($output, $object->toFields());
72
-        $this->checkWhetherObjectMayIncludeFiles($object);
73
-
74
-        foreach ($objects as $object) {
75
-            if ($this->hasFileFields()) {
76
-                $this->collectFiles($object);
77
-            }
78
-
79
-            // Make sure we have a flat array of values for the CSV purpose.
80
-            $flattenValues = [];
81
-            foreach ($object->toValues() as $fieldName => $value) {
82
-                if (is_array($value)) {
83
-                    $flattenValues[$fieldName] = implode(', ', $value);
84
-                } else {
85
-                    $flattenValues[$fieldName] = str_replace("\n", "\r", $value); // for Excel purpose.
86
-                }
87
-            }
88
-
89
-            fputcsv($output, $flattenValues);
90
-        }
91
-
92
-        // close file handler
93
-        fclose($output);
94
-    }
95
-
96
-    /**
97
-     * @return void
98
-     * @throws \InvalidArgumentException
99
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
100
-     */
101
-    protected function sendCsvHttpHeaders()
102
-    {
103
-
104
-        /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
105
-        $response = $this->templateVariableContainer->get('response');
106
-        $response->setHeader('Content-Type', 'application/csv');
107
-        $response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
108
-        $response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
109
-        $response->setHeader('Content-Description', 'File Transfer');
110
-
111
-        $response->sendHeaders();
112
-    }
19
+	/**
20
+	 * Render a CSV export request.
21
+	 *
22
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
23
+	 */
24
+	public function render()
25
+	{
26
+
27
+		$objects = $this->templateVariableContainer->get('objects');
28
+
29
+		// Make sure we have something to process...
30
+		if (!empty($objects)) {
31
+
32
+			// Initialization step.
33
+			$this->initializeEnvironment($objects);
34
+			$this->exportFileNameAndPath .= '.csv'; // add extension to the file.
35
+
36
+			// Write the exported data to a CSV file.
37
+			$this->writeCsvFile($objects);
38
+
39
+			// We must generate a zip archive since there are files included.
40
+			if ($this->hasCollectedFiles()) {
41
+
42
+				$this->writeZipFile();
43
+				$this->sendZipHttpHeaders();
44
+
45
+				readfile($this->zipFileNameAndPath);
46
+			} else {
47
+				$this->sendCsvHttpHeaders();
48
+				readfile($this->exportFileNameAndPath);
49
+			}
50
+
51
+			GeneralUtility::rmdir($this->temporaryDirectory, true);
52
+		}
53
+	}
54
+
55
+	/**
56
+	 * Write the CSV file to a temporary location.
57
+	 *
58
+	 * @param array $objects
59
+	 * @return void
60
+	 * @throws \Exception
61
+	 */
62
+	protected function writeCsvFile(array $objects)
63
+	{
64
+
65
+		// Create a file pointer
66
+		$output = fopen($this->exportFileNameAndPath, 'w');
67
+
68
+		// Handle CSV header, get the first object and get the list of fields.
69
+		/** @var \Fab\Vidi\Domain\Model\Content $object */
70
+		$object = reset($objects);
71
+		fputcsv($output, $object->toFields());
72
+		$this->checkWhetherObjectMayIncludeFiles($object);
73
+
74
+		foreach ($objects as $object) {
75
+			if ($this->hasFileFields()) {
76
+				$this->collectFiles($object);
77
+			}
78
+
79
+			// Make sure we have a flat array of values for the CSV purpose.
80
+			$flattenValues = [];
81
+			foreach ($object->toValues() as $fieldName => $value) {
82
+				if (is_array($value)) {
83
+					$flattenValues[$fieldName] = implode(', ', $value);
84
+				} else {
85
+					$flattenValues[$fieldName] = str_replace("\n", "\r", $value); // for Excel purpose.
86
+				}
87
+			}
88
+
89
+			fputcsv($output, $flattenValues);
90
+		}
91
+
92
+		// close file handler
93
+		fclose($output);
94
+	}
95
+
96
+	/**
97
+	 * @return void
98
+	 * @throws \InvalidArgumentException
99
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
100
+	 */
101
+	protected function sendCsvHttpHeaders()
102
+	{
103
+
104
+		/** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
105
+		$response = $this->templateVariableContainer->get('response');
106
+		$response->setHeader('Content-Type', 'application/csv');
107
+		$response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
108
+		$response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
109
+		$response->setHeader('Content-Description', 'File Transfer');
110
+
111
+		$response->sendHeaders();
112
+	}
113 113
 
114 114
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Result/ToXlsViewHelper.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -17,103 +17,103 @@
 block discarded – undo
17 17
 class ToXlsViewHelper extends AbstractToFormatViewHelper
18 18
 {
19 19
 
20
-    /**
21
-     * Render a XLS export request.
22
-     *
23
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
24
-     */
25
-    public function render()
26
-    {
27
-
28
-        $objects = $this->templateVariableContainer->get('objects');
29
-
30
-        // Make sure we have something to process...
31
-        if (!empty($objects)) {
32
-
33
-            // Initialization step.
34
-            $this->initializeEnvironment($objects);
35
-            $this->exportFileNameAndPath .= '.xls'; // add extension to the file.
36
-
37
-            // Write the exported data to a CSV file.
38
-            $this->writeXlsFile($objects);
39
-
40
-            // We must generate a zip archive since there are files included.
41
-            if ($this->hasCollectedFiles()) {
42
-
43
-                $this->writeZipFile();
44
-                $this->sendZipHttpHeaders();
45
-
46
-                readfile($this->zipFileNameAndPath);
47
-            } else {
48
-                $this->sendXlsHttpHeaders();
49
-                readfile($this->exportFileNameAndPath);
50
-            }
51
-
52
-            GeneralUtility::rmdir($this->temporaryDirectory, true);
53
-        }
54
-    }
55
-
56
-    /**
57
-     * Write the CSV file to a temporary location.
58
-     *
59
-     * @param array $objects
60
-     * @return void
61
-     * @throws \InvalidArgumentException
62
-     */
63
-    protected function writeXlsFile(array $objects)
64
-    {
65
-
66
-        /** @var SpreadSheetService $spreadSheet */
67
-        $spreadSheet = GeneralUtility::makeInstance(SpreadSheetService::class);
68
-
69
-        // Handle object header, get the first object and get the list of fields.
70
-        /** @var \Fab\Vidi\Domain\Model\Content $object */
71
-        $object = reset($objects);
72
-        $spreadSheet->addRow($object->toFields());
73
-
74
-        $this->checkWhetherObjectMayIncludeFiles($object);
75
-
76
-        foreach ($objects as $object) {
77
-            if ($this->hasFileFields()) {
78
-                $this->collectFiles($object);
79
-            }
80
-
81
-            // Make sure we have a flat array of values for the CSV purpose.
82
-            $flattenValues = [];
83
-            foreach ($object->toValues() as $fieldName => $value) {
84
-                if (is_array($value)) {
85
-                    $flattenValues[$fieldName] = implode(', ', $value);
86
-                } else {
87
-                    $flattenValues[$fieldName] = $value;
88
-                }
89
-            }
90
-
91
-            $spreadSheet->addRow($flattenValues);
92
-        }
93
-
94
-        file_put_contents($this->exportFileNameAndPath, $spreadSheet->toString());
95
-    }
96
-
97
-    /**
98
-     * @return void
99
-     * @throws \InvalidArgumentException
100
-     * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
101
-     */
102
-    protected function sendXlsHttpHeaders()
103
-    {
104
-
105
-        /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
106
-        $response = $this->templateVariableContainer->get('response');
107
-        $response->setHeader('Pragma', 'public');
108
-        $response->setHeader('Expires', '0');
109
-        $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
110
-        $response->setHeader('Content-Type', 'application/vnd.ms-excel');
111
-        $response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
112
-        $response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
113
-        $response->setHeader('Content-Description', 'File Transfer');
114
-        $response->setHeader('Content-Transfer-Encoding', 'binary');
115
-
116
-        $response->sendHeaders();
117
-    }
20
+	/**
21
+	 * Render a XLS export request.
22
+	 *
23
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
24
+	 */
25
+	public function render()
26
+	{
27
+
28
+		$objects = $this->templateVariableContainer->get('objects');
29
+
30
+		// Make sure we have something to process...
31
+		if (!empty($objects)) {
32
+
33
+			// Initialization step.
34
+			$this->initializeEnvironment($objects);
35
+			$this->exportFileNameAndPath .= '.xls'; // add extension to the file.
36
+
37
+			// Write the exported data to a CSV file.
38
+			$this->writeXlsFile($objects);
39
+
40
+			// We must generate a zip archive since there are files included.
41
+			if ($this->hasCollectedFiles()) {
42
+
43
+				$this->writeZipFile();
44
+				$this->sendZipHttpHeaders();
45
+
46
+				readfile($this->zipFileNameAndPath);
47
+			} else {
48
+				$this->sendXlsHttpHeaders();
49
+				readfile($this->exportFileNameAndPath);
50
+			}
51
+
52
+			GeneralUtility::rmdir($this->temporaryDirectory, true);
53
+		}
54
+	}
55
+
56
+	/**
57
+	 * Write the CSV file to a temporary location.
58
+	 *
59
+	 * @param array $objects
60
+	 * @return void
61
+	 * @throws \InvalidArgumentException
62
+	 */
63
+	protected function writeXlsFile(array $objects)
64
+	{
65
+
66
+		/** @var SpreadSheetService $spreadSheet */
67
+		$spreadSheet = GeneralUtility::makeInstance(SpreadSheetService::class);
68
+
69
+		// Handle object header, get the first object and get the list of fields.
70
+		/** @var \Fab\Vidi\Domain\Model\Content $object */
71
+		$object = reset($objects);
72
+		$spreadSheet->addRow($object->toFields());
73
+
74
+		$this->checkWhetherObjectMayIncludeFiles($object);
75
+
76
+		foreach ($objects as $object) {
77
+			if ($this->hasFileFields()) {
78
+				$this->collectFiles($object);
79
+			}
80
+
81
+			// Make sure we have a flat array of values for the CSV purpose.
82
+			$flattenValues = [];
83
+			foreach ($object->toValues() as $fieldName => $value) {
84
+				if (is_array($value)) {
85
+					$flattenValues[$fieldName] = implode(', ', $value);
86
+				} else {
87
+					$flattenValues[$fieldName] = $value;
88
+				}
89
+			}
90
+
91
+			$spreadSheet->addRow($flattenValues);
92
+		}
93
+
94
+		file_put_contents($this->exportFileNameAndPath, $spreadSheet->toString());
95
+	}
96
+
97
+	/**
98
+	 * @return void
99
+	 * @throws \InvalidArgumentException
100
+	 * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException
101
+	 */
102
+	protected function sendXlsHttpHeaders()
103
+	{
104
+
105
+		/** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */
106
+		$response = $this->templateVariableContainer->get('response');
107
+		$response->setHeader('Pragma', 'public');
108
+		$response->setHeader('Expires', '0');
109
+		$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
110
+		$response->setHeader('Content-Type', 'application/vnd.ms-excel');
111
+		$response->setHeader('Content-Disposition', 'attachment; filename="' . basename($this->exportFileNameAndPath) . '"');
112
+		$response->setHeader('Content-Length', filesize($this->exportFileNameAndPath));
113
+		$response->setHeader('Content-Description', 'File Transfer');
114
+		$response->setHeader('Content-Transfer-Encoding', 'binary');
115
+
116
+		$response->sendHeaders();
117
+	}
118 118
 
119 119
 }
Please login to merge, or discard this patch.
Classes/Domain/Repository/SelectionRepository.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -19,76 +19,76 @@
 block discarded – undo
19 19
 class SelectionRepository extends Repository
20 20
 {
21 21
 
22
-    /**
23
-     * @param string $dataType
24
-     * @return QueryResult
25
-     */
26
-    public function findByDataTypeForCurrentBackendUser($dataType)
27
-    {
28
-        $query = $this->createQuery();
22
+	/**
23
+	 * @param string $dataType
24
+	 * @return QueryResult
25
+	 */
26
+	public function findByDataTypeForCurrentBackendUser($dataType)
27
+	{
28
+		$query = $this->createQuery();
29 29
 
30
-        // Compute the OR part
31
-        if ($this->getBackendUser()->isAdmin()) {
32
-            $logicalOr = $query->logicalOr(
33
-                $query->equals('visibility', Selection::VISIBILITY_EVERYONE),
34
-                $query->equals('visibility', Selection::VISIBILITY_ADMIN_ONLY),
35
-                $query->equals('cruser_id', $this->getBackendUser()->user['uid'])
36
-            );
37
-        } else {
38
-            $logicalOr = $query->logicalOr(
39
-                $query->equals('visibility', Selection::VISIBILITY_EVERYONE),
40
-                $query->equals('cruser_id', $this->getBackendUser()->user['uid'])
41
-            );
42
-        }
30
+		// Compute the OR part
31
+		if ($this->getBackendUser()->isAdmin()) {
32
+			$logicalOr = $query->logicalOr(
33
+				$query->equals('visibility', Selection::VISIBILITY_EVERYONE),
34
+				$query->equals('visibility', Selection::VISIBILITY_ADMIN_ONLY),
35
+				$query->equals('cruser_id', $this->getBackendUser()->user['uid'])
36
+			);
37
+		} else {
38
+			$logicalOr = $query->logicalOr(
39
+				$query->equals('visibility', Selection::VISIBILITY_EVERYONE),
40
+				$query->equals('cruser_id', $this->getBackendUser()->user['uid'])
41
+			);
42
+		}
43 43
 
44
-        // Add matching criteria
45
-        $query->matching(
46
-            $query->logicalAnd(
47
-                $query->equals('dataType', $dataType),
48
-                $logicalOr
49
-            )
50
-        );
44
+		// Add matching criteria
45
+		$query->matching(
46
+			$query->logicalAnd(
47
+				$query->equals('dataType', $dataType),
48
+				$logicalOr
49
+			)
50
+		);
51 51
 
52
-        // Set ordering
53
-        $query->setOrderings(
54
-            array('name' => QueryInterface::ORDER_ASCENDING)
55
-        );
52
+		// Set ordering
53
+		$query->setOrderings(
54
+			array('name' => QueryInterface::ORDER_ASCENDING)
55
+		);
56 56
 
57
-        return $query->execute();
58
-    }
57
+		return $query->execute();
58
+	}
59 59
 
60
-    /**
61
-     * @param string $dataType
62
-     * @return QueryResult
63
-     */
64
-    public function findForEveryone($dataType)
65
-    {
66
-        $query = $this->createQuery();
60
+	/**
61
+	 * @param string $dataType
62
+	 * @return QueryResult
63
+	 */
64
+	public function findForEveryone($dataType)
65
+	{
66
+		$query = $this->createQuery();
67 67
 
68
-        // Add matching criteria
69
-        $query->matching(
70
-            $query->logicalAnd(
71
-                $query->equals('dataType', $dataType),
72
-                $query->equals('visibility', Selection::VISIBILITY_EVERYONE)
73
-            )
74
-        );
68
+		// Add matching criteria
69
+		$query->matching(
70
+			$query->logicalAnd(
71
+				$query->equals('dataType', $dataType),
72
+				$query->equals('visibility', Selection::VISIBILITY_EVERYONE)
73
+			)
74
+		);
75 75
 
76
-        // Set ordering
77
-        $query->setOrderings(
78
-            array('name' => QueryInterface::ORDER_ASCENDING)
79
-        );
76
+		// Set ordering
77
+		$query->setOrderings(
78
+			array('name' => QueryInterface::ORDER_ASCENDING)
79
+		);
80 80
 
81
-        return $query->execute();
82
-    }
81
+		return $query->execute();
82
+	}
83 83
 
84
-    /**
85
-     * Returns an instance of the current Backend User.
86
-     *
87
-     * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
88
-     */
89
-    protected function getBackendUser()
90
-    {
91
-        return $GLOBALS['BE_USER'];
92
-    }
84
+	/**
85
+	 * Returns an instance of the current Backend User.
86
+	 *
87
+	 * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
88
+	 */
89
+	protected function getBackendUser()
90
+	{
91
+		return $GLOBALS['BE_USER'];
92
+	}
93 93
 
94 94
 }
95 95
\ No newline at end of file
Please login to merge, or discard this patch.
Classes/View/Check/PidCheck.php 1 patch
Indentation   +194 added lines, -194 removed lines patch added patch discarded remove patch
@@ -20,75 +20,75 @@  discard block
 block discarded – undo
20 20
 class PidCheck extends AbstractComponentView
21 21
 {
22 22
 
23
-    /**
24
-     * The data type (table)
25
-     *
26
-     * @var string
27
-     */
28
-    protected $dataType = '';
29
-
30
-    /**
31
-     * The configured pid for the data type
32
-     *
33
-     * @var int
34
-     */
35
-    protected $configuredPid = 0;
36
-
37
-    /**
38
-     * The page record of the configured pid
39
-     *
40
-     * @var array
41
-     */
42
-    protected $page = null;
43
-
44
-    /**
45
-     * A collection of speaking error messages why the pid is invalid.
46
-     *
47
-     * @var array
48
-     */
49
-    protected $errors = [];
50
-
51
-    /**
52
-     * Pseudo-Constructor, which ensures all dependencies are injected when called.
53
-     */
54
-    public function initializeObject()
55
-    {
56
-        $this->dataType = $this->getModuleLoader()->getDataType();
57
-        $this->configuredPid = $this->getConfiguredPid();
58
-    }
59
-
60
-    /**
61
-     * Renders warnings if storagePid is not properly configured.
62
-     *
63
-     * @return string
64
-     */
65
-    public function render()
66
-    {
67
-        $result = '';
68
-
69
-        $this->validateRootLevel();
70
-        $this->validatePageExist();
71
-        $this->validateDoktype();
72
-
73
-        if (!empty($this->errors)) {
74
-            $result .= $this->formatMessagePidIsNotValid();
75
-        }
76
-
77
-        return $result;
78
-    }
79
-
80
-    /**
81
-     * Format a message whenever the storage is offline.
82
-     *
83
-     * @return string
84
-     */
85
-    protected function formatMessagePidIsNotValid()
86
-    {
87
-
88
-        // TODO: after dropping typo3 7.6 support, remove class: typo3-message message-warning message-header message-body
89
-
90
-        $error = implode('<br />', $this->errors);
91
-        $result = <<< EOF
23
+	/**
24
+	 * The data type (table)
25
+	 *
26
+	 * @var string
27
+	 */
28
+	protected $dataType = '';
29
+
30
+	/**
31
+	 * The configured pid for the data type
32
+	 *
33
+	 * @var int
34
+	 */
35
+	protected $configuredPid = 0;
36
+
37
+	/**
38
+	 * The page record of the configured pid
39
+	 *
40
+	 * @var array
41
+	 */
42
+	protected $page = null;
43
+
44
+	/**
45
+	 * A collection of speaking error messages why the pid is invalid.
46
+	 *
47
+	 * @var array
48
+	 */
49
+	protected $errors = [];
50
+
51
+	/**
52
+	 * Pseudo-Constructor, which ensures all dependencies are injected when called.
53
+	 */
54
+	public function initializeObject()
55
+	{
56
+		$this->dataType = $this->getModuleLoader()->getDataType();
57
+		$this->configuredPid = $this->getConfiguredPid();
58
+	}
59
+
60
+	/**
61
+	 * Renders warnings if storagePid is not properly configured.
62
+	 *
63
+	 * @return string
64
+	 */
65
+	public function render()
66
+	{
67
+		$result = '';
68
+
69
+		$this->validateRootLevel();
70
+		$this->validatePageExist();
71
+		$this->validateDoktype();
72
+
73
+		if (!empty($this->errors)) {
74
+			$result .= $this->formatMessagePidIsNotValid();
75
+		}
76
+
77
+		return $result;
78
+	}
79
+
80
+	/**
81
+	 * Format a message whenever the storage is offline.
82
+	 *
83
+	 * @return string
84
+	 */
85
+	protected function formatMessagePidIsNotValid()
86
+	{
87
+
88
+		// TODO: after dropping typo3 7.6 support, remove class: typo3-message message-warning message-header message-body
89
+
90
+		$error = implode('<br />', $this->errors);
91
+		$result = <<< EOF
92 92
 			<div class="typo3-message message-warning alert alert-warning">
93 93
 				<div class="message-header alert-title">
94 94
 					Page id "{$this->configuredPid}" has found to be a wrong configuration for "{$this->dataType}"
@@ -116,129 +116,129 @@  discard block
 block discarded – undo
116 116
 			</div>
117 117
 EOF;
118 118
 
119
-        return $result;
120
-    }
121
-
122
-    /**
123
-     * Check if pid is 0 and given table is allowed on root level.
124
-     *
125
-     * @return void
126
-     */
127
-    protected function validateRootLevel()
128
-    {
129
-        if ($this->configuredPid > 0) {
130
-            return;
131
-        }
132
-
133
-        $isRootLevel = (bool)Tca::table()->get('rootLevel');
134
-        if (!$isRootLevel) {
135
-            $this->errors[] = sprintf(
136
-                'You are not allowed to use page id "0" unless you set $GLOBALS[\'TCA\'][\'%1$s\'][\'ctrl\'][\'rootLevel\'] = 1;',
137
-                $this->dataType
138
-            );
139
-        }
140
-    }
141
-
142
-    /**
143
-     * Check if a page exists for the configured pid
144
-     *
145
-     * @return void
146
-     */
147
-    protected function validatePageExist()
148
-    {
149
-        if ($this->configuredPid === 0) {
150
-            return;
151
-        }
152
-
153
-        $page = $this->getPage();
154
-        if (empty($page)) {
155
-            $this->errors[] = sprintf(
156
-                'No page found for the configured page id "%s".',
157
-                $this->configuredPid
158
-            );
159
-        }
160
-    }
161
-
162
-    /**
163
-     * Check if configured page is a sysfolder and if it is allowed.
164
-     *
165
-     * @return void
166
-     */
167
-    protected function validateDoktype()
168
-    {
169
-        if ($this->configuredPid === 0) {
170
-            return;
171
-        }
172
-
173
-        $page = $this->getPage();
174
-        if (!empty($page) && $page['doktype'] != PageRepository::DOKTYPE_SYSFOLDER && !$this->isTableAllowedOnStandardPages()) {
175
-            $this->errors[] = sprintf(
176
-                'The page with the id "%s" either has to be of the type "folder" (doktype=254) or the table "%s" has to be allowed on standard pages.',
177
-                $this->configuredPid,
178
-                $this->dataType
179
-            );
180
-        }
181
-    }
182
-
183
-    /**
184
-     * Check if given table is allowed on standard pages
185
-     *
186
-     * @see \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages()
187
-     * @return bool
188
-     */
189
-    protected function isTableAllowedOnStandardPages()
190
-    {
191
-        $allowedTables = explode(',', $GLOBALS['PAGES_TYPES']['default']['allowedTables']);
192
-        $result = in_array($this->dataType, $allowedTables);
193
-
194
-        return $result;
195
-    }
196
-
197
-    /**
198
-     * Return the default configured pid.
199
-     *
200
-     * @return int
201
-     */
202
-    protected function getConfiguredPid()
203
-    {
204
-
205
-        if (GeneralUtility::_GP(Parameter::PID)) {
206
-            $pid = GeneralUtility::_GP(Parameter::PID);
207
-        } else {
208
-
209
-            // Get pid from User TSConfig if any.
210
-            $tsConfigPath = sprintf('tx_vidi.dataType.%s.storagePid', $this->dataType);
211
-            $result = $this->getBackendUser()->getTSConfig($tsConfigPath);
212
-            $configuredPid = (int)$result['value'];
213
-
214
-            // If no pid is configured, use default pid from Module Loader
215
-            $pid = ($configuredPid) ?: $this->getModuleLoader()->getDefaultPid();
216
-        }
217
-
218
-        return $pid;
219
-    }
220
-
221
-    /**
222
-     * Return a pointer to the database.
223
-     *
224
-     * @return \TYPO3\CMS\Core\Database\DatabaseConnection
225
-     */
226
-    protected function getDatabaseConnection()
227
-    {
228
-        return $GLOBALS['TYPO3_DB'];
229
-    }
230
-
231
-    /**
232
-     * Returns the page record of the configured pid
233
-     *
234
-     * @return array
235
-     */
236
-    public function getPage()
237
-    {
238
-        if ($this->page !== null) {
239
-            return $this->page;
240
-        } else {
241
-            return $this->getDatabaseConnection()->exec_SELECTgetSingleRow('doktype', 'pages', 'deleted = 0 AND uid = ' . $this->configuredPid);
242
-        }
243
-    }
119
+		return $result;
120
+	}
121
+
122
+	/**
123
+	 * Check if pid is 0 and given table is allowed on root level.
124
+	 *
125
+	 * @return void
126
+	 */
127
+	protected function validateRootLevel()
128
+	{
129
+		if ($this->configuredPid > 0) {
130
+			return;
131
+		}
132
+
133
+		$isRootLevel = (bool)Tca::table()->get('rootLevel');
134
+		if (!$isRootLevel) {
135
+			$this->errors[] = sprintf(
136
+				'You are not allowed to use page id "0" unless you set $GLOBALS[\'TCA\'][\'%1$s\'][\'ctrl\'][\'rootLevel\'] = 1;',
137
+				$this->dataType
138
+			);
139
+		}
140
+	}
141
+
142
+	/**
143
+	 * Check if a page exists for the configured pid
144
+	 *
145
+	 * @return void
146
+	 */
147
+	protected function validatePageExist()
148
+	{
149
+		if ($this->configuredPid === 0) {
150
+			return;
151
+		}
152
+
153
+		$page = $this->getPage();
154
+		if (empty($page)) {
155
+			$this->errors[] = sprintf(
156
+				'No page found for the configured page id "%s".',
157
+				$this->configuredPid
158
+			);
159
+		}
160
+	}
161
+
162
+	/**
163
+	 * Check if configured page is a sysfolder and if it is allowed.
164
+	 *
165
+	 * @return void
166
+	 */
167
+	protected function validateDoktype()
168
+	{
169
+		if ($this->configuredPid === 0) {
170
+			return;
171
+		}
172
+
173
+		$page = $this->getPage();
174
+		if (!empty($page) && $page['doktype'] != PageRepository::DOKTYPE_SYSFOLDER && !$this->isTableAllowedOnStandardPages()) {
175
+			$this->errors[] = sprintf(
176
+				'The page with the id "%s" either has to be of the type "folder" (doktype=254) or the table "%s" has to be allowed on standard pages.',
177
+				$this->configuredPid,
178
+				$this->dataType
179
+			);
180
+		}
181
+	}
182
+
183
+	/**
184
+	 * Check if given table is allowed on standard pages
185
+	 *
186
+	 * @see \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages()
187
+	 * @return bool
188
+	 */
189
+	protected function isTableAllowedOnStandardPages()
190
+	{
191
+		$allowedTables = explode(',', $GLOBALS['PAGES_TYPES']['default']['allowedTables']);
192
+		$result = in_array($this->dataType, $allowedTables);
193
+
194
+		return $result;
195
+	}
196
+
197
+	/**
198
+	 * Return the default configured pid.
199
+	 *
200
+	 * @return int
201
+	 */
202
+	protected function getConfiguredPid()
203
+	{
204
+
205
+		if (GeneralUtility::_GP(Parameter::PID)) {
206
+			$pid = GeneralUtility::_GP(Parameter::PID);
207
+		} else {
208
+
209
+			// Get pid from User TSConfig if any.
210
+			$tsConfigPath = sprintf('tx_vidi.dataType.%s.storagePid', $this->dataType);
211
+			$result = $this->getBackendUser()->getTSConfig($tsConfigPath);
212
+			$configuredPid = (int)$result['value'];
213
+
214
+			// If no pid is configured, use default pid from Module Loader
215
+			$pid = ($configuredPid) ?: $this->getModuleLoader()->getDefaultPid();
216
+		}
217
+
218
+		return $pid;
219
+	}
220
+
221
+	/**
222
+	 * Return a pointer to the database.
223
+	 *
224
+	 * @return \TYPO3\CMS\Core\Database\DatabaseConnection
225
+	 */
226
+	protected function getDatabaseConnection()
227
+	{
228
+		return $GLOBALS['TYPO3_DB'];
229
+	}
230
+
231
+	/**
232
+	 * Returns the page record of the configured pid
233
+	 *
234
+	 * @return array
235
+	 */
236
+	public function getPage()
237
+	{
238
+		if ($this->page !== null) {
239
+			return $this->page;
240
+		} else {
241
+			return $this->getDatabaseConnection()->exec_SELECTgetSingleRow('doktype', 'pages', 'deleted = 0 AND uid = ' . $this->configuredPid);
242
+		}
243
+	}
244 244
 }
Please login to merge, or discard this patch.
Classes/View/Check/RelationsCheck.php 1 patch
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -17,40 +17,40 @@  discard block
 block discarded – undo
17 17
 class RelationsCheck extends AbstractComponentView
18 18
 {
19 19
 
20
-    /**
21
-     * @var array
22
-     */
23
-    protected $invalidFields = [];
24
-
25
-    /**
26
-     * Renders a button for uploading assets.
27
-     *
28
-     * @return string
29
-     */
30
-    public function render()
31
-    {
32
-
33
-        $result = '';
34
-
35
-        // Check whether storage is configured or not.
36
-        if (!$this->isTcaValid()) {
37
-            $result .= $this->formatMessageTcaIsNotValid();
38
-        }
39
-
40
-        return $result;
41
-    }
42
-
43
-    /**
44
-     * Format a message whenever the storage is offline.
45
-     *
46
-     * @return string
47
-     */
48
-    protected function formatMessageTcaIsNotValid()
49
-    {
50
-
51
-        // TODO: after dropping typo3 7.6 support, remove class: typo3-message message-warning message-header message-body
52
-
53
-        $result = <<< EOF
20
+	/**
21
+	 * @var array
22
+	 */
23
+	protected $invalidFields = [];
24
+
25
+	/**
26
+	 * Renders a button for uploading assets.
27
+	 *
28
+	 * @return string
29
+	 */
30
+	public function render()
31
+	{
32
+
33
+		$result = '';
34
+
35
+		// Check whether storage is configured or not.
36
+		if (!$this->isTcaValid()) {
37
+			$result .= $this->formatMessageTcaIsNotValid();
38
+		}
39
+
40
+		return $result;
41
+	}
42
+
43
+	/**
44
+	 * Format a message whenever the storage is offline.
45
+	 *
46
+	 * @return string
47
+	 */
48
+	protected function formatMessageTcaIsNotValid()
49
+	{
50
+
51
+		// TODO: after dropping typo3 7.6 support, remove class: typo3-message message-warning message-header message-body
52
+
53
+		$result = <<< EOF
54 54
 			<div class="typo3-message message-warning alert alert-warning">
55 55
 				<div class="message-header alert-title">
56 56
 					Grid may have trouble to render because of wrong / missing TCA.
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
 				</div>
66 66
 			</div>
67 67
 EOF;
68
-        return $result;
69
-    }
70
-
71
-    /**
72
-     * Check relations of current data type in the Grid.
73
-     *
74
-     * @return string
75
-     */
76
-    protected function formatMessageHelperText()
77
-    {
78
-        $helperText = '';
79
-        foreach ($this->invalidFields as $invalidField) {
80
-            $helperText .= <<<EOF
68
+		return $result;
69
+	}
70
+
71
+	/**
72
+	 * Check relations of current data type in the Grid.
73
+	 *
74
+	 * @return string
75
+	 */
76
+	protected function formatMessageHelperText()
77
+	{
78
+		$helperText = '';
79
+		foreach ($this->invalidFields as $invalidField) {
80
+			$helperText .= <<<EOF
81 81
 				<br />
82 82
 				In file EXT:my_ext/Configuration/TCA/{$this->getModuleLoader()->getDataType()}.php
83 83
 <pre>
@@ -111,42 +111,42 @@  discard block
 block discarded – undo
111 111
 
112 112
 </pre>
113 113
 EOF;
114
-        }
115
-        return $helperText;
116
-    }
117
-
118
-    /**
119
-     * Check relations of current data type in the Grid.
120
-     *
121
-     * @return boolean
122
-     */
123
-    protected function isTcaValid()
124
-    {
125
-
126
-        $dataType = $this->getModuleLoader()->getDataType();
127
-        $table = Tca::table($dataType);
128
-
129
-        foreach (Tca::grid($dataType)->getFields() as $fieldName => $configuration) {
130
-
131
-            if ($table->hasField($fieldName) && $table->field($fieldName)->hasMany()) {
132
-                if ($table->field($fieldName)->hasRelationManyToMany()) {
133
-
134
-                    $foreignTable = $table->field($fieldName)->getForeignTable();
135
-                    $manyToManyTable = $table->field($fieldName)->getManyToManyTable();
136
-                    $foreignField = $table->field($fieldName)->getForeignField();
137
-
138
-                    if (!$foreignField) {
139
-                        $this->invalidFields[] = $fieldName;
140
-                    } elseif (!$foreignTable) {
141
-                        $this->invalidFields[] = $fieldName;
142
-                    } elseif (!$manyToManyTable) {
143
-                        $this->invalidFields[] = $fieldName;
144
-                    }
145
-                }
146
-            }
147
-        }
148
-
149
-        return empty($this->invalidFields);
150
-    }
114
+		}
115
+		return $helperText;
116
+	}
117
+
118
+	/**
119
+	 * Check relations of current data type in the Grid.
120
+	 *
121
+	 * @return boolean
122
+	 */
123
+	protected function isTcaValid()
124
+	{
125
+
126
+		$dataType = $this->getModuleLoader()->getDataType();
127
+		$table = Tca::table($dataType);
128
+
129
+		foreach (Tca::grid($dataType)->getFields() as $fieldName => $configuration) {
130
+
131
+			if ($table->hasField($fieldName) && $table->field($fieldName)->hasMany()) {
132
+				if ($table->field($fieldName)->hasRelationManyToMany()) {
133
+
134
+					$foreignTable = $table->field($fieldName)->getForeignTable();
135
+					$manyToManyTable = $table->field($fieldName)->getManyToManyTable();
136
+					$foreignField = $table->field($fieldName)->getForeignField();
137
+
138
+					if (!$foreignField) {
139
+						$this->invalidFields[] = $fieldName;
140
+					} elseif (!$foreignTable) {
141
+						$this->invalidFields[] = $fieldName;
142
+					} elseif (!$manyToManyTable) {
143
+						$this->invalidFields[] = $fieldName;
144
+					}
145
+				}
146
+			}
147
+		}
148
+
149
+		return empty($this->invalidFields);
150
+	}
151 151
 
152 152
 }
Please login to merge, or discard this patch.