@@ -18,36 +18,36 @@ |
||
| 18 | 18 | class CsvToArrayConverter extends AbstractTypeConverter |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var array<string> |
|
| 23 | - */ |
|
| 24 | - protected $sourceTypes = array('string'); |
|
| 21 | + /** |
|
| 22 | + * @var array<string> |
|
| 23 | + */ |
|
| 24 | + protected $sourceTypes = array('string'); |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected $targetType = 'array'; |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected $targetType = 'array'; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * @var integer |
|
| 33 | - */ |
|
| 34 | - protected $priority = 1; |
|
| 31 | + /** |
|
| 32 | + * @var integer |
|
| 33 | + */ |
|
| 34 | + protected $priority = 1; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Actually convert from $source to $targetType |
|
| 38 | - * |
|
| 39 | - * @param string $source |
|
| 40 | - * @param string $targetType |
|
| 41 | - * @param array $convertedChildProperties |
|
| 42 | - * @param PropertyMappingConfigurationInterface $configuration |
|
| 43 | - * @return array |
|
| 44 | - * @throws \Exception |
|
| 45 | - * @throws FileDoesNotExistException |
|
| 46 | - * @api |
|
| 47 | - */ |
|
| 48 | - public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
| 49 | - { |
|
| 50 | - return GeneralUtility::trimExplode(',', $source, true); |
|
| 51 | - } |
|
| 36 | + /** |
|
| 37 | + * Actually convert from $source to $targetType |
|
| 38 | + * |
|
| 39 | + * @param string $source |
|
| 40 | + * @param string $targetType |
|
| 41 | + * @param array $convertedChildProperties |
|
| 42 | + * @param PropertyMappingConfigurationInterface $configuration |
|
| 43 | + * @return array |
|
| 44 | + * @throws \Exception |
|
| 45 | + * @throws FileDoesNotExistException |
|
| 46 | + * @api |
|
| 47 | + */ |
|
| 48 | + public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null) |
|
| 49 | + { |
|
| 50 | + return GeneralUtility::trimExplode(',', $source, true); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | \ No newline at end of file |
@@ -18,115 +18,115 @@ |
||
| 18 | 18 | class BackendUtility |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /******************************************* |
|
| 21 | + /******************************************* |
|
| 22 | 22 | * |
| 23 | 23 | * SQL-related, selecting records, searching |
| 24 | 24 | * |
| 25 | 25 | *******************************************/ |
| 26 | - /** |
|
| 27 | - * Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field |
|
| 28 | - * is configured in $GLOBALS['TCA'] for the tablename, $table |
|
| 29 | - * This function should ALWAYS be called in the backend for selection on tables which |
|
| 30 | - * are configured in $GLOBALS['TCA'] since it will ensure consistent selection of records, |
|
| 31 | - * even if they are marked deleted (in which case the system must always treat them as non-existent!) |
|
| 32 | - * In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime |
|
| 33 | - * and fe_groups as well. But that is a job of the frontend, not the backend. If you need filtering |
|
| 34 | - * on those fields as well in the backend you can use ->BEenableFields() though. |
|
| 35 | - * |
|
| 36 | - * @param string $table Table name present in $GLOBALS['TCA'] |
|
| 37 | - * @param string $withLogicalSeparator Table alias if any |
|
| 38 | - * @return string WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0 |
|
| 39 | - */ |
|
| 40 | - public static function deleteClause($table, $withLogicalSeparator = ' AND') |
|
| 41 | - { |
|
| 42 | - if (empty($GLOBALS['TCA'][$table]['ctrl']['delete'])) { |
|
| 43 | - return ''; |
|
| 44 | - } |
|
| 45 | - $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 46 | - ->getQueryBuilderForTable($table) |
|
| 47 | - ->expr(); |
|
| 48 | - return $withLogicalSeparator . ' ' . $expressionBuilder->eq( |
|
| 49 | - $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], |
|
| 50 | - 0 |
|
| 51 | - ); |
|
| 52 | - } |
|
| 53 | - /** |
|
| 54 | - * Backend implementation of enableFields() |
|
| 55 | - * Notice that "fe_groups" is not selected for - only disabled, starttime and endtime. |
|
| 56 | - * Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition. |
|
| 57 | - * $GLOBALS["SIM_ACCESS_TIME"] is used for date. |
|
| 58 | - * |
|
| 59 | - * @param string $table The table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $GLOBALS['TCA']. |
|
| 60 | - * @param bool $inv Means that the query will select all records NOT VISIBLE records (inverted selection) |
|
| 61 | - * @return string WHERE clause part |
|
| 62 | - */ |
|
| 63 | - public static function BEenableFields($table, $inv = false) |
|
| 64 | - { |
|
| 65 | - $ctrl = $GLOBALS['TCA'][$table]['ctrl']; |
|
| 66 | - $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 67 | - ->getConnectionForTable($table) |
|
| 68 | - ->getExpressionBuilder(); |
|
| 69 | - $query = $expressionBuilder->andX(); |
|
| 70 | - $invQuery = $expressionBuilder->orX(); |
|
| 26 | + /** |
|
| 27 | + * Returns the WHERE clause " AND NOT [tablename].[deleted-field]" if a deleted-field |
|
| 28 | + * is configured in $GLOBALS['TCA'] for the tablename, $table |
|
| 29 | + * This function should ALWAYS be called in the backend for selection on tables which |
|
| 30 | + * are configured in $GLOBALS['TCA'] since it will ensure consistent selection of records, |
|
| 31 | + * even if they are marked deleted (in which case the system must always treat them as non-existent!) |
|
| 32 | + * In the frontend a function, ->enableFields(), is known to filter hidden-field, start- and endtime |
|
| 33 | + * and fe_groups as well. But that is a job of the frontend, not the backend. If you need filtering |
|
| 34 | + * on those fields as well in the backend you can use ->BEenableFields() though. |
|
| 35 | + * |
|
| 36 | + * @param string $table Table name present in $GLOBALS['TCA'] |
|
| 37 | + * @param string $withLogicalSeparator Table alias if any |
|
| 38 | + * @return string WHERE clause for filtering out deleted records, eg " AND tablename.deleted=0 |
|
| 39 | + */ |
|
| 40 | + public static function deleteClause($table, $withLogicalSeparator = ' AND') |
|
| 41 | + { |
|
| 42 | + if (empty($GLOBALS['TCA'][$table]['ctrl']['delete'])) { |
|
| 43 | + return ''; |
|
| 44 | + } |
|
| 45 | + $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 46 | + ->getQueryBuilderForTable($table) |
|
| 47 | + ->expr(); |
|
| 48 | + return $withLogicalSeparator . ' ' . $expressionBuilder->eq( |
|
| 49 | + $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['delete'], |
|
| 50 | + 0 |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | + /** |
|
| 54 | + * Backend implementation of enableFields() |
|
| 55 | + * Notice that "fe_groups" is not selected for - only disabled, starttime and endtime. |
|
| 56 | + * Notice that deleted-fields are NOT filtered - you must ALSO call deleteClause in addition. |
|
| 57 | + * $GLOBALS["SIM_ACCESS_TIME"] is used for date. |
|
| 58 | + * |
|
| 59 | + * @param string $table The table from which to return enableFields WHERE clause. Table name must have a 'ctrl' section in $GLOBALS['TCA']. |
|
| 60 | + * @param bool $inv Means that the query will select all records NOT VISIBLE records (inverted selection) |
|
| 61 | + * @return string WHERE clause part |
|
| 62 | + */ |
|
| 63 | + public static function BEenableFields($table, $inv = false) |
|
| 64 | + { |
|
| 65 | + $ctrl = $GLOBALS['TCA'][$table]['ctrl']; |
|
| 66 | + $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 67 | + ->getConnectionForTable($table) |
|
| 68 | + ->getExpressionBuilder(); |
|
| 69 | + $query = $expressionBuilder->andX(); |
|
| 70 | + $invQuery = $expressionBuilder->orX(); |
|
| 71 | 71 | |
| 72 | - if (is_array($ctrl)) { |
|
| 73 | - if (is_array($ctrl['enablecolumns'])) { |
|
| 74 | - if ($ctrl['enablecolumns']['disabled'] ?? false) { |
|
| 75 | - $field = $table . '.' . $ctrl['enablecolumns']['disabled']; |
|
| 76 | - $query->add($expressionBuilder->eq($field, 0)); |
|
| 77 | - $invQuery->add($expressionBuilder->neq($field, 0)); |
|
| 78 | - } |
|
| 79 | - if ($ctrl['enablecolumns']['starttime'] ?? false) { |
|
| 80 | - $field = $table . '.' . $ctrl['enablecolumns']['starttime']; |
|
| 81 | - $query->add($expressionBuilder->lte($field, (int)$GLOBALS['SIM_ACCESS_TIME'])); |
|
| 82 | - $invQuery->add( |
|
| 83 | - $expressionBuilder->andX( |
|
| 84 | - $expressionBuilder->neq($field, 0), |
|
| 85 | - $expressionBuilder->gt($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 86 | - ) |
|
| 87 | - ); |
|
| 88 | - } |
|
| 89 | - if ($ctrl['enablecolumns']['endtime'] ?? false) { |
|
| 90 | - $field = $table . '.' . $ctrl['enablecolumns']['endtime']; |
|
| 91 | - $query->add( |
|
| 92 | - $expressionBuilder->orX( |
|
| 93 | - $expressionBuilder->eq($field, 0), |
|
| 94 | - $expressionBuilder->gt($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 95 | - ) |
|
| 96 | - ); |
|
| 97 | - $invQuery->add( |
|
| 98 | - $expressionBuilder->andX( |
|
| 99 | - $expressionBuilder->neq($field, 0), |
|
| 100 | - $expressionBuilder->lte($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 101 | - ) |
|
| 102 | - ); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - } |
|
| 72 | + if (is_array($ctrl)) { |
|
| 73 | + if (is_array($ctrl['enablecolumns'])) { |
|
| 74 | + if ($ctrl['enablecolumns']['disabled'] ?? false) { |
|
| 75 | + $field = $table . '.' . $ctrl['enablecolumns']['disabled']; |
|
| 76 | + $query->add($expressionBuilder->eq($field, 0)); |
|
| 77 | + $invQuery->add($expressionBuilder->neq($field, 0)); |
|
| 78 | + } |
|
| 79 | + if ($ctrl['enablecolumns']['starttime'] ?? false) { |
|
| 80 | + $field = $table . '.' . $ctrl['enablecolumns']['starttime']; |
|
| 81 | + $query->add($expressionBuilder->lte($field, (int)$GLOBALS['SIM_ACCESS_TIME'])); |
|
| 82 | + $invQuery->add( |
|
| 83 | + $expressionBuilder->andX( |
|
| 84 | + $expressionBuilder->neq($field, 0), |
|
| 85 | + $expressionBuilder->gt($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 86 | + ) |
|
| 87 | + ); |
|
| 88 | + } |
|
| 89 | + if ($ctrl['enablecolumns']['endtime'] ?? false) { |
|
| 90 | + $field = $table . '.' . $ctrl['enablecolumns']['endtime']; |
|
| 91 | + $query->add( |
|
| 92 | + $expressionBuilder->orX( |
|
| 93 | + $expressionBuilder->eq($field, 0), |
|
| 94 | + $expressionBuilder->gt($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 95 | + ) |
|
| 96 | + ); |
|
| 97 | + $invQuery->add( |
|
| 98 | + $expressionBuilder->andX( |
|
| 99 | + $expressionBuilder->neq($field, 0), |
|
| 100 | + $expressionBuilder->lte($field, (int)$GLOBALS['SIM_ACCESS_TIME']) |
|
| 101 | + ) |
|
| 102 | + ); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - if ($query->count() === 0) { |
|
| 108 | - return ''; |
|
| 109 | - } |
|
| 107 | + if ($query->count() === 0) { |
|
| 108 | + return ''; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - return ' AND ' . ($inv ? $invQuery : $query); |
|
| 112 | - } |
|
| 111 | + return ' AND ' . ($inv ? $invQuery : $query); |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Returns the URL to a given module |
|
| 116 | - * |
|
| 117 | - * @param string $moduleName Name of the module |
|
| 118 | - * @param array $urlParameters URL parameters that should be added as key value pairs |
|
| 119 | - * @return string Calculated URL |
|
| 120 | - */ |
|
| 121 | - public static function getModuleUrl($moduleName, $urlParameters = []) |
|
| 122 | - { |
|
| 123 | - $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
|
| 124 | - try { |
|
| 125 | - $uri = $uriBuilder->buildUriFromRoute($moduleName, $urlParameters); |
|
| 126 | - } catch (RouteNotFoundException $e) { |
|
| 127 | - $uri = $uriBuilder->buildUriFromRoutePath($moduleName, $urlParameters); |
|
| 128 | - } |
|
| 129 | - return (string)$uri; |
|
| 130 | - } |
|
| 114 | + /** |
|
| 115 | + * Returns the URL to a given module |
|
| 116 | + * |
|
| 117 | + * @param string $moduleName Name of the module |
|
| 118 | + * @param array $urlParameters URL parameters that should be added as key value pairs |
|
| 119 | + * @return string Calculated URL |
|
| 120 | + */ |
|
| 121 | + public static function getModuleUrl($moduleName, $urlParameters = []) |
|
| 122 | + { |
|
| 123 | + $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); |
|
| 124 | + try { |
|
| 125 | + $uri = $uriBuilder->buildUriFromRoute($moduleName, $urlParameters); |
|
| 126 | + } catch (RouteNotFoundException $e) { |
|
| 127 | + $uri = $uriBuilder->buildUriFromRoutePath($moduleName, $urlParameters); |
|
| 128 | + } |
|
| 129 | + return (string)$uri; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | } |
@@ -22,110 +22,110 @@ |
||
| 22 | 22 | class FacetSuggestionService |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Retrieve possible suggestions for a field name |
|
| 27 | - * |
|
| 28 | - * @param string $fieldNameAndPath |
|
| 29 | - * @return array |
|
| 30 | - */ |
|
| 31 | - public function getSuggestions($fieldNameAndPath): array |
|
| 32 | - { |
|
| 33 | - $values = []; |
|
| 34 | - |
|
| 35 | - $dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath); |
|
| 36 | - $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 37 | - |
|
| 38 | - if (Tca::grid()->facet($fieldNameAndPath)->hasSuggestions()) { |
|
| 39 | - $values = Tca::grid()->facet($fieldNameAndPath)->getSuggestions(); |
|
| 40 | - } else if (Tca::table($dataType)->hasField($fieldName)) { |
|
| 41 | - |
|
| 42 | - if (Tca::table($dataType)->field($fieldName)->hasRelation()) { |
|
| 43 | - |
|
| 44 | - // Fetch the adequate repository |
|
| 45 | - $foreignTable = Tca::table($dataType)->field($fieldName)->getForeignTable(); |
|
| 46 | - $contentRepository = ContentRepositoryFactory::getInstance($foreignTable); |
|
| 47 | - $table = Tca::table($foreignTable); |
|
| 48 | - |
|
| 49 | - // Initialize the matcher object. |
|
| 50 | - $matcher = MatcherObjectFactory::getInstance()->getMatcher([], $foreignTable); |
|
| 51 | - |
|
| 52 | - $numberOfValues = $contentRepository->countBy($matcher); |
|
| 53 | - if ($numberOfValues <= $this->getLimit()) { |
|
| 54 | - |
|
| 55 | - $contents = $contentRepository->findBy($matcher); |
|
| 56 | - |
|
| 57 | - foreach ($contents as $content) { |
|
| 58 | - $values[] = array($content->getUid() => $content[$table->getLabelField()]); |
|
| 59 | - } |
|
| 60 | - } |
|
| 61 | - } elseif (!Tca::table($dataType)->field($fieldName)->isTextArea()) { // We don't want suggestion if field is text area. |
|
| 62 | - // Fetch the adequate repository |
|
| 63 | - /** @var ContentRepository $contentRepository */ |
|
| 64 | - $contentRepository = ContentRepositoryFactory::getInstance($dataType); |
|
| 65 | - |
|
| 66 | - // Initialize some objects related to the query |
|
| 67 | - $matcher = MatcherObjectFactory::getInstance()->getMatcher([], $dataType); |
|
| 68 | - |
|
| 69 | - // Count the number of objects. |
|
| 70 | - $numberOfValues = $contentRepository->countDistinctValues($fieldName, $matcher); |
|
| 71 | - |
|
| 72 | - // Only returns suggestion if there are not too many for the browser. |
|
| 73 | - if ($numberOfValues <= $this->getLimit()) { |
|
| 74 | - |
|
| 75 | - // Query the repository. |
|
| 76 | - $contents = $contentRepository->findDistinctValues($fieldName, $matcher); |
|
| 77 | - |
|
| 78 | - foreach ($contents as $content) { |
|
| 79 | - |
|
| 80 | - $value = $content[$fieldName]; |
|
| 81 | - $label = $content[$fieldName]; |
|
| 82 | - if (Tca::table($dataType)->field($fieldName)->isSelect()) { |
|
| 83 | - $label = Tca::table($dataType)->field($fieldName)->getLabelForItem($value); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - $values[] = $label; |
|
| 87 | - } |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - return $values; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * Return from settings the suggestion limit. |
|
| 96 | - * |
|
| 97 | - * @return int |
|
| 98 | - */ |
|
| 99 | - protected function getLimit(): int |
|
| 100 | - { |
|
| 101 | - $settings = $this->getSettings(); |
|
| 102 | - $suggestionLimit = (int)$settings['suggestionLimit']; |
|
| 103 | - if ($suggestionLimit <= 0) { |
|
| 104 | - $suggestionLimit = 1000; |
|
| 105 | - } |
|
| 106 | - return $suggestionLimit; |
|
| 107 | - } |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @return FieldPathResolver|object |
|
| 111 | - */ |
|
| 112 | - protected function getFieldPathResolver() |
|
| 113 | - { |
|
| 114 | - return GeneralUtility::makeInstance(FieldPathResolver::class); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Returns the module settings. |
|
| 119 | - * |
|
| 120 | - * @return array |
|
| 121 | - */ |
|
| 122 | - protected function getSettings() |
|
| 123 | - { |
|
| 124 | - /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 125 | - $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
| 126 | - $backendConfigurationManager = $objectManager->get('TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager'); |
|
| 127 | - $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 128 | - return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 129 | - } |
|
| 25 | + /** |
|
| 26 | + * Retrieve possible suggestions for a field name |
|
| 27 | + * |
|
| 28 | + * @param string $fieldNameAndPath |
|
| 29 | + * @return array |
|
| 30 | + */ |
|
| 31 | + public function getSuggestions($fieldNameAndPath): array |
|
| 32 | + { |
|
| 33 | + $values = []; |
|
| 34 | + |
|
| 35 | + $dataType = $this->getFieldPathResolver()->getDataType($fieldNameAndPath); |
|
| 36 | + $fieldName = $this->getFieldPathResolver()->stripFieldPath($fieldNameAndPath); |
|
| 37 | + |
|
| 38 | + if (Tca::grid()->facet($fieldNameAndPath)->hasSuggestions()) { |
|
| 39 | + $values = Tca::grid()->facet($fieldNameAndPath)->getSuggestions(); |
|
| 40 | + } else if (Tca::table($dataType)->hasField($fieldName)) { |
|
| 41 | + |
|
| 42 | + if (Tca::table($dataType)->field($fieldName)->hasRelation()) { |
|
| 43 | + |
|
| 44 | + // Fetch the adequate repository |
|
| 45 | + $foreignTable = Tca::table($dataType)->field($fieldName)->getForeignTable(); |
|
| 46 | + $contentRepository = ContentRepositoryFactory::getInstance($foreignTable); |
|
| 47 | + $table = Tca::table($foreignTable); |
|
| 48 | + |
|
| 49 | + // Initialize the matcher object. |
|
| 50 | + $matcher = MatcherObjectFactory::getInstance()->getMatcher([], $foreignTable); |
|
| 51 | + |
|
| 52 | + $numberOfValues = $contentRepository->countBy($matcher); |
|
| 53 | + if ($numberOfValues <= $this->getLimit()) { |
|
| 54 | + |
|
| 55 | + $contents = $contentRepository->findBy($matcher); |
|
| 56 | + |
|
| 57 | + foreach ($contents as $content) { |
|
| 58 | + $values[] = array($content->getUid() => $content[$table->getLabelField()]); |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | + } elseif (!Tca::table($dataType)->field($fieldName)->isTextArea()) { // We don't want suggestion if field is text area. |
|
| 62 | + // Fetch the adequate repository |
|
| 63 | + /** @var ContentRepository $contentRepository */ |
|
| 64 | + $contentRepository = ContentRepositoryFactory::getInstance($dataType); |
|
| 65 | + |
|
| 66 | + // Initialize some objects related to the query |
|
| 67 | + $matcher = MatcherObjectFactory::getInstance()->getMatcher([], $dataType); |
|
| 68 | + |
|
| 69 | + // Count the number of objects. |
|
| 70 | + $numberOfValues = $contentRepository->countDistinctValues($fieldName, $matcher); |
|
| 71 | + |
|
| 72 | + // Only returns suggestion if there are not too many for the browser. |
|
| 73 | + if ($numberOfValues <= $this->getLimit()) { |
|
| 74 | + |
|
| 75 | + // Query the repository. |
|
| 76 | + $contents = $contentRepository->findDistinctValues($fieldName, $matcher); |
|
| 77 | + |
|
| 78 | + foreach ($contents as $content) { |
|
| 79 | + |
|
| 80 | + $value = $content[$fieldName]; |
|
| 81 | + $label = $content[$fieldName]; |
|
| 82 | + if (Tca::table($dataType)->field($fieldName)->isSelect()) { |
|
| 83 | + $label = Tca::table($dataType)->field($fieldName)->getLabelForItem($value); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + $values[] = $label; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + return $values; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * Return from settings the suggestion limit. |
|
| 96 | + * |
|
| 97 | + * @return int |
|
| 98 | + */ |
|
| 99 | + protected function getLimit(): int |
|
| 100 | + { |
|
| 101 | + $settings = $this->getSettings(); |
|
| 102 | + $suggestionLimit = (int)$settings['suggestionLimit']; |
|
| 103 | + if ($suggestionLimit <= 0) { |
|
| 104 | + $suggestionLimit = 1000; |
|
| 105 | + } |
|
| 106 | + return $suggestionLimit; |
|
| 107 | + } |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @return FieldPathResolver|object |
|
| 111 | + */ |
|
| 112 | + protected function getFieldPathResolver() |
|
| 113 | + { |
|
| 114 | + return GeneralUtility::makeInstance(FieldPathResolver::class); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Returns the module settings. |
|
| 119 | + * |
|
| 120 | + * @return array |
|
| 121 | + */ |
|
| 122 | + protected function getSettings() |
|
| 123 | + { |
|
| 124 | + /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 125 | + $objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
|
| 126 | + $backendConfigurationManager = $objectManager->get('TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager'); |
|
| 127 | + $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 128 | + return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | 131 | } |
@@ -16,143 +16,143 @@ |
||
| 16 | 16 | class ProcessContentDataSignalArguments |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var Content |
|
| 21 | - */ |
|
| 22 | - protected $contentObject; |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @var array |
|
| 26 | - */ |
|
| 27 | - protected $contentData; |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * @var string |
|
| 31 | - */ |
|
| 32 | - protected $fieldNameAndPath; |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * @var int |
|
| 36 | - */ |
|
| 37 | - protected $counter; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var int |
|
| 41 | - */ |
|
| 42 | - protected $savingBehavior; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @var int |
|
| 46 | - */ |
|
| 47 | - protected $language; |
|
| 48 | - |
|
| 49 | - /** |
|
| 50 | - * @param array $contentData |
|
| 51 | - * @return $this |
|
| 52 | - */ |
|
| 53 | - public function setContentData($contentData) |
|
| 54 | - { |
|
| 55 | - $this->contentData = $contentData; |
|
| 56 | - return $this; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - /** |
|
| 60 | - * @return array |
|
| 61 | - */ |
|
| 62 | - public function getContentData() |
|
| 63 | - { |
|
| 64 | - return $this->contentData; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * @param Content $contentObject |
|
| 69 | - * @return $this |
|
| 70 | - */ |
|
| 71 | - public function setContentObject($contentObject) |
|
| 72 | - { |
|
| 73 | - $this->contentObject = $contentObject; |
|
| 74 | - return $this; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * @return Content |
|
| 79 | - */ |
|
| 80 | - public function getContentObject() |
|
| 81 | - { |
|
| 82 | - return $this->contentObject; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @param string $fieldNameAndPath |
|
| 87 | - * @return $this |
|
| 88 | - */ |
|
| 89 | - public function setFieldNameAndPath($fieldNameAndPath) |
|
| 90 | - { |
|
| 91 | - $this->fieldNameAndPath = $fieldNameAndPath; |
|
| 92 | - return $this; |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @return string |
|
| 97 | - */ |
|
| 98 | - public function getFieldNameAndPath() |
|
| 99 | - { |
|
| 100 | - return $this->fieldNameAndPath; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @param int $counter |
|
| 105 | - * @return $this |
|
| 106 | - */ |
|
| 107 | - public function setCounter($counter) |
|
| 108 | - { |
|
| 109 | - $this->counter = $counter; |
|
| 110 | - return $this; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * @return int |
|
| 115 | - */ |
|
| 116 | - public function getCounter() |
|
| 117 | - { |
|
| 118 | - return $this->counter; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @param int $savingBehavior |
|
| 123 | - * @return $this |
|
| 124 | - */ |
|
| 125 | - public function setSavingBehavior($savingBehavior) |
|
| 126 | - { |
|
| 127 | - $this->savingBehavior = $savingBehavior; |
|
| 128 | - return $this; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @return int |
|
| 133 | - */ |
|
| 134 | - public function getSavingBehavior() |
|
| 135 | - { |
|
| 136 | - return $this->savingBehavior; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * @return int |
|
| 141 | - */ |
|
| 142 | - public function getLanguage() |
|
| 143 | - { |
|
| 144 | - return $this->language; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - /** |
|
| 148 | - * @param int $language |
|
| 149 | - * @return $this |
|
| 150 | - */ |
|
| 151 | - public function setLanguage($language) |
|
| 152 | - { |
|
| 153 | - $this->language = $language; |
|
| 154 | - return $this; |
|
| 155 | - } |
|
| 19 | + /** |
|
| 20 | + * @var Content |
|
| 21 | + */ |
|
| 22 | + protected $contentObject; |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @var array |
|
| 26 | + */ |
|
| 27 | + protected $contentData; |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * @var string |
|
| 31 | + */ |
|
| 32 | + protected $fieldNameAndPath; |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * @var int |
|
| 36 | + */ |
|
| 37 | + protected $counter; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var int |
|
| 41 | + */ |
|
| 42 | + protected $savingBehavior; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @var int |
|
| 46 | + */ |
|
| 47 | + protected $language; |
|
| 48 | + |
|
| 49 | + /** |
|
| 50 | + * @param array $contentData |
|
| 51 | + * @return $this |
|
| 52 | + */ |
|
| 53 | + public function setContentData($contentData) |
|
| 54 | + { |
|
| 55 | + $this->contentData = $contentData; |
|
| 56 | + return $this; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + /** |
|
| 60 | + * @return array |
|
| 61 | + */ |
|
| 62 | + public function getContentData() |
|
| 63 | + { |
|
| 64 | + return $this->contentData; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * @param Content $contentObject |
|
| 69 | + * @return $this |
|
| 70 | + */ |
|
| 71 | + public function setContentObject($contentObject) |
|
| 72 | + { |
|
| 73 | + $this->contentObject = $contentObject; |
|
| 74 | + return $this; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * @return Content |
|
| 79 | + */ |
|
| 80 | + public function getContentObject() |
|
| 81 | + { |
|
| 82 | + return $this->contentObject; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @param string $fieldNameAndPath |
|
| 87 | + * @return $this |
|
| 88 | + */ |
|
| 89 | + public function setFieldNameAndPath($fieldNameAndPath) |
|
| 90 | + { |
|
| 91 | + $this->fieldNameAndPath = $fieldNameAndPath; |
|
| 92 | + return $this; |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @return string |
|
| 97 | + */ |
|
| 98 | + public function getFieldNameAndPath() |
|
| 99 | + { |
|
| 100 | + return $this->fieldNameAndPath; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @param int $counter |
|
| 105 | + * @return $this |
|
| 106 | + */ |
|
| 107 | + public function setCounter($counter) |
|
| 108 | + { |
|
| 109 | + $this->counter = $counter; |
|
| 110 | + return $this; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * @return int |
|
| 115 | + */ |
|
| 116 | + public function getCounter() |
|
| 117 | + { |
|
| 118 | + return $this->counter; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @param int $savingBehavior |
|
| 123 | + * @return $this |
|
| 124 | + */ |
|
| 125 | + public function setSavingBehavior($savingBehavior) |
|
| 126 | + { |
|
| 127 | + $this->savingBehavior = $savingBehavior; |
|
| 128 | + return $this; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @return int |
|
| 133 | + */ |
|
| 134 | + public function getSavingBehavior() |
|
| 135 | + { |
|
| 136 | + return $this->savingBehavior; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @return int |
|
| 141 | + */ |
|
| 142 | + public function getLanguage() |
|
| 143 | + { |
|
| 144 | + return $this->language; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + /** |
|
| 148 | + * @param int $language |
|
| 149 | + * @return $this |
|
| 150 | + */ |
|
| 151 | + public function setLanguage($language) |
|
| 152 | + { |
|
| 153 | + $this->language = $language; |
|
| 154 | + return $this; |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | 157 | |
| 158 | 158 | } |
@@ -17,188 +17,188 @@ |
||
| 17 | 17 | class AfterFindContentObjectsSignalArguments |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var string |
|
| 22 | - */ |
|
| 23 | - protected $dataType; |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @var array |
|
| 27 | - */ |
|
| 28 | - protected $contentObjects; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @var Matcher |
|
| 32 | - */ |
|
| 33 | - protected $matcher; |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @var Order |
|
| 37 | - */ |
|
| 38 | - protected $order; |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * @var int |
|
| 42 | - */ |
|
| 43 | - protected $limit; |
|
| 44 | - |
|
| 45 | - /** |
|
| 46 | - * @var int |
|
| 47 | - */ |
|
| 48 | - protected $offset; |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @var bool |
|
| 52 | - */ |
|
| 53 | - protected $hasBeenProcessed; |
|
| 54 | - |
|
| 55 | - /** |
|
| 56 | - * @var int |
|
| 57 | - */ |
|
| 58 | - protected $numberOfObjects = 0; |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * @param array $contentObjects |
|
| 62 | - * @return $this |
|
| 63 | - */ |
|
| 64 | - public function setContentObjects($contentObjects) |
|
| 65 | - { |
|
| 66 | - $this->contentObjects = $contentObjects; |
|
| 67 | - return $this; |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - /** |
|
| 71 | - * @return array |
|
| 72 | - */ |
|
| 73 | - public function getContentObjects() |
|
| 74 | - { |
|
| 75 | - return $this->contentObjects; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * @param string $dataType |
|
| 80 | - * @return $this |
|
| 81 | - */ |
|
| 82 | - public function setDataType($dataType) |
|
| 83 | - { |
|
| 84 | - $this->dataType = $dataType; |
|
| 85 | - return $this; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function getDataType() |
|
| 92 | - { |
|
| 93 | - return $this->dataType; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @param boolean $hasBeenProcessed |
|
| 98 | - * @return $this |
|
| 99 | - */ |
|
| 100 | - public function setHasBeenProcessed($hasBeenProcessed) |
|
| 101 | - { |
|
| 102 | - $this->hasBeenProcessed = $hasBeenProcessed; |
|
| 103 | - return $this; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @return boolean |
|
| 108 | - */ |
|
| 109 | - public function getHasBeenProcessed() |
|
| 110 | - { |
|
| 111 | - return $this->hasBeenProcessed; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - /** |
|
| 115 | - * @param int $limit |
|
| 116 | - * @return $this |
|
| 117 | - */ |
|
| 118 | - public function setLimit($limit) |
|
| 119 | - { |
|
| 120 | - $this->limit = $limit; |
|
| 121 | - return $this; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @return int |
|
| 126 | - */ |
|
| 127 | - public function getLimit() |
|
| 128 | - { |
|
| 129 | - return $this->limit; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * @param Matcher $matcher |
|
| 134 | - * @return $this |
|
| 135 | - */ |
|
| 136 | - public function setMatcher($matcher) |
|
| 137 | - { |
|
| 138 | - $this->matcher = $matcher; |
|
| 139 | - return $this; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @return Matcher |
|
| 144 | - */ |
|
| 145 | - public function getMatcher() |
|
| 146 | - { |
|
| 147 | - return $this->matcher; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * @return Order |
|
| 152 | - */ |
|
| 153 | - public function getOrder() |
|
| 154 | - { |
|
| 155 | - return $this->order; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * @param Order $order |
|
| 160 | - * @return $this |
|
| 161 | - */ |
|
| 162 | - public function setOrder($order) |
|
| 163 | - { |
|
| 164 | - $this->order = $order; |
|
| 165 | - return $this; |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * @param int $numberOfObjects |
|
| 170 | - * @return $this |
|
| 171 | - */ |
|
| 172 | - public function setNumberOfObjects($numberOfObjects) |
|
| 173 | - { |
|
| 174 | - $this->numberOfObjects = $numberOfObjects; |
|
| 175 | - return $this; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * @return int |
|
| 180 | - */ |
|
| 181 | - public function getNumberOfObjects() |
|
| 182 | - { |
|
| 183 | - return $this->numberOfObjects; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * @param int $offset |
|
| 188 | - * @return $this |
|
| 189 | - */ |
|
| 190 | - public function setOffset($offset) |
|
| 191 | - { |
|
| 192 | - $this->offset = $offset; |
|
| 193 | - return $this; |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - /** |
|
| 197 | - * @return int |
|
| 198 | - */ |
|
| 199 | - public function getOffset() |
|
| 200 | - { |
|
| 201 | - return $this->offset; |
|
| 202 | - } |
|
| 20 | + /** |
|
| 21 | + * @var string |
|
| 22 | + */ |
|
| 23 | + protected $dataType; |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @var array |
|
| 27 | + */ |
|
| 28 | + protected $contentObjects; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @var Matcher |
|
| 32 | + */ |
|
| 33 | + protected $matcher; |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @var Order |
|
| 37 | + */ |
|
| 38 | + protected $order; |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * @var int |
|
| 42 | + */ |
|
| 43 | + protected $limit; |
|
| 44 | + |
|
| 45 | + /** |
|
| 46 | + * @var int |
|
| 47 | + */ |
|
| 48 | + protected $offset; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @var bool |
|
| 52 | + */ |
|
| 53 | + protected $hasBeenProcessed; |
|
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @var int |
|
| 57 | + */ |
|
| 58 | + protected $numberOfObjects = 0; |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * @param array $contentObjects |
|
| 62 | + * @return $this |
|
| 63 | + */ |
|
| 64 | + public function setContentObjects($contentObjects) |
|
| 65 | + { |
|
| 66 | + $this->contentObjects = $contentObjects; |
|
| 67 | + return $this; |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + /** |
|
| 71 | + * @return array |
|
| 72 | + */ |
|
| 73 | + public function getContentObjects() |
|
| 74 | + { |
|
| 75 | + return $this->contentObjects; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * @param string $dataType |
|
| 80 | + * @return $this |
|
| 81 | + */ |
|
| 82 | + public function setDataType($dataType) |
|
| 83 | + { |
|
| 84 | + $this->dataType = $dataType; |
|
| 85 | + return $this; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function getDataType() |
|
| 92 | + { |
|
| 93 | + return $this->dataType; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @param boolean $hasBeenProcessed |
|
| 98 | + * @return $this |
|
| 99 | + */ |
|
| 100 | + public function setHasBeenProcessed($hasBeenProcessed) |
|
| 101 | + { |
|
| 102 | + $this->hasBeenProcessed = $hasBeenProcessed; |
|
| 103 | + return $this; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @return boolean |
|
| 108 | + */ |
|
| 109 | + public function getHasBeenProcessed() |
|
| 110 | + { |
|
| 111 | + return $this->hasBeenProcessed; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + /** |
|
| 115 | + * @param int $limit |
|
| 116 | + * @return $this |
|
| 117 | + */ |
|
| 118 | + public function setLimit($limit) |
|
| 119 | + { |
|
| 120 | + $this->limit = $limit; |
|
| 121 | + return $this; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @return int |
|
| 126 | + */ |
|
| 127 | + public function getLimit() |
|
| 128 | + { |
|
| 129 | + return $this->limit; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * @param Matcher $matcher |
|
| 134 | + * @return $this |
|
| 135 | + */ |
|
| 136 | + public function setMatcher($matcher) |
|
| 137 | + { |
|
| 138 | + $this->matcher = $matcher; |
|
| 139 | + return $this; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @return Matcher |
|
| 144 | + */ |
|
| 145 | + public function getMatcher() |
|
| 146 | + { |
|
| 147 | + return $this->matcher; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * @return Order |
|
| 152 | + */ |
|
| 153 | + public function getOrder() |
|
| 154 | + { |
|
| 155 | + return $this->order; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * @param Order $order |
|
| 160 | + * @return $this |
|
| 161 | + */ |
|
| 162 | + public function setOrder($order) |
|
| 163 | + { |
|
| 164 | + $this->order = $order; |
|
| 165 | + return $this; |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * @param int $numberOfObjects |
|
| 170 | + * @return $this |
|
| 171 | + */ |
|
| 172 | + public function setNumberOfObjects($numberOfObjects) |
|
| 173 | + { |
|
| 174 | + $this->numberOfObjects = $numberOfObjects; |
|
| 175 | + return $this; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * @return int |
|
| 180 | + */ |
|
| 181 | + public function getNumberOfObjects() |
|
| 182 | + { |
|
| 183 | + return $this->numberOfObjects; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * @param int $offset |
|
| 188 | + * @return $this |
|
| 189 | + */ |
|
| 190 | + public function setOffset($offset) |
|
| 191 | + { |
|
| 192 | + $this->offset = $offset; |
|
| 193 | + return $this; |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + /** |
|
| 197 | + * @return int |
|
| 198 | + */ |
|
| 199 | + public function getOffset() |
|
| 200 | + { |
|
| 201 | + return $this->offset; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | 204 | } |
@@ -18,31 +18,31 @@ |
||
| 18 | 18 | class VisibilityOptionsViewHelper extends AbstractViewHelper |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Returns the options for the visibility field of a Selection. |
|
| 23 | - * |
|
| 24 | - * @return array |
|
| 25 | - */ |
|
| 26 | - public function render() |
|
| 27 | - { |
|
| 28 | - $options[Selection::VISIBILITY_PRIVATE] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.private', 'vidi'); |
|
| 29 | - $options[Selection::VISIBILITY_EVERYONE] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.everyone', 'vidi'); |
|
| 21 | + /** |
|
| 22 | + * Returns the options for the visibility field of a Selection. |
|
| 23 | + * |
|
| 24 | + * @return array |
|
| 25 | + */ |
|
| 26 | + public function render() |
|
| 27 | + { |
|
| 28 | + $options[Selection::VISIBILITY_PRIVATE] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.private', 'vidi'); |
|
| 29 | + $options[Selection::VISIBILITY_EVERYONE] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.everyone', 'vidi'); |
|
| 30 | 30 | |
| 31 | - if ($this->getBackendUser()->isAdmin()) { |
|
| 32 | - $options[Selection::VISIBILITY_ADMIN_ONLY] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.admin_only', 'vidi'); |
|
| 33 | - } |
|
| 34 | - return $options; |
|
| 35 | - } |
|
| 31 | + if ($this->getBackendUser()->isAdmin()) { |
|
| 32 | + $options[Selection::VISIBILITY_ADMIN_ONLY] = LocalizationUtility::translate('LLL:EXT:vidi/Resources/Private/Language/tx_vidi_selection.xlf:visibility.admin_only', 'vidi'); |
|
| 33 | + } |
|
| 34 | + return $options; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Returns an instance of the current Backend User. |
|
| 40 | - * |
|
| 41 | - * @return BackendUserAuthentication |
|
| 42 | - */ |
|
| 43 | - protected function getBackendUser() |
|
| 44 | - { |
|
| 45 | - return $GLOBALS['BE_USER']; |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * Returns an instance of the current Backend User. |
|
| 40 | + * |
|
| 41 | + * @return BackendUserAuthentication |
|
| 42 | + */ |
|
| 43 | + protected function getBackendUser() |
|
| 44 | + { |
|
| 45 | + return $GLOBALS['BE_USER']; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | \ No newline at end of file |
@@ -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 ModuleLoader|object |
|
| 69 | - */ |
|
| 70 | - protected function getModuleLoader() |
|
| 71 | - { |
|
| 72 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 73 | - } |
|
| 65 | + /** |
|
| 66 | + * Get the Vidi Module Loader. |
|
| 67 | + * |
|
| 68 | + * @return ModuleLoader|object |
|
| 69 | + */ |
|
| 70 | + protected function getModuleLoader() |
|
| 71 | + { |
|
| 72 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 73 | + } |
|
| 74 | 74 | } |
@@ -21,48 +21,48 @@ |
||
| 21 | 21 | class AdditionalAssetsViewHelper extends AbstractBackendViewHelper |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * @var PageRenderer |
|
| 26 | - * @Inject |
|
| 27 | - */ |
|
| 28 | - public $pageRenderer; |
|
| 24 | + /** |
|
| 25 | + * @var PageRenderer |
|
| 26 | + * @Inject |
|
| 27 | + */ |
|
| 28 | + public $pageRenderer; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Load the assets (JavaScript, CSS) for this Vidi module. |
|
| 32 | - * |
|
| 33 | - * @return void |
|
| 34 | - * @api |
|
| 35 | - */ |
|
| 36 | - public function render() |
|
| 37 | - { |
|
| 38 | - /** @var ModuleLoader $moduleLoader */ |
|
| 39 | - $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 30 | + /** |
|
| 31 | + * Load the assets (JavaScript, CSS) for this Vidi module. |
|
| 32 | + * |
|
| 33 | + * @return void |
|
| 34 | + * @api |
|
| 35 | + */ |
|
| 36 | + public function render() |
|
| 37 | + { |
|
| 38 | + /** @var ModuleLoader $moduleLoader */ |
|
| 39 | + $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 40 | 40 | |
| 41 | - foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) { |
|
| 42 | - $fileNameAndPath = $this->resolvePath($addCssFile); |
|
| 43 | - $this->pageRenderer->addCssFile($fileNameAndPath); |
|
| 44 | - } |
|
| 41 | + foreach ($moduleLoader->getAdditionalStyleSheetFiles() as $addCssFile) { |
|
| 42 | + $fileNameAndPath = $this->resolvePath($addCssFile); |
|
| 43 | + $this->pageRenderer->addCssFile($fileNameAndPath); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) { |
|
| 47 | - $fileNameAndPath = $this->resolvePath($addJsFile); |
|
| 48 | - $this->pageRenderer->addJsFile($fileNameAndPath); |
|
| 49 | - } |
|
| 50 | - } |
|
| 46 | + foreach ($moduleLoader->getAdditionalJavaScriptFiles() as $addJsFile) { |
|
| 47 | + $fileNameAndPath = $this->resolvePath($addJsFile); |
|
| 48 | + $this->pageRenderer->addJsFile($fileNameAndPath); |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Resolve a resource path. |
|
| 54 | - * |
|
| 55 | - * @param string $uri |
|
| 56 | - * @return string |
|
| 57 | - */ |
|
| 58 | - protected function resolvePath($uri) |
|
| 59 | - { |
|
| 60 | - $uri = GeneralUtility::getFileAbsFileName($uri); |
|
| 61 | - $uri = substr($uri, strlen(Environment::getPublicPath() . '/')); |
|
| 62 | - if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() && $uri !== false) { |
|
| 63 | - $uri = '../' . $uri; |
|
| 64 | - } |
|
| 65 | - return $uri; |
|
| 66 | - } |
|
| 52 | + /** |
|
| 53 | + * Resolve a resource path. |
|
| 54 | + * |
|
| 55 | + * @param string $uri |
|
| 56 | + * @return string |
|
| 57 | + */ |
|
| 58 | + protected function resolvePath($uri) |
|
| 59 | + { |
|
| 60 | + $uri = GeneralUtility::getFileAbsFileName($uri); |
|
| 61 | + $uri = substr($uri, strlen(Environment::getPublicPath() . '/')); |
|
| 62 | + if (ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend() && $uri !== false) { |
|
| 63 | + $uri = '../' . $uri; |
|
| 64 | + } |
|
| 65 | + return $uri; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | } |
@@ -17,28 +17,28 @@ |
||
| 17 | 17 | class LanguagesViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Returns an array of available languages. |
|
| 22 | - * |
|
| 23 | - * @return array |
|
| 24 | - */ |
|
| 25 | - public function render() |
|
| 26 | - { |
|
| 27 | - $languages[0] = $this->getLanguageService()->getDefaultFlag(); |
|
| 20 | + /** |
|
| 21 | + * Returns an array of available languages. |
|
| 22 | + * |
|
| 23 | + * @return array |
|
| 24 | + */ |
|
| 25 | + public function render() |
|
| 26 | + { |
|
| 27 | + $languages[0] = $this->getLanguageService()->getDefaultFlag(); |
|
| 28 | 28 | |
| 29 | - foreach ($this->getLanguageService()->getLanguages() as $language) { |
|
| 29 | + foreach ($this->getLanguageService()->getLanguages() as $language) { |
|
| 30 | 30 | |
| 31 | - $languages[$language['uid']] = $language['flag']; |
|
| 32 | - } |
|
| 31 | + $languages[$language['uid']] = $language['flag']; |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - return $languages; |
|
| 35 | - } |
|
| 34 | + return $languages; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @return LanguageService|object |
|
| 39 | - */ |
|
| 40 | - protected function getLanguageService() |
|
| 41 | - { |
|
| 42 | - return GeneralUtility::makeInstance(LanguageService::class); |
|
| 43 | - } |
|
| 37 | + /** |
|
| 38 | + * @return LanguageService|object |
|
| 39 | + */ |
|
| 40 | + protected function getLanguageService() |
|
| 41 | + { |
|
| 42 | + return GeneralUtility::makeInstance(LanguageService::class); |
|
| 43 | + } |
|
| 44 | 44 | } |