@@ -17,22 +17,22 @@ |
||
| 17 | 17 | class IsVisibleViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 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 visible. |
|
| 30 | - * |
|
| 31 | - * @return bool |
|
| 32 | - */ |
|
| 33 | - public function render() |
|
| 34 | - { |
|
| 35 | - return Tca::grid()->isVisible($this->arguments['name']); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Returns whether the column is visible. |
|
| 30 | + * |
|
| 31 | + * @return bool |
|
| 32 | + */ |
|
| 33 | + public function render() |
|
| 34 | + { |
|
| 35 | + return Tca::grid()->isVisible($this->arguments['name']); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | 38 | } |
@@ -17,22 +17,22 @@ |
||
| 17 | 17 | class IsEditableViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 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 | |
| 38 | 38 | } |
@@ -17,23 +17,23 @@ |
||
| 17 | 17 | class IsExcludedViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 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 | |
| 39 | 39 | } |
@@ -19,67 +19,67 @@ |
||
| 19 | 19 | class ConfigurationViewHelper extends AbstractViewHelper |
| 20 | 20 | { |
| 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) { |
|
| 32 | + foreach (Tca::grid()->getFields() as $fieldNameAndPath => $configuration) { |
|
| 33 | 33 | |
| 34 | - // Early failure if field does not exist. |
|
| 35 | - if (!$this->isAllowed($fieldNameAndPath)) { |
|
| 36 | - $message = sprintf('Property "%s" does not exist!', $fieldNameAndPath); |
|
| 37 | - throw new NotExistingFieldException($message, 1375369594); |
|
| 38 | - } |
|
| 34 | + // Early failure if field does not exist. |
|
| 35 | + if (!$this->isAllowed($fieldNameAndPath)) { |
|
| 36 | + $message = sprintf('Property "%s" does not exist!', $fieldNameAndPath); |
|
| 37 | + throw new NotExistingFieldException($message, 1375369594); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - // mData vs columnName |
|
| 41 | - // ------------------- |
|
| 42 | - // mData: internal name of DataTable plugin and can not contains a path, e.g. metadata.title |
|
| 43 | - // columnName: whole field name with path |
|
| 44 | - $output .= sprintf('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 | - } |
|
| 40 | + // mData vs columnName |
|
| 41 | + // ------------------- |
|
| 42 | + // mData: internal name of DataTable plugin and can not contains a path, e.g. metadata.title |
|
| 43 | + // columnName: whole field name with path |
|
| 44 | + $output .= sprintf('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 \Fab\Vidi\Resolver\FieldPathResolver|object |
|
| 80 | - */ |
|
| 81 | - protected function getFieldPathResolver() |
|
| 82 | - { |
|
| 83 | - return GeneralUtility::makeInstance(\Fab\Vidi\Resolver\FieldPathResolver::class); |
|
| 84 | - } |
|
| 78 | + /** |
|
| 79 | + * @return \Fab\Vidi\Resolver\FieldPathResolver|object |
|
| 80 | + */ |
|
| 81 | + protected function getFieldPathResolver() |
|
| 82 | + { |
|
| 83 | + return GeneralUtility::makeInstance(\Fab\Vidi\Resolver\FieldPathResolver::class); |
|
| 84 | + } |
|
| 85 | 85 | } |
@@ -18,21 +18,21 @@ |
||
| 18 | 18 | class FacetsViewHelper extends AbstractViewHelper |
| 19 | 19 | { |
| 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 | |
| 38 | 38 | } |
@@ -18,30 +18,30 @@ |
||
| 18 | 18 | class PreferencesViewHelper extends AbstractViewHelper |
| 19 | 19 | { |
| 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 | |
| 47 | 47 | } |
@@ -16,13 +16,13 @@ |
||
| 16 | 16 | class PublicPathViewHelper extends AbstractViewHelper |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Returns the public path to Vidi extension. |
|
| 21 | - * |
|
| 22 | - * @return string |
|
| 23 | - */ |
|
| 24 | - public function render() |
|
| 25 | - { |
|
| 26 | - return \Fab\Vidi\Utility\ExtensionManagementUtility::siteRelPath('vidi'); |
|
| 27 | - } |
|
| 19 | + /** |
|
| 20 | + * Returns the public path to Vidi extension. |
|
| 21 | + * |
|
| 22 | + * @return string |
|
| 23 | + */ |
|
| 24 | + public function render() |
|
| 25 | + { |
|
| 26 | + return \Fab\Vidi\Utility\ExtensionManagementUtility::siteRelPath('vidi'); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -17,58 +17,58 @@ |
||
| 17 | 17 | class ToolWorkViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 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('<a href="%s&returnUrl=%s" class="btn btn-default">%s</a>', |
|
| 58 | - $this->getModuleLoader()->getModuleUrl($additionalParameters), |
|
| 59 | - urlencode($GLOBALS['_SERVER']['REQUEST_URI']), |
|
| 60 | - $label |
|
| 61 | - ); |
|
| 62 | - return $result; |
|
| 63 | - } |
|
| 57 | + $result = sprintf('<a href="%s&returnUrl=%s" class="btn btn-default">%s</a>', |
|
| 58 | + $this->getModuleLoader()->getModuleUrl($additionalParameters), |
|
| 59 | + urlencode($GLOBALS['_SERVER']['REQUEST_URI']), |
|
| 60 | + $label |
|
| 61 | + ); |
|
| 62 | + return $result; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Get the Vidi Module Loader. |
|
| 67 | - * |
|
| 68 | - * @return \Fab\Vidi\Module\ModuleLoader|object |
|
| 69 | - */ |
|
| 70 | - protected function getModuleLoader() |
|
| 71 | - { |
|
| 72 | - return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleLoader::class); |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * Get the Vidi Module Loader. |
|
| 67 | + * |
|
| 68 | + * @return \Fab\Vidi\Module\ModuleLoader|object |
|
| 69 | + */ |
|
| 70 | + protected function getModuleLoader() |
|
| 71 | + { |
|
| 72 | + return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleLoader::class); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -18,26 +18,26 @@ |
||
| 18 | 18 | class ModuleLoaderViewHelper extends AbstractViewHelper |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 24 | - public function initializeArguments() |
|
| 25 | - { |
|
| 26 | - $this->registerArgument('key', 'string', 'The module key', true); |
|
| 27 | - } |
|
| 21 | + /** |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | + public function initializeArguments() |
|
| 25 | + { |
|
| 26 | + $this->registerArgument('key', 'string', 'The module key', true); |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Interface with the Module Loader. |
|
| 31 | - * |
|
| 32 | - * @return string |
|
| 33 | - */ |
|
| 34 | - public function render() |
|
| 35 | - { |
|
| 36 | - $getter = 'get' . ucfirst($this->arguments['key']); |
|
| 29 | + /** |
|
| 30 | + * Interface with the Module Loader. |
|
| 31 | + * |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | + public function render() |
|
| 35 | + { |
|
| 36 | + $getter = 'get' . ucfirst($this->arguments['key']); |
|
| 37 | 37 | |
| 38 | - /** @var ModuleLoader $moduleLoader */ |
|
| 39 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 40 | - return $moduleLoader->$getter(); |
|
| 41 | - } |
|
| 38 | + /** @var ModuleLoader $moduleLoader */ |
|
| 39 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 40 | + return $moduleLoader->$getter(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | } |