Completed
Push — master ( b70884...5fde98 )
by Fabien
55:11
created
Classes/ViewHelpers/Button/ToolWorkViewHelper.php 1 patch
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -17,59 +17,59 @@
 block discarded – undo
17 17
  */
18 18
 class ToolWorkViewHelper extends AbstractViewHelper
19 19
 {
20
-    /**
21
-     * @return void
22
-     */
23
-    public function initializeArguments()
24
-    {
25
-        $this->registerArgument('tool', 'string', '', true);
26
-        $this->registerArgument('label', 'string', '', true);
27
-        $this->registerArgument('arguments', 'array', '', false, []);
28
-    }
20
+	/**
21
+	 * @return void
22
+	 */
23
+	public function initializeArguments()
24
+	{
25
+		$this->registerArgument('tool', 'string', '', true);
26
+		$this->registerArgument('label', 'string', '', true);
27
+		$this->registerArgument('arguments', 'array', '', false, []);
28
+	}
29 29
 
30
-    /**
31
-     * Renders a button for "work" for a Tool.
32
-     *
33
-     * @return string
34
-     */
35
-    public function render()
36
-    {
37
-        $tool = $this->arguments['tool'];
38
-        $label = $this->arguments['label'];
39
-        $arguments = $this->arguments['arguments'];
30
+	/**
31
+	 * Renders a button for "work" for a Tool.
32
+	 *
33
+	 * @return string
34
+	 */
35
+	public function render()
36
+	{
37
+		$tool = $this->arguments['tool'];
38
+		$label = $this->arguments['label'];
39
+		$arguments = $this->arguments['arguments'];
40 40
 
41
-        $parameterPrefix = $this->getModuleLoader()->getParameterPrefix();
41
+		$parameterPrefix = $this->getModuleLoader()->getParameterPrefix();
42 42
 
43
-        // Compute the additional parameters.
44
-        $additionalParameters = array(
45
-            $parameterPrefix => array(
46
-                'controller' => 'Tool',
47
-                'action' => 'work',
48
-                'tool' => $tool,
49
-            ),
50
-        );
43
+		// Compute the additional parameters.
44
+		$additionalParameters = array(
45
+			$parameterPrefix => array(
46
+				'controller' => 'Tool',
47
+				'action' => 'work',
48
+				'tool' => $tool,
49
+			),
50
+		);
51 51
 
52
-        // Add possible additional arguments.
53
-        if (!empty($arguments)) {
54
-            $additionalParameters[$parameterPrefix]['arguments'] = $arguments;
55
-        }
52
+		// Add possible additional arguments.
53
+		if (!empty($arguments)) {
54
+			$additionalParameters[$parameterPrefix]['arguments'] = $arguments;
55
+		}
56 56
 
57
-        $result = sprintf(
58
-            '<a href="%s&returnUrl=%s" class="btn btn-default">%s</a>',
59
-            $this->getModuleLoader()->getModuleUrl($additionalParameters),
60
-            urlencode($GLOBALS['_SERVER']['REQUEST_URI']),
61
-            $label
62
-        );
63
-        return $result;
64
-    }
57
+		$result = sprintf(
58
+			'<a href="%s&returnUrl=%s" class="btn btn-default">%s</a>',
59
+			$this->getModuleLoader()->getModuleUrl($additionalParameters),
60
+			urlencode($GLOBALS['_SERVER']['REQUEST_URI']),
61
+			$label
62
+		);
63
+		return $result;
64
+	}
65 65
 
66
-    /**
67
-     * Get the Vidi Module Loader.
68
-     *
69
-     * @return ModuleLoader|object
70
-     */
71
-    protected function getModuleLoader()
72
-    {
73
-        return GeneralUtility::makeInstance(ModuleLoader::class);
74
-    }
66
+	/**
67
+	 * Get the Vidi Module Loader.
68
+	 *
69
+	 * @return ModuleLoader|object
70
+	 */
71
+	protected function getModuleLoader()
72
+	{
73
+		return GeneralUtility::makeInstance(ModuleLoader::class);
74
+	}
75 75
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Result/ToJsonViewHelper.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -18,54 +18,54 @@
 block discarded – undo
18 18
  */
19 19
 class ToJsonViewHelper extends AbstractViewHelper
20 20
 {
21
-    /**
22
-     * Render a Json response
23
-     *
24
-     */
25
-    public function render()
26
-    {
27
-        $objects = $this->templateVariableContainer->get('objects');
28
-        $columns = $this->templateVariableContainer->get('columns');
29
-        $output = array(
30
-            'sEcho' => $this->getNextTransactionId(),
31
-            'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'),
32
-            'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'),
33
-            'iNumberOfRecords' => count($objects),
34
-            'aaData' => $this->getRowsView()->render($objects, $columns),
35
-        );
21
+	/**
22
+	 * Render a Json response
23
+	 *
24
+	 */
25
+	public function render()
26
+	{
27
+		$objects = $this->templateVariableContainer->get('objects');
28
+		$columns = $this->templateVariableContainer->get('columns');
29
+		$output = array(
30
+			'sEcho' => $this->getNextTransactionId(),
31
+			'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'),
32
+			'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'),
33
+			'iNumberOfRecords' => count($objects),
34
+			'aaData' => $this->getRowsView()->render($objects, $columns),
35
+		);
36 36
 
37
-        $this->setHttpHeaders();
38
-        print json_encode($output);
39
-    }
37
+		$this->setHttpHeaders();
38
+		print json_encode($output);
39
+	}
40 40
 
41
-    /**
42
-     * @return int
43
-     */
44
-    protected function getNextTransactionId()
45
-    {
46
-        $transaction = 0;
47
-        if (GeneralUtility::_GET('sEcho')) {
48
-            $transaction = (int)GeneralUtility::_GET('sEcho') + 1;
49
-        }
50
-        return $transaction;
51
-    }
41
+	/**
42
+	 * @return int
43
+	 */
44
+	protected function getNextTransactionId()
45
+	{
46
+		$transaction = 0;
47
+		if (GeneralUtility::_GET('sEcho')) {
48
+			$transaction = (int)GeneralUtility::_GET('sEcho') + 1;
49
+		}
50
+		return $transaction;
51
+	}
52 52
 
53
-    /**
54
-     * @return void
55
-     * @throws \InvalidArgumentException
56
-     */
57
-    protected function setHttpHeaders()
58
-    {
59
-        /** @var Response $response */
60
-        $response = $this->templateVariableContainer->get('response');
61
-        $response->withHeader('Content-Type', 'application/json');
62
-    }
53
+	/**
54
+	 * @return void
55
+	 * @throws \InvalidArgumentException
56
+	 */
57
+	protected function setHttpHeaders()
58
+	{
59
+		/** @var Response $response */
60
+		$response = $this->templateVariableContainer->get('response');
61
+		$response->withHeader('Content-Type', 'application/json');
62
+	}
63 63
 
64
-    /**
65
-     * @return Rows|object
66
-     */
67
-    protected function getRowsView()
68
-    {
69
-        return GeneralUtility::makeInstance(Rows::class);
70
-    }
64
+	/**
65
+	 * @return Rows|object
66
+	 */
67
+	protected function getRowsView()
68
+	{
69
+		return GeneralUtility::makeInstance(Rows::class);
70
+	}
71 71
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/PreferencesViewHelper.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,29 +18,29 @@
 block discarded – undo
18 18
  */
19 19
 class PreferencesViewHelper extends AbstractViewHelper
20 20
 {
21
-    /**
22
-     * @return void
23
-     */
24
-    public function initializeArguments()
25
-    {
26
-        $this->registerArgument('key', 'string', '', true);
27
-    }
21
+	/**
22
+	 * @return void
23
+	 */
24
+	public function initializeArguments()
25
+	{
26
+		$this->registerArgument('key', 'string', '', true);
27
+	}
28 28
 
29
-    /**
30
-     * Returns Grid preferences for the given key.
31
-     *
32
-     * @return mixed
33
-     */
34
-    public function render()
35
-    {
36
-        return $this->getModulePreferences()->get($this->arguments['key']);
37
-    }
29
+	/**
30
+	 * Returns Grid preferences for the given key.
31
+	 *
32
+	 * @return mixed
33
+	 */
34
+	public function render()
35
+	{
36
+		return $this->getModulePreferences()->get($this->arguments['key']);
37
+	}
38 38
 
39
-    /**
40
-     * @return ModulePreferences|object
41
-     */
42
-    protected function getModulePreferences()
43
-    {
44
-        return GeneralUtility::makeInstance(ModulePreferences::class);
45
-    }
39
+	/**
40
+	 * @return ModulePreferences|object
41
+	 */
42
+	protected function getModulePreferences()
43
+	{
44
+		return GeneralUtility::makeInstance(ModulePreferences::class);
45
+	}
46 46
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/FacetsViewHelper.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,20 +18,20 @@
 block discarded – undo
18 18
  */
19 19
 class FacetsViewHelper extends AbstractViewHelper
20 20
 {
21
-    /**
22
-     * Returns the json serialization of the search fields.
23
-     *
24
-     * @return string
25
-     */
26
-    public function render()
27
-    {
28
-        $facets = [];
29
-        foreach (Tca::grid()->getFacets() as $facet) {
30
-            /** @var FacetInterface $facet */
31
-            $name = $facet->getName();
32
-            $facets[$name] = $facet->getLabel();
33
-        }
21
+	/**
22
+	 * Returns the json serialization of the search fields.
23
+	 *
24
+	 * @return string
25
+	 */
26
+	public function render()
27
+	{
28
+		$facets = [];
29
+		foreach (Tca::grid()->getFacets() as $facet) {
30
+			/** @var FacetInterface $facet */
31
+			$name = $facet->getName();
32
+			$facets[$name] = $facet->getLabel();
33
+		}
34 34
 
35
-        return json_encode($facets);
36
-    }
35
+		return json_encode($facets);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/Column/HeaderViewHelper.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@
 block discarded – undo
17 17
  */
18 18
 class HeaderViewHelper extends AbstractViewHelper
19 19
 {
20
-    /**
21
-     * @return void
22
-     */
23
-    public function initializeArguments()
24
-    {
25
-        $this->registerArgument('name', 'string', 'The column name', true);
26
-    }
20
+	/**
21
+	 * @return void
22
+	 */
23
+	public function initializeArguments()
24
+	{
25
+		$this->registerArgument('name', 'string', 'The column name', true);
26
+	}
27 27
 
28
-    /**
29
-     * Returns a possible column header.
30
-     *
31
-     * @return boolean
32
-     */
33
-    public function render()
34
-    {
35
-        return Tca::grid()->getHeader($this->arguments['name']);
36
-    }
28
+	/**
29
+	 * Returns a possible column header.
30
+	 *
31
+	 * @return boolean
32
+	 */
33
+	public function render()
34
+	{
35
+		return Tca::grid()->getHeader($this->arguments['name']);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/Column/ConfigurationViewHelper.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -19,67 +19,67 @@
 block discarded – undo
19 19
  */
20 20
 class ConfigurationViewHelper extends AbstractViewHelper
21 21
 {
22
-    /**
23
-     * Render the columns of the grid.
24
-     *
25
-     * @throws NotExistingFieldException
26
-     * @return string
27
-     */
28
-    public function render()
29
-    {
30
-        $output = '';
22
+	/**
23
+	 * Render the columns of the grid.
24
+	 *
25
+	 * @throws NotExistingFieldException
26
+	 * @return string
27
+	 */
28
+	public function render()
29
+	{
30
+		$output = '';
31 31
 
32
-        foreach (Tca::grid()->getFields() as $fieldNameAndPath => $configuration) {
33
-            // Early failure if field does not exist.
34
-            if (!$this->isAllowed($fieldNameAndPath)) {
35
-                $message = sprintf('Property "%s" does not exist!', $fieldNameAndPath);
36
-                throw new NotExistingFieldException($message, 1375369594);
37
-            }
32
+		foreach (Tca::grid()->getFields() as $fieldNameAndPath => $configuration) {
33
+			// Early failure if field does not exist.
34
+			if (!$this->isAllowed($fieldNameAndPath)) {
35
+				$message = sprintf('Property "%s" does not exist!', $fieldNameAndPath);
36
+				throw new NotExistingFieldException($message, 1375369594);
37
+			}
38 38
 
39
-            // mData vs columnName
40
-            // -------------------
41
-            // mData: internal name of DataTable plugin and can not contains a path, e.g. metadata.title
42
-            // columnName: whole field name with path
43
-            $output .= sprintf(
44
-                'Vidi._columns.push({ "data": "%s", "sortable": %s, "visible": %s, "width": "%s", "class": "%s", "columnName": "%s" });' . PHP_EOL,
45
-                $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath), // Suitable field name for the DataTable plugin.
46
-                Tca::grid()->isSortable($fieldNameAndPath) ? 'true' : 'false',
47
-                Tca::grid()->isVisible($fieldNameAndPath) ? 'true' : 'false',
48
-                Tca::grid()->getWidth($fieldNameAndPath),
49
-                Tca::grid()->getClass($fieldNameAndPath),
50
-                $fieldNameAndPath
51
-            );
52
-        }
39
+			// mData vs columnName
40
+			// -------------------
41
+			// mData: internal name of DataTable plugin and can not contains a path, e.g. metadata.title
42
+			// columnName: whole field name with path
43
+			$output .= sprintf(
44
+				'Vidi._columns.push({ "data": "%s", "sortable": %s, "visible": %s, "width": "%s", "class": "%s", "columnName": "%s" });' . PHP_EOL,
45
+				$this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath), // Suitable field name for the DataTable plugin.
46
+				Tca::grid()->isSortable($fieldNameAndPath) ? 'true' : 'false',
47
+				Tca::grid()->isVisible($fieldNameAndPath) ? 'true' : 'false',
48
+				Tca::grid()->getWidth($fieldNameAndPath),
49
+				Tca::grid()->getClass($fieldNameAndPath),
50
+				$fieldNameAndPath
51
+			);
52
+		}
53 53
 
54
-        return $output;
55
-    }
54
+		return $output;
55
+	}
56 56
 
57
-    /**
58
-     * Tell whether the field looks ok to be displayed within the Grid.
59
-     *
60
-     * @param string $fieldNameAndPath
61
-     * @return boolean
62
-     */
63
-    protected function isAllowed($fieldNameAndPath)
64
-    {
65
-        $dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath);
66
-        $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath);
57
+	/**
58
+	 * Tell whether the field looks ok to be displayed within the Grid.
59
+	 *
60
+	 * @param string $fieldNameAndPath
61
+	 * @return boolean
62
+	 */
63
+	protected function isAllowed($fieldNameAndPath)
64
+	{
65
+		$dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath);
66
+		$fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath);
67 67
 
68
-        $isAllowed = false;
69
-        if (Tca::grid()->hasRenderers($fieldNameAndPath)) {
70
-            $isAllowed = true;
71
-        } elseif (Tca::table()->field($fieldNameAndPath)->isSystem() || Tca::table($dataType)->hasField($fieldName)) {
72
-            $isAllowed = true;
73
-        }
68
+		$isAllowed = false;
69
+		if (Tca::grid()->hasRenderers($fieldNameAndPath)) {
70
+			$isAllowed = true;
71
+		} elseif (Tca::table()->field($fieldNameAndPath)->isSystem() || Tca::table($dataType)->hasField($fieldName)) {
72
+			$isAllowed = true;
73
+		}
74 74
 
75
-        return $isAllowed;
76
-    }
75
+		return $isAllowed;
76
+	}
77 77
 
78
-    /**
79
-     * @return FieldPathResolver|object
80
-     */
81
-    protected function getFieldPathResolver()
82
-    {
83
-        return GeneralUtility::makeInstance(FieldPathResolver::class);
84
-    }
78
+	/**
79
+	 * @return FieldPathResolver|object
80
+	 */
81
+	protected function getFieldPathResolver()
82
+	{
83
+		return GeneralUtility::makeInstance(FieldPathResolver::class);
84
+	}
85 85
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             // mData: internal name of DataTable plugin and can not contains a path, e.g. metadata.title
42 42
             // columnName: whole field name with path
43 43
             $output .= sprintf(
44
-                'Vidi._columns.push({ "data": "%s", "sortable": %s, "visible": %s, "width": "%s", "class": "%s", "columnName": "%s" });' . PHP_EOL,
44
+                'Vidi._columns.push({ "data": "%s", "sortable": %s, "visible": %s, "width": "%s", "class": "%s", "columnName": "%s" });'.PHP_EOL,
45 45
                 $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath), // Suitable field name for the DataTable plugin.
46 46
                 Tca::grid()->isSortable($fieldNameAndPath) ? 'true' : 'false',
47 47
                 Tca::grid()->isVisible($fieldNameAndPath) ? 'true' : 'false',
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/Column/HasRelationViewHelper.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@
 block discarded – undo
18 18
  */
19 19
 class HasRelationViewHelper extends AbstractViewHelper
20 20
 {
21
-    /**
22
-     * Return whether the current field name has a relation to the main content.
23
-     *
24
-     * @return boolean
25
-     */
26
-    public function render()
27
-    {
28
-        $fieldNameAndPath = $this->templateVariableContainer->get('columnName');
29
-        $dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath);
30
-        $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath);
31
-        $hasRelation = Tca::table($dataType)->field($fieldName)->hasRelation();
32
-        return $hasRelation;
33
-    }
21
+	/**
22
+	 * Return whether the current field name has a relation to the main content.
23
+	 *
24
+	 * @return boolean
25
+	 */
26
+	public function render()
27
+	{
28
+		$fieldNameAndPath = $this->templateVariableContainer->get('columnName');
29
+		$dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath);
30
+		$fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath);
31
+		$hasRelation = Tca::table($dataType)->field($fieldName)->hasRelation();
32
+		return $hasRelation;
33
+	}
34 34
 
35
-    /**
36
-     * @return FieldPathResolver|object
37
-     */
38
-    protected function getFieldPathResolver()
39
-    {
40
-        return GeneralUtility::makeInstance(FieldPathResolver::class);
41
-    }
35
+	/**
36
+	 * @return FieldPathResolver|object
37
+	 */
38
+	protected function getFieldPathResolver()
39
+	{
40
+		return GeneralUtility::makeInstance(FieldPathResolver::class);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/Column/IsEditableViewHelper.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,21 +17,21 @@
 block discarded – undo
17 17
  */
18 18
 class IsEditableViewHelper extends AbstractViewHelper
19 19
 {
20
-    /**
21
-     * @return void
22
-     */
23
-    public function initializeArguments()
24
-    {
25
-        $this->registerArgument('name', 'string', 'The column name', true);
26
-    }
20
+	/**
21
+	 * @return void
22
+	 */
23
+	public function initializeArguments()
24
+	{
25
+		$this->registerArgument('name', 'string', 'The column name', true);
26
+	}
27 27
 
28
-    /**
29
-     * Return whether field name is editable in the Grid.
30
-     *
31
-     * @return boolean
32
-     */
33
-    public function render()
34
-    {
35
-        return Tca::grid()->isEditable($this->arguments['name']);
36
-    }
28
+	/**
29
+	 * Return whether field name is editable in the Grid.
30
+	 *
31
+	 * @return boolean
32
+	 */
33
+	public function render()
34
+	{
35
+		return Tca::grid()->isEditable($this->arguments['name']);
36
+	}
37 37
 }
Please login to merge, or discard this patch.
Classes/ViewHelpers/Grid/Column/IsExcludedViewHelper.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,22 +17,22 @@
 block discarded – undo
17 17
  */
18 18
 class IsExcludedViewHelper extends AbstractViewHelper
19 19
 {
20
-    /**
21
-     * @return void
22
-     */
23
-    public function initializeArguments()
24
-    {
25
-        $this->registerArgument('name', 'string', 'The column name', true);
26
-    }
20
+	/**
21
+	 * @return void
22
+	 */
23
+	public function initializeArguments()
24
+	{
25
+		$this->registerArgument('name', 'string', 'The column name', true);
26
+	}
27 27
 
28
-    /**
29
-     * Returns whether the column is excluded from the Grid.
30
-     *
31
-     * @return bool
32
-     */
33
-    public function render()
34
-    {
35
-        $excludedFields = Tca::grid()->getExcludedFields();
36
-        return !in_array($this->arguments['name'], $excludedFields, true);
37
-    }
28
+	/**
29
+	 * Returns whether the column is excluded from the Grid.
30
+	 *
31
+	 * @return bool
32
+	 */
33
+	public function render()
34
+	{
35
+		$excludedFields = Tca::grid()->getExcludedFields();
36
+		return !in_array($this->arguments['name'], $excludedFields, true);
37
+	}
38 38
 }
Please login to merge, or discard this patch.