@@ -179,8 +179,8 @@ |
||
| 179 | 179 | $generalSettings = $this->getSettings(); |
| 180 | 180 | |
| 181 | 181 | $preferences = []; |
| 182 | - if (isset($generalSettings[$dataType . '.'])) { |
|
| 183 | - $settings = $generalSettings[$dataType . '.']; |
|
| 182 | + if (isset($generalSettings[$dataType.'.'])) { |
|
| 183 | + $settings = $generalSettings[$dataType.'.']; |
|
| 184 | 184 | |
| 185 | 185 | $configurableParts = ConfigurablePart::getParts(); |
| 186 | 186 | foreach ($settings as $key => $value) { |
@@ -18,216 +18,216 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ModulePreferences implements SingletonInterface |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * @var array |
|
| 23 | - */ |
|
| 24 | - protected $preferences; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected $tableName = 'tx_vidi_preference'; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @param string $key |
|
| 33 | - * @param string $dataType |
|
| 34 | - * @return mixed |
|
| 35 | - */ |
|
| 36 | - public function get($key, $dataType = '') |
|
| 37 | - { |
|
| 38 | - if (empty($dataType)) { |
|
| 39 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - if (!$this->isLoaded($dataType)) { |
|
| 43 | - $this->load($dataType); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - $value = empty($this->preferences[$dataType][$key]) ? null : $this->preferences[$dataType][$key]; |
|
| 47 | - return $value; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * Tell whether the module is loaded. |
|
| 52 | - * |
|
| 53 | - * @param string $dataType |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 56 | - public function isLoaded($dataType) |
|
| 57 | - { |
|
| 58 | - return !empty($this->preferences[$dataType]); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @param string $dataType |
|
| 63 | - * @return array |
|
| 64 | - */ |
|
| 65 | - public function getAll($dataType = '') |
|
| 66 | - { |
|
| 67 | - if (empty($dataType)) { |
|
| 68 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 69 | - } |
|
| 70 | - $this->load($dataType); |
|
| 71 | - return $this->preferences[$dataType]; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Get the md5 signature of the preferences. |
|
| 76 | - * |
|
| 77 | - * @param string $dataType |
|
| 78 | - * @return bool |
|
| 79 | - */ |
|
| 80 | - public function getSignature($dataType = '') |
|
| 81 | - { |
|
| 82 | - $preferences = $this->getAll($dataType); |
|
| 83 | - return md5(serialize($preferences)); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Load preferences. |
|
| 88 | - * |
|
| 89 | - * @param string $dataType |
|
| 90 | - * @return void |
|
| 91 | - */ |
|
| 92 | - public function load($dataType) |
|
| 93 | - { |
|
| 94 | - // Fetch preferences from different sources and overlay them |
|
| 95 | - $databasePreferences = $this->fetchPreferencesFromDatabase($dataType); |
|
| 96 | - $generalPreferences = $this->fetchGlobalPreferencesFromTypoScript(); |
|
| 97 | - $specificPreferences = $this->fetchExtraPreferencesFromTypoScript($dataType); |
|
| 98 | - |
|
| 99 | - $preferences = array_merge($generalPreferences, $specificPreferences, $databasePreferences); |
|
| 100 | - $this->preferences[$dataType] = $preferences; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * Save preferences |
|
| 105 | - * |
|
| 106 | - * @param array $preferences |
|
| 107 | - * @return void |
|
| 108 | - */ |
|
| 109 | - public function save($preferences) |
|
| 110 | - { |
|
| 111 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 112 | - |
|
| 113 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 114 | - $this->getDataService()->delete( |
|
| 115 | - $this->tableName, |
|
| 116 | - [ |
|
| 117 | - 'data_type' => $dataType |
|
| 118 | - ] |
|
| 119 | - ); |
|
| 120 | - |
|
| 121 | - $sanitizedPreferences = []; |
|
| 122 | - foreach ($preferences as $key => $value) { |
|
| 123 | - if (in_array($key, $configurableParts)) { |
|
| 124 | - $sanitizedPreferences[$key] = $value; |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - $this->getDataService()->insert( |
|
| 129 | - $this->tableName, |
|
| 130 | - [ |
|
| 131 | - 'data_type' => $dataType, |
|
| 132 | - 'preferences' => serialize($sanitizedPreferences), |
|
| 133 | - ] |
|
| 134 | - ); |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - /** |
|
| 138 | - * @param $dataType |
|
| 139 | - * @return array |
|
| 140 | - */ |
|
| 141 | - public function fetchPreferencesFromDatabase($dataType) |
|
| 142 | - { |
|
| 143 | - $preferences = []; |
|
| 144 | - $record = $this->getDataService()->getRecord( |
|
| 145 | - $this->tableName, |
|
| 146 | - [ |
|
| 147 | - 'data_type' => $dataType |
|
| 148 | - ] |
|
| 149 | - ); |
|
| 150 | - |
|
| 151 | - if (!empty($record)) { |
|
| 152 | - $preferences = unserialize($record['preferences']); |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - return $preferences; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - /** |
|
| 159 | - * Returns the module settings. |
|
| 160 | - * |
|
| 161 | - * @return array |
|
| 162 | - */ |
|
| 163 | - protected function fetchGlobalPreferencesFromTypoScript() |
|
| 164 | - { |
|
| 165 | - $settings = $this->getSettings(); |
|
| 166 | - |
|
| 167 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 168 | - $preferences = []; |
|
| 169 | - foreach ($settings as $key => $value) { |
|
| 170 | - if (in_array($key, $configurableParts)) { |
|
| 171 | - $preferences[$key] = $value; |
|
| 172 | - } |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - return $preferences; |
|
| 176 | - } |
|
| 177 | - |
|
| 178 | - /** |
|
| 179 | - * Returns the module settings. |
|
| 180 | - * |
|
| 181 | - * @param string $dataType |
|
| 182 | - * @return array |
|
| 183 | - */ |
|
| 184 | - protected function fetchExtraPreferencesFromTypoScript($dataType) |
|
| 185 | - { |
|
| 186 | - $generalSettings = $this->getSettings(); |
|
| 187 | - |
|
| 188 | - $preferences = []; |
|
| 189 | - if (isset($generalSettings[$dataType . '.'])) { |
|
| 190 | - $settings = $generalSettings[$dataType . '.']; |
|
| 191 | - |
|
| 192 | - $configurableParts = ConfigurablePart::getParts(); |
|
| 193 | - foreach ($settings as $key => $value) { |
|
| 194 | - if (in_array($key, $configurableParts)) { |
|
| 195 | - $preferences[$key] = $value; |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - return $preferences; |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - /** |
|
| 204 | - * Returns the module settings. |
|
| 205 | - * |
|
| 206 | - * @return array |
|
| 207 | - */ |
|
| 208 | - protected function getSettings() |
|
| 209 | - { |
|
| 210 | - /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 211 | - $backendConfigurationManager = GeneralUtility::makeInstance(BackendConfigurationManager::class); |
|
| 212 | - $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 213 | - return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * @return object|DataService |
|
| 218 | - */ |
|
| 219 | - protected function getDataService(): DataService |
|
| 220 | - { |
|
| 221 | - return GeneralUtility::makeInstance(DataService::class); |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * Get the Vidi Module Loader. |
|
| 226 | - * |
|
| 227 | - * @return ModuleLoader|object |
|
| 228 | - */ |
|
| 229 | - protected function getModuleLoader() |
|
| 230 | - { |
|
| 231 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 232 | - } |
|
| 21 | + /** |
|
| 22 | + * @var array |
|
| 23 | + */ |
|
| 24 | + protected $preferences; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected $tableName = 'tx_vidi_preference'; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @param string $key |
|
| 33 | + * @param string $dataType |
|
| 34 | + * @return mixed |
|
| 35 | + */ |
|
| 36 | + public function get($key, $dataType = '') |
|
| 37 | + { |
|
| 38 | + if (empty($dataType)) { |
|
| 39 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + if (!$this->isLoaded($dataType)) { |
|
| 43 | + $this->load($dataType); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + $value = empty($this->preferences[$dataType][$key]) ? null : $this->preferences[$dataType][$key]; |
|
| 47 | + return $value; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * Tell whether the module is loaded. |
|
| 52 | + * |
|
| 53 | + * @param string $dataType |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | + public function isLoaded($dataType) |
|
| 57 | + { |
|
| 58 | + return !empty($this->preferences[$dataType]); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @param string $dataType |
|
| 63 | + * @return array |
|
| 64 | + */ |
|
| 65 | + public function getAll($dataType = '') |
|
| 66 | + { |
|
| 67 | + if (empty($dataType)) { |
|
| 68 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 69 | + } |
|
| 70 | + $this->load($dataType); |
|
| 71 | + return $this->preferences[$dataType]; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Get the md5 signature of the preferences. |
|
| 76 | + * |
|
| 77 | + * @param string $dataType |
|
| 78 | + * @return bool |
|
| 79 | + */ |
|
| 80 | + public function getSignature($dataType = '') |
|
| 81 | + { |
|
| 82 | + $preferences = $this->getAll($dataType); |
|
| 83 | + return md5(serialize($preferences)); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Load preferences. |
|
| 88 | + * |
|
| 89 | + * @param string $dataType |
|
| 90 | + * @return void |
|
| 91 | + */ |
|
| 92 | + public function load($dataType) |
|
| 93 | + { |
|
| 94 | + // Fetch preferences from different sources and overlay them |
|
| 95 | + $databasePreferences = $this->fetchPreferencesFromDatabase($dataType); |
|
| 96 | + $generalPreferences = $this->fetchGlobalPreferencesFromTypoScript(); |
|
| 97 | + $specificPreferences = $this->fetchExtraPreferencesFromTypoScript($dataType); |
|
| 98 | + |
|
| 99 | + $preferences = array_merge($generalPreferences, $specificPreferences, $databasePreferences); |
|
| 100 | + $this->preferences[$dataType] = $preferences; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * Save preferences |
|
| 105 | + * |
|
| 106 | + * @param array $preferences |
|
| 107 | + * @return void |
|
| 108 | + */ |
|
| 109 | + public function save($preferences) |
|
| 110 | + { |
|
| 111 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 112 | + |
|
| 113 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 114 | + $this->getDataService()->delete( |
|
| 115 | + $this->tableName, |
|
| 116 | + [ |
|
| 117 | + 'data_type' => $dataType |
|
| 118 | + ] |
|
| 119 | + ); |
|
| 120 | + |
|
| 121 | + $sanitizedPreferences = []; |
|
| 122 | + foreach ($preferences as $key => $value) { |
|
| 123 | + if (in_array($key, $configurableParts)) { |
|
| 124 | + $sanitizedPreferences[$key] = $value; |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + $this->getDataService()->insert( |
|
| 129 | + $this->tableName, |
|
| 130 | + [ |
|
| 131 | + 'data_type' => $dataType, |
|
| 132 | + 'preferences' => serialize($sanitizedPreferences), |
|
| 133 | + ] |
|
| 134 | + ); |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + /** |
|
| 138 | + * @param $dataType |
|
| 139 | + * @return array |
|
| 140 | + */ |
|
| 141 | + public function fetchPreferencesFromDatabase($dataType) |
|
| 142 | + { |
|
| 143 | + $preferences = []; |
|
| 144 | + $record = $this->getDataService()->getRecord( |
|
| 145 | + $this->tableName, |
|
| 146 | + [ |
|
| 147 | + 'data_type' => $dataType |
|
| 148 | + ] |
|
| 149 | + ); |
|
| 150 | + |
|
| 151 | + if (!empty($record)) { |
|
| 152 | + $preferences = unserialize($record['preferences']); |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + return $preferences; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + /** |
|
| 159 | + * Returns the module settings. |
|
| 160 | + * |
|
| 161 | + * @return array |
|
| 162 | + */ |
|
| 163 | + protected function fetchGlobalPreferencesFromTypoScript() |
|
| 164 | + { |
|
| 165 | + $settings = $this->getSettings(); |
|
| 166 | + |
|
| 167 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 168 | + $preferences = []; |
|
| 169 | + foreach ($settings as $key => $value) { |
|
| 170 | + if (in_array($key, $configurableParts)) { |
|
| 171 | + $preferences[$key] = $value; |
|
| 172 | + } |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + return $preferences; |
|
| 176 | + } |
|
| 177 | + |
|
| 178 | + /** |
|
| 179 | + * Returns the module settings. |
|
| 180 | + * |
|
| 181 | + * @param string $dataType |
|
| 182 | + * @return array |
|
| 183 | + */ |
|
| 184 | + protected function fetchExtraPreferencesFromTypoScript($dataType) |
|
| 185 | + { |
|
| 186 | + $generalSettings = $this->getSettings(); |
|
| 187 | + |
|
| 188 | + $preferences = []; |
|
| 189 | + if (isset($generalSettings[$dataType . '.'])) { |
|
| 190 | + $settings = $generalSettings[$dataType . '.']; |
|
| 191 | + |
|
| 192 | + $configurableParts = ConfigurablePart::getParts(); |
|
| 193 | + foreach ($settings as $key => $value) { |
|
| 194 | + if (in_array($key, $configurableParts)) { |
|
| 195 | + $preferences[$key] = $value; |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + return $preferences; |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + /** |
|
| 204 | + * Returns the module settings. |
|
| 205 | + * |
|
| 206 | + * @return array |
|
| 207 | + */ |
|
| 208 | + protected function getSettings() |
|
| 209 | + { |
|
| 210 | + /** @var BackendConfigurationManager $backendConfigurationManager */ |
|
| 211 | + $backendConfigurationManager = GeneralUtility::makeInstance(BackendConfigurationManager::class); |
|
| 212 | + $configuration = $backendConfigurationManager->getTypoScriptSetup(); |
|
| 213 | + return $configuration['module.']['tx_vidi.']['settings.']; |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * @return object|DataService |
|
| 218 | + */ |
|
| 219 | + protected function getDataService(): DataService |
|
| 220 | + { |
|
| 221 | + return GeneralUtility::makeInstance(DataService::class); |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * Get the Vidi Module Loader. |
|
| 226 | + * |
|
| 227 | + * @return ModuleLoader|object |
|
| 228 | + */ |
|
| 229 | + protected function getModuleLoader() |
|
| 230 | + { |
|
| 231 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 232 | + } |
|
| 233 | 233 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | public function render() |
| 41 | 41 | { |
| 42 | 42 | $this->initializeCache(); |
| 43 | - $key = $this->getModuleLoader()->getDataType() . '_' . $this->getBackendUserIdentifier() . '_' . $this->arguments['key']; |
|
| 43 | + $key = $this->getModuleLoader()->getDataType().'_'.$this->getBackendUserIdentifier().'_'.$this->arguments['key']; |
|
| 44 | 44 | |
| 45 | 45 | $value = $this->cacheInstance->get($key); |
| 46 | 46 | if ($value) { |
@@ -20,83 +20,83 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class UserPreferencesViewHelper extends AbstractViewHelper |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var AbstractFrontend |
|
| 25 | - */ |
|
| 26 | - protected $cacheInstance; |
|
| 23 | + /** |
|
| 24 | + * @var AbstractFrontend |
|
| 25 | + */ |
|
| 26 | + protected $cacheInstance; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @return void |
|
| 30 | - */ |
|
| 31 | - public function initializeArguments() |
|
| 32 | - { |
|
| 33 | - $this->registerArgument('key', 'string', '', true); |
|
| 34 | - } |
|
| 28 | + /** |
|
| 29 | + * @return void |
|
| 30 | + */ |
|
| 31 | + public function initializeArguments() |
|
| 32 | + { |
|
| 33 | + $this->registerArgument('key', 'string', '', true); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Interface with the BE user data. |
|
| 38 | - * |
|
| 39 | - * @return string |
|
| 40 | - */ |
|
| 41 | - public function render() |
|
| 42 | - { |
|
| 43 | - $this->initializeCache(); |
|
| 44 | - $key = $this->getModuleLoader()->getDataType() . '_' . $this->getBackendUserIdentifier() . '_' . $this->arguments['key']; |
|
| 36 | + /** |
|
| 37 | + * Interface with the BE user data. |
|
| 38 | + * |
|
| 39 | + * @return string |
|
| 40 | + */ |
|
| 41 | + public function render() |
|
| 42 | + { |
|
| 43 | + $this->initializeCache(); |
|
| 44 | + $key = $this->getModuleLoader()->getDataType() . '_' . $this->getBackendUserIdentifier() . '_' . $this->arguments['key']; |
|
| 45 | 45 | |
| 46 | - $value = $this->cacheInstance->get($key); |
|
| 47 | - if ($value) { |
|
| 48 | - $value = addslashes($value); |
|
| 49 | - } else { |
|
| 50 | - $value = ''; |
|
| 51 | - } |
|
| 52 | - return $value; |
|
| 53 | - } |
|
| 46 | + $value = $this->cacheInstance->get($key); |
|
| 47 | + if ($value) { |
|
| 48 | + $value = addslashes($value); |
|
| 49 | + } else { |
|
| 50 | + $value = ''; |
|
| 51 | + } |
|
| 52 | + return $value; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @return int |
|
| 57 | - */ |
|
| 58 | - protected function getBackendUserIdentifier() |
|
| 59 | - { |
|
| 60 | - return $this->getBackendUser()->user['uid']; |
|
| 61 | - } |
|
| 55 | + /** |
|
| 56 | + * @return int |
|
| 57 | + */ |
|
| 58 | + protected function getBackendUserIdentifier() |
|
| 59 | + { |
|
| 60 | + return $this->getBackendUser()->user['uid']; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns an instance of the current Backend User. |
|
| 65 | - * |
|
| 66 | - * @return BackendUserAuthentication |
|
| 67 | - */ |
|
| 68 | - protected function getBackendUser() |
|
| 69 | - { |
|
| 70 | - return $GLOBALS['BE_USER']; |
|
| 71 | - } |
|
| 63 | + /** |
|
| 64 | + * Returns an instance of the current Backend User. |
|
| 65 | + * |
|
| 66 | + * @return BackendUserAuthentication |
|
| 67 | + */ |
|
| 68 | + protected function getBackendUser() |
|
| 69 | + { |
|
| 70 | + return $GLOBALS['BE_USER']; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Get the Vidi Module Loader. |
|
| 75 | - * |
|
| 76 | - * @return ModuleLoader|object |
|
| 77 | - */ |
|
| 78 | - protected function getModuleLoader() |
|
| 79 | - { |
|
| 80 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 81 | - } |
|
| 73 | + /** |
|
| 74 | + * Get the Vidi Module Loader. |
|
| 75 | + * |
|
| 76 | + * @return ModuleLoader|object |
|
| 77 | + */ |
|
| 78 | + protected function getModuleLoader() |
|
| 79 | + { |
|
| 80 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Initialize cache instance to be ready to use |
|
| 85 | - * |
|
| 86 | - * @return void |
|
| 87 | - */ |
|
| 88 | - protected function initializeCache() |
|
| 89 | - { |
|
| 90 | - $this->cacheInstance = $this->getCacheManager()->getCache('vidi'); |
|
| 91 | - } |
|
| 83 | + /** |
|
| 84 | + * Initialize cache instance to be ready to use |
|
| 85 | + * |
|
| 86 | + * @return void |
|
| 87 | + */ |
|
| 88 | + protected function initializeCache() |
|
| 89 | + { |
|
| 90 | + $this->cacheInstance = $this->getCacheManager()->getCache('vidi'); |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Return the Cache Manager |
|
| 95 | - * |
|
| 96 | - * @return CacheManager|object |
|
| 97 | - */ |
|
| 98 | - protected function getCacheManager() |
|
| 99 | - { |
|
| 100 | - return GeneralUtility::makeInstance(CacheManager::class); |
|
| 101 | - } |
|
| 93 | + /** |
|
| 94 | + * Return the Cache Manager |
|
| 95 | + * |
|
| 96 | + * @return CacheManager|object |
|
| 97 | + */ |
|
| 98 | + protected function getCacheManager() |
|
| 99 | + { |
|
| 100 | + return GeneralUtility::makeInstance(CacheManager::class); |
|
| 101 | + } |
|
| 102 | 102 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function render() |
| 35 | 35 | { |
| 36 | - $getter = 'get' . ucfirst($this->arguments['key']); |
|
| 36 | + $getter = 'get'.ucfirst($this->arguments['key']); |
|
| 37 | 37 | |
| 38 | 38 | /** @var ModulePreferences $modulePreferences */ |
| 39 | 39 | $modulePreferences = GeneralUtility::makeInstance(ModulePreferences::class); |
@@ -18,25 +18,25 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ModulePreferencesViewHelper extends AbstractViewHelper |
| 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 ModulePreferences $modulePreferences */ |
|
| 39 | - $modulePreferences = GeneralUtility::makeInstance(ModulePreferences::class); |
|
| 40 | - return $modulePreferences->$getter(); |
|
| 41 | - } |
|
| 38 | + /** @var ModulePreferences $modulePreferences */ |
|
| 39 | + $modulePreferences = GeneralUtility::makeInstance(ModulePreferences::class); |
|
| 40 | + return $modulePreferences->$getter(); |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -16,22 +16,22 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class CanBeHiddenViewHelper extends AbstractViewHelper |
| 18 | 18 | { |
| 19 | - /** |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - public function initializeArguments() |
|
| 23 | - { |
|
| 24 | - $this->registerArgument('name', 'string', 'The column name', true); |
|
| 25 | - } |
|
| 19 | + /** |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + public function initializeArguments() |
|
| 23 | + { |
|
| 24 | + $this->registerArgument('name', 'string', 'The column name', true); |
|
| 25 | + } |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Returns whether the column can be hidden or not. |
|
| 29 | - * |
|
| 30 | - * @return boolean |
|
| 31 | - */ |
|
| 32 | - public function render() |
|
| 33 | - { |
|
| 34 | - return Tca::grid()->canBeHidden($this->arguments['name']); |
|
| 35 | - } |
|
| 27 | + /** |
|
| 28 | + * Returns whether the column can be hidden or not. |
|
| 29 | + * |
|
| 30 | + * @return boolean |
|
| 31 | + */ |
|
| 32 | + public function render() |
|
| 33 | + { |
|
| 34 | + return Tca::grid()->canBeHidden($this->arguments['name']); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function render() |
| 35 | 35 | { |
| 36 | - $getter = 'get' . ucfirst($this->arguments['key']); |
|
| 36 | + $getter = 'get'.ucfirst($this->arguments['key']); |
|
| 37 | 37 | |
| 38 | 38 | /** @var ModuleLoader $moduleLoader */ |
| 39 | 39 | $moduleLoader = GeneralUtility::makeInstance(ModuleLoader::class); |
@@ -18,25 +18,25 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ModuleLoaderViewHelper extends AbstractViewHelper |
| 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 | } |
@@ -18,29 +18,29 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class ExtensionManagementUtility |
| 20 | 20 | { |
| 21 | - /** |
|
| 22 | - * Returns the relative path to the extension as measured from the public web path |
|
| 23 | - * If the extension is not loaded the function will die with an error message |
|
| 24 | - * Useful for images and links from the frontend |
|
| 25 | - * |
|
| 26 | - * @param string $key Extension key |
|
| 27 | - * @return string |
|
| 28 | - */ |
|
| 29 | - public static function siteRelPath($key) |
|
| 30 | - { |
|
| 31 | - return self::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($key)); |
|
| 32 | - } |
|
| 21 | + /** |
|
| 22 | + * Returns the relative path to the extension as measured from the public web path |
|
| 23 | + * If the extension is not loaded the function will die with an error message |
|
| 24 | + * Useful for images and links from the frontend |
|
| 25 | + * |
|
| 26 | + * @param string $key Extension key |
|
| 27 | + * @return string |
|
| 28 | + */ |
|
| 29 | + public static function siteRelPath($key) |
|
| 30 | + { |
|
| 31 | + return self::stripPathSitePrefix(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($key)); |
|
| 32 | + } |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Strip first part of a path, equal to the length of public web path including trailing slash |
|
| 36 | - * |
|
| 37 | - * @param string $path |
|
| 38 | - * @return string |
|
| 39 | - * @internal |
|
| 40 | - */ |
|
| 41 | - public static function stripPathSitePrefix($path) |
|
| 42 | - { |
|
| 43 | - return substr($path, strlen(Environment::getPublicPath() . '/')); |
|
| 44 | - } |
|
| 34 | + /** |
|
| 35 | + * Strip first part of a path, equal to the length of public web path including trailing slash |
|
| 36 | + * |
|
| 37 | + * @param string $path |
|
| 38 | + * @return string |
|
| 39 | + * @internal |
|
| 40 | + */ |
|
| 41 | + public static function stripPathSitePrefix($path) |
|
| 42 | + { |
|
| 43 | + return substr($path, strlen(Environment::getPublicPath() . '/')); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | } |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | public static function stripPathSitePrefix($path) |
| 42 | 42 | { |
| 43 | - return substr($path, strlen(Environment::getPublicPath() . '/')); |
|
| 43 | + return substr($path, strlen(Environment::getPublicPath().'/')); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | } |
@@ -317,7 +317,7 @@ |
||
| 317 | 317 | public function like($fieldNameAndPath, $operand, $addWildCard = true): self |
| 318 | 318 | { |
| 319 | 319 | $wildCardSymbol = $addWildCard ? '%' : ''; |
| 320 | - $this->like[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $wildCardSymbol . $operand . $wildCardSymbol]; |
|
| 320 | + $this->like[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $wildCardSymbol.$operand.$wildCardSymbol]; |
|
| 321 | 321 | return $this; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -14,499 +14,499 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Matcher |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * The logical OR |
|
| 19 | - */ |
|
| 20 | - public const LOGICAL_OR = 'logicalOr'; |
|
| 21 | - |
|
| 22 | - /** |
|
| 23 | - * The logical AND |
|
| 24 | - */ |
|
| 25 | - public const LOGICAL_AND = 'logicalAnd'; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var string |
|
| 29 | - */ |
|
| 30 | - protected $dataType = ''; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @var string |
|
| 34 | - */ |
|
| 35 | - protected $searchTerm = ''; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * @var array |
|
| 39 | - */ |
|
| 40 | - protected $supportedOperators = [ |
|
| 41 | - '=' => 'equals', |
|
| 42 | - '!=' => 'notEquals', |
|
| 43 | - 'in' => 'in', |
|
| 44 | - 'like' => 'like', |
|
| 45 | - '>' => 'greaterThan', |
|
| 46 | - '>=' => 'greaterThanOrEqual', |
|
| 47 | - '<' => 'lessThan', |
|
| 48 | - '<=' => 'lessThanOrEqual', |
|
| 49 | - ]; |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @var array |
|
| 53 | - */ |
|
| 54 | - protected $equals = []; |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * @var array |
|
| 58 | - */ |
|
| 59 | - protected $notEquals = []; |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @var array |
|
| 63 | - */ |
|
| 64 | - protected $greaterThan = []; |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * @var array |
|
| 68 | - */ |
|
| 69 | - protected $greaterThanOrEqual = []; |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @var array |
|
| 73 | - */ |
|
| 74 | - protected $lessThan = []; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * @var array |
|
| 78 | - */ |
|
| 79 | - protected $lessThanOrEqual = []; |
|
| 80 | - |
|
| 81 | - /** |
|
| 82 | - * @var array |
|
| 83 | - */ |
|
| 84 | - protected $in = []; |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * @var array |
|
| 88 | - */ |
|
| 89 | - protected $like = []; |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * @var array |
|
| 93 | - */ |
|
| 94 | - protected $matches = []; |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @var string |
|
| 98 | - */ |
|
| 99 | - protected $defaultLogicalSeparator = self::LOGICAL_AND; |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * @var string |
|
| 103 | - */ |
|
| 104 | - protected $logicalSeparatorForEquals = self::LOGICAL_AND; |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @var string |
|
| 108 | - */ |
|
| 109 | - protected $logicalSeparatorForGreaterThan = self::LOGICAL_AND; |
|
| 110 | - |
|
| 111 | - /** |
|
| 112 | - * @var string |
|
| 113 | - */ |
|
| 114 | - protected $logicalSeparatorForGreaterThanOrEqual = self::LOGICAL_AND; |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * @var string |
|
| 118 | - */ |
|
| 119 | - protected $logicalSeparatorForLessThan = self::LOGICAL_AND; |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * @var string |
|
| 123 | - */ |
|
| 124 | - protected $logicalSeparatorForLessThanOrEqual = self::LOGICAL_AND; |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * @var string |
|
| 128 | - */ |
|
| 129 | - protected $logicalSeparatorForIn = self::LOGICAL_AND; |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @var string |
|
| 133 | - */ |
|
| 134 | - protected $logicalSeparatorForLike = self::LOGICAL_AND; |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @var string |
|
| 138 | - */ |
|
| 139 | - protected $logicalSeparatorForSearchTerm = self::LOGICAL_OR; |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * Constructs a new Matcher |
|
| 143 | - * |
|
| 144 | - * @param array $matches associative [$field => $value] |
|
| 145 | - * @param string $dataType which corresponds to an entry of the TCA (table name). |
|
| 146 | - */ |
|
| 147 | - public function __construct($matches = [], $dataType = '') |
|
| 148 | - { |
|
| 149 | - $this->dataType = $dataType; |
|
| 150 | - $this->matches = $matches; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * @param string $searchTerm |
|
| 155 | - * @return \Fab\Vidi\Persistence\Matcher |
|
| 156 | - */ |
|
| 157 | - public function setSearchTerm($searchTerm): Matcher |
|
| 158 | - { |
|
| 159 | - $this->searchTerm = $searchTerm; |
|
| 160 | - return $this; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | - /** |
|
| 164 | - * @return string |
|
| 165 | - */ |
|
| 166 | - public function getSearchTerm(): string |
|
| 167 | - { |
|
| 168 | - return $this->searchTerm; |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * @return array |
|
| 173 | - */ |
|
| 174 | - public function getEquals(): array |
|
| 175 | - { |
|
| 176 | - return $this->equals; |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * @param $fieldNameAndPath |
|
| 181 | - * @param $operand |
|
| 182 | - * @return $this |
|
| 183 | - */ |
|
| 184 | - public function equals($fieldNameAndPath, $operand): self |
|
| 185 | - { |
|
| 186 | - $this->equals[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 187 | - return $this; |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - /** |
|
| 191 | - * @return array |
|
| 192 | - */ |
|
| 193 | - public function getNotEquals(): array |
|
| 194 | - { |
|
| 195 | - return $this->notEquals; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - /** |
|
| 199 | - * @param $fieldNameAndPath |
|
| 200 | - * @param $operand |
|
| 201 | - * @return $this |
|
| 202 | - */ |
|
| 203 | - public function notEquals($fieldNameAndPath, $operand): self |
|
| 204 | - { |
|
| 205 | - $this->notEquals[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 206 | - return $this; |
|
| 207 | - } |
|
| 208 | - |
|
| 209 | - /** |
|
| 210 | - * @return array |
|
| 211 | - */ |
|
| 212 | - public function getGreaterThan(): array |
|
| 213 | - { |
|
| 214 | - return $this->greaterThan; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * @param $fieldNameAndPath |
|
| 219 | - * @param $operand |
|
| 220 | - * @return $this |
|
| 221 | - */ |
|
| 222 | - public function greaterThan($fieldNameAndPath, $operand): self |
|
| 223 | - { |
|
| 224 | - $this->greaterThan[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 225 | - return $this; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * @return array |
|
| 230 | - */ |
|
| 231 | - public function getGreaterThanOrEqual(): array |
|
| 232 | - { |
|
| 233 | - return $this->greaterThanOrEqual; |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * @param $fieldNameAndPath |
|
| 238 | - * @param $operand |
|
| 239 | - * @return $this |
|
| 240 | - */ |
|
| 241 | - public function greaterThanOrEqual($fieldNameAndPath, $operand): self |
|
| 242 | - { |
|
| 243 | - $this->greaterThanOrEqual[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 244 | - return $this; |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - /** |
|
| 248 | - * @return array |
|
| 249 | - */ |
|
| 250 | - public function getLessThan(): array |
|
| 251 | - { |
|
| 252 | - return $this->lessThan; |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * @param $fieldNameAndPath |
|
| 257 | - * @param $operand |
|
| 258 | - * @return $this |
|
| 259 | - */ |
|
| 260 | - public function lessThan($fieldNameAndPath, $operand): self |
|
| 261 | - { |
|
| 262 | - $this->lessThan[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 263 | - return $this; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * @return array |
|
| 268 | - */ |
|
| 269 | - public function getLessThanOrEqual(): array |
|
| 270 | - { |
|
| 271 | - return $this->lessThanOrEqual; |
|
| 272 | - } |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * @param $fieldNameAndPath |
|
| 276 | - * @param $operand |
|
| 277 | - * @return $this |
|
| 278 | - */ |
|
| 279 | - public function lessThanOrEqual($fieldNameAndPath, $operand): self |
|
| 280 | - { |
|
| 281 | - $this->lessThanOrEqual[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 282 | - return $this; |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * @return array |
|
| 287 | - */ |
|
| 288 | - public function getLike(): array |
|
| 289 | - { |
|
| 290 | - return $this->like; |
|
| 291 | - } |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * @param $fieldNameAndPath |
|
| 295 | - * @param $operand |
|
| 296 | - * @return $this |
|
| 297 | - */ |
|
| 298 | - public function in($fieldNameAndPath, $operand): self |
|
| 299 | - { |
|
| 300 | - $this->in[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 301 | - return $this; |
|
| 302 | - } |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * @return array |
|
| 306 | - */ |
|
| 307 | - public function getIn(): array |
|
| 308 | - { |
|
| 309 | - return $this->in; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - /** |
|
| 313 | - * @param $fieldNameAndPath |
|
| 314 | - * @param $operand |
|
| 315 | - * @param bool $addWildCard |
|
| 316 | - * @return $this |
|
| 317 | - */ |
|
| 318 | - public function like($fieldNameAndPath, $operand, $addWildCard = true): self |
|
| 319 | - { |
|
| 320 | - $wildCardSymbol = $addWildCard ? '%' : ''; |
|
| 321 | - $this->like[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $wildCardSymbol . $operand . $wildCardSymbol]; |
|
| 322 | - return $this; |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * @return string |
|
| 327 | - */ |
|
| 328 | - public function getDefaultLogicalSeparator(): string |
|
| 329 | - { |
|
| 330 | - return $this->defaultLogicalSeparator; |
|
| 331 | - } |
|
| 332 | - |
|
| 333 | - /** |
|
| 334 | - * @param string $defaultLogicalSeparator |
|
| 335 | - * @return $this |
|
| 336 | - */ |
|
| 337 | - public function setDefaultLogicalSeparator($defaultLogicalSeparator): self |
|
| 338 | - { |
|
| 339 | - $this->defaultLogicalSeparator = $defaultLogicalSeparator; |
|
| 340 | - return $this; |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - /** |
|
| 344 | - * @return string |
|
| 345 | - */ |
|
| 346 | - public function getLogicalSeparatorForEquals(): string |
|
| 347 | - { |
|
| 348 | - return $this->logicalSeparatorForEquals; |
|
| 349 | - } |
|
| 350 | - |
|
| 351 | - /** |
|
| 352 | - * @param string $logicalSeparatorForEquals |
|
| 353 | - * @return $this |
|
| 354 | - */ |
|
| 355 | - public function setLogicalSeparatorForEquals($logicalSeparatorForEquals): self |
|
| 356 | - { |
|
| 357 | - $this->logicalSeparatorForEquals = $logicalSeparatorForEquals; |
|
| 358 | - return $this; |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - /** |
|
| 362 | - * @return string |
|
| 363 | - */ |
|
| 364 | - public function getLogicalSeparatorForGreaterThan(): string |
|
| 365 | - { |
|
| 366 | - return $this->logicalSeparatorForGreaterThan; |
|
| 367 | - } |
|
| 368 | - |
|
| 369 | - /** |
|
| 370 | - * @param string $logicalSeparatorForGreaterThan |
|
| 371 | - * @return $this |
|
| 372 | - */ |
|
| 373 | - public function setLogicalSeparatorForGreaterThan($logicalSeparatorForGreaterThan): self |
|
| 374 | - { |
|
| 375 | - $this->logicalSeparatorForGreaterThan = $logicalSeparatorForGreaterThan; |
|
| 376 | - return $this; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - /** |
|
| 380 | - * @return string |
|
| 381 | - */ |
|
| 382 | - public function getLogicalSeparatorForGreaterThanOrEqual(): string |
|
| 383 | - { |
|
| 384 | - return $this->logicalSeparatorForGreaterThanOrEqual; |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * @param string $logicalSeparatorForGreaterThanOrEqual |
|
| 389 | - * @return $this |
|
| 390 | - */ |
|
| 391 | - public function setLogicalSeparatorForGreaterThanOrEqual($logicalSeparatorForGreaterThanOrEqual): self |
|
| 392 | - { |
|
| 393 | - $this->logicalSeparatorForGreaterThanOrEqual = $logicalSeparatorForGreaterThanOrEqual; |
|
| 394 | - return $this; |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - /** |
|
| 398 | - * @return string |
|
| 399 | - */ |
|
| 400 | - public function getLogicalSeparatorForLessThan(): string |
|
| 401 | - { |
|
| 402 | - return $this->logicalSeparatorForLessThan; |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - /** |
|
| 406 | - * @param string $logicalSeparatorForLessThan |
|
| 407 | - * @return $this |
|
| 408 | - */ |
|
| 409 | - public function setLogicalSeparatorForLessThan($logicalSeparatorForLessThan): self |
|
| 410 | - { |
|
| 411 | - $this->logicalSeparatorForLessThan = $logicalSeparatorForLessThan; |
|
| 412 | - return $this; |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * @return string |
|
| 417 | - */ |
|
| 418 | - public function getLogicalSeparatorForLessThanOrEqual(): string |
|
| 419 | - { |
|
| 420 | - return $this->logicalSeparatorForLessThanOrEqual; |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - /** |
|
| 424 | - * @param string $logicalSeparatorForLessThanOrEqual |
|
| 425 | - * @return $this |
|
| 426 | - */ |
|
| 427 | - public function setLogicalSeparatorForLessThanOrEqual($logicalSeparatorForLessThanOrEqual): self |
|
| 428 | - { |
|
| 429 | - $this->logicalSeparatorForLessThanOrEqual = $logicalSeparatorForLessThanOrEqual; |
|
| 430 | - return $this; |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - /** |
|
| 434 | - * @return string |
|
| 435 | - */ |
|
| 436 | - public function getLogicalSeparatorForIn(): string |
|
| 437 | - { |
|
| 438 | - return $this->logicalSeparatorForIn; |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - /** |
|
| 442 | - * @param string $logicalSeparatorForIn |
|
| 443 | - * @return $this |
|
| 444 | - */ |
|
| 445 | - public function setLogicalSeparatorForIn($logicalSeparatorForIn): self |
|
| 446 | - { |
|
| 447 | - $this->logicalSeparatorForIn = $logicalSeparatorForIn; |
|
| 448 | - return $this; |
|
| 449 | - } |
|
| 450 | - |
|
| 451 | - /** |
|
| 452 | - * @return string |
|
| 453 | - */ |
|
| 454 | - public function getLogicalSeparatorForLike(): string |
|
| 455 | - { |
|
| 456 | - return $this->logicalSeparatorForLike; |
|
| 457 | - } |
|
| 458 | - |
|
| 459 | - /** |
|
| 460 | - * @param string $logicalSeparatorForLike |
|
| 461 | - * @return $this |
|
| 462 | - */ |
|
| 463 | - public function setLogicalSeparatorForLike($logicalSeparatorForLike): self |
|
| 464 | - { |
|
| 465 | - $this->logicalSeparatorForLike = $logicalSeparatorForLike; |
|
| 466 | - return $this; |
|
| 467 | - } |
|
| 468 | - |
|
| 469 | - /** |
|
| 470 | - * @return string |
|
| 471 | - */ |
|
| 472 | - public function getLogicalSeparatorForSearchTerm(): string |
|
| 473 | - { |
|
| 474 | - return $this->logicalSeparatorForSearchTerm; |
|
| 475 | - } |
|
| 476 | - |
|
| 477 | - /** |
|
| 478 | - * @param string $logicalSeparatorForSearchTerm |
|
| 479 | - * @return $this |
|
| 480 | - */ |
|
| 481 | - public function setLogicalSeparatorForSearchTerm($logicalSeparatorForSearchTerm): self |
|
| 482 | - { |
|
| 483 | - $this->logicalSeparatorForSearchTerm = $logicalSeparatorForSearchTerm; |
|
| 484 | - return $this; |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - /** |
|
| 488 | - * @return array |
|
| 489 | - */ |
|
| 490 | - public function getSupportedOperators(): array |
|
| 491 | - { |
|
| 492 | - return $this->supportedOperators; |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - /** |
|
| 496 | - * @return string |
|
| 497 | - */ |
|
| 498 | - public function getDataType(): string |
|
| 499 | - { |
|
| 500 | - return $this->dataType; |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - /** |
|
| 504 | - * @param string $dataType |
|
| 505 | - * @return $this |
|
| 506 | - */ |
|
| 507 | - public function setDataType($dataType): self |
|
| 508 | - { |
|
| 509 | - $this->dataType = $dataType; |
|
| 510 | - return $this; |
|
| 511 | - } |
|
| 17 | + /** |
|
| 18 | + * The logical OR |
|
| 19 | + */ |
|
| 20 | + public const LOGICAL_OR = 'logicalOr'; |
|
| 21 | + |
|
| 22 | + /** |
|
| 23 | + * The logical AND |
|
| 24 | + */ |
|
| 25 | + public const LOGICAL_AND = 'logicalAnd'; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var string |
|
| 29 | + */ |
|
| 30 | + protected $dataType = ''; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | + protected $searchTerm = ''; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * @var array |
|
| 39 | + */ |
|
| 40 | + protected $supportedOperators = [ |
|
| 41 | + '=' => 'equals', |
|
| 42 | + '!=' => 'notEquals', |
|
| 43 | + 'in' => 'in', |
|
| 44 | + 'like' => 'like', |
|
| 45 | + '>' => 'greaterThan', |
|
| 46 | + '>=' => 'greaterThanOrEqual', |
|
| 47 | + '<' => 'lessThan', |
|
| 48 | + '<=' => 'lessThanOrEqual', |
|
| 49 | + ]; |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @var array |
|
| 53 | + */ |
|
| 54 | + protected $equals = []; |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * @var array |
|
| 58 | + */ |
|
| 59 | + protected $notEquals = []; |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @var array |
|
| 63 | + */ |
|
| 64 | + protected $greaterThan = []; |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * @var array |
|
| 68 | + */ |
|
| 69 | + protected $greaterThanOrEqual = []; |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @var array |
|
| 73 | + */ |
|
| 74 | + protected $lessThan = []; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * @var array |
|
| 78 | + */ |
|
| 79 | + protected $lessThanOrEqual = []; |
|
| 80 | + |
|
| 81 | + /** |
|
| 82 | + * @var array |
|
| 83 | + */ |
|
| 84 | + protected $in = []; |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * @var array |
|
| 88 | + */ |
|
| 89 | + protected $like = []; |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * @var array |
|
| 93 | + */ |
|
| 94 | + protected $matches = []; |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @var string |
|
| 98 | + */ |
|
| 99 | + protected $defaultLogicalSeparator = self::LOGICAL_AND; |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * @var string |
|
| 103 | + */ |
|
| 104 | + protected $logicalSeparatorForEquals = self::LOGICAL_AND; |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @var string |
|
| 108 | + */ |
|
| 109 | + protected $logicalSeparatorForGreaterThan = self::LOGICAL_AND; |
|
| 110 | + |
|
| 111 | + /** |
|
| 112 | + * @var string |
|
| 113 | + */ |
|
| 114 | + protected $logicalSeparatorForGreaterThanOrEqual = self::LOGICAL_AND; |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * @var string |
|
| 118 | + */ |
|
| 119 | + protected $logicalSeparatorForLessThan = self::LOGICAL_AND; |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * @var string |
|
| 123 | + */ |
|
| 124 | + protected $logicalSeparatorForLessThanOrEqual = self::LOGICAL_AND; |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * @var string |
|
| 128 | + */ |
|
| 129 | + protected $logicalSeparatorForIn = self::LOGICAL_AND; |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @var string |
|
| 133 | + */ |
|
| 134 | + protected $logicalSeparatorForLike = self::LOGICAL_AND; |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @var string |
|
| 138 | + */ |
|
| 139 | + protected $logicalSeparatorForSearchTerm = self::LOGICAL_OR; |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * Constructs a new Matcher |
|
| 143 | + * |
|
| 144 | + * @param array $matches associative [$field => $value] |
|
| 145 | + * @param string $dataType which corresponds to an entry of the TCA (table name). |
|
| 146 | + */ |
|
| 147 | + public function __construct($matches = [], $dataType = '') |
|
| 148 | + { |
|
| 149 | + $this->dataType = $dataType; |
|
| 150 | + $this->matches = $matches; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * @param string $searchTerm |
|
| 155 | + * @return \Fab\Vidi\Persistence\Matcher |
|
| 156 | + */ |
|
| 157 | + public function setSearchTerm($searchTerm): Matcher |
|
| 158 | + { |
|
| 159 | + $this->searchTerm = $searchTerm; |
|
| 160 | + return $this; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + /** |
|
| 164 | + * @return string |
|
| 165 | + */ |
|
| 166 | + public function getSearchTerm(): string |
|
| 167 | + { |
|
| 168 | + return $this->searchTerm; |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * @return array |
|
| 173 | + */ |
|
| 174 | + public function getEquals(): array |
|
| 175 | + { |
|
| 176 | + return $this->equals; |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * @param $fieldNameAndPath |
|
| 181 | + * @param $operand |
|
| 182 | + * @return $this |
|
| 183 | + */ |
|
| 184 | + public function equals($fieldNameAndPath, $operand): self |
|
| 185 | + { |
|
| 186 | + $this->equals[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 187 | + return $this; |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * @return array |
|
| 192 | + */ |
|
| 193 | + public function getNotEquals(): array |
|
| 194 | + { |
|
| 195 | + return $this->notEquals; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * @param $fieldNameAndPath |
|
| 200 | + * @param $operand |
|
| 201 | + * @return $this |
|
| 202 | + */ |
|
| 203 | + public function notEquals($fieldNameAndPath, $operand): self |
|
| 204 | + { |
|
| 205 | + $this->notEquals[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 206 | + return $this; |
|
| 207 | + } |
|
| 208 | + |
|
| 209 | + /** |
|
| 210 | + * @return array |
|
| 211 | + */ |
|
| 212 | + public function getGreaterThan(): array |
|
| 213 | + { |
|
| 214 | + return $this->greaterThan; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * @param $fieldNameAndPath |
|
| 219 | + * @param $operand |
|
| 220 | + * @return $this |
|
| 221 | + */ |
|
| 222 | + public function greaterThan($fieldNameAndPath, $operand): self |
|
| 223 | + { |
|
| 224 | + $this->greaterThan[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 225 | + return $this; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * @return array |
|
| 230 | + */ |
|
| 231 | + public function getGreaterThanOrEqual(): array |
|
| 232 | + { |
|
| 233 | + return $this->greaterThanOrEqual; |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * @param $fieldNameAndPath |
|
| 238 | + * @param $operand |
|
| 239 | + * @return $this |
|
| 240 | + */ |
|
| 241 | + public function greaterThanOrEqual($fieldNameAndPath, $operand): self |
|
| 242 | + { |
|
| 243 | + $this->greaterThanOrEqual[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 244 | + return $this; |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + /** |
|
| 248 | + * @return array |
|
| 249 | + */ |
|
| 250 | + public function getLessThan(): array |
|
| 251 | + { |
|
| 252 | + return $this->lessThan; |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * @param $fieldNameAndPath |
|
| 257 | + * @param $operand |
|
| 258 | + * @return $this |
|
| 259 | + */ |
|
| 260 | + public function lessThan($fieldNameAndPath, $operand): self |
|
| 261 | + { |
|
| 262 | + $this->lessThan[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 263 | + return $this; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * @return array |
|
| 268 | + */ |
|
| 269 | + public function getLessThanOrEqual(): array |
|
| 270 | + { |
|
| 271 | + return $this->lessThanOrEqual; |
|
| 272 | + } |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * @param $fieldNameAndPath |
|
| 276 | + * @param $operand |
|
| 277 | + * @return $this |
|
| 278 | + */ |
|
| 279 | + public function lessThanOrEqual($fieldNameAndPath, $operand): self |
|
| 280 | + { |
|
| 281 | + $this->lessThanOrEqual[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 282 | + return $this; |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * @return array |
|
| 287 | + */ |
|
| 288 | + public function getLike(): array |
|
| 289 | + { |
|
| 290 | + return $this->like; |
|
| 291 | + } |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * @param $fieldNameAndPath |
|
| 295 | + * @param $operand |
|
| 296 | + * @return $this |
|
| 297 | + */ |
|
| 298 | + public function in($fieldNameAndPath, $operand): self |
|
| 299 | + { |
|
| 300 | + $this->in[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $operand]; |
|
| 301 | + return $this; |
|
| 302 | + } |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * @return array |
|
| 306 | + */ |
|
| 307 | + public function getIn(): array |
|
| 308 | + { |
|
| 309 | + return $this->in; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + /** |
|
| 313 | + * @param $fieldNameAndPath |
|
| 314 | + * @param $operand |
|
| 315 | + * @param bool $addWildCard |
|
| 316 | + * @return $this |
|
| 317 | + */ |
|
| 318 | + public function like($fieldNameAndPath, $operand, $addWildCard = true): self |
|
| 319 | + { |
|
| 320 | + $wildCardSymbol = $addWildCard ? '%' : ''; |
|
| 321 | + $this->like[] = ['fieldNameAndPath' => $fieldNameAndPath, 'operand' => $wildCardSymbol . $operand . $wildCardSymbol]; |
|
| 322 | + return $this; |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * @return string |
|
| 327 | + */ |
|
| 328 | + public function getDefaultLogicalSeparator(): string |
|
| 329 | + { |
|
| 330 | + return $this->defaultLogicalSeparator; |
|
| 331 | + } |
|
| 332 | + |
|
| 333 | + /** |
|
| 334 | + * @param string $defaultLogicalSeparator |
|
| 335 | + * @return $this |
|
| 336 | + */ |
|
| 337 | + public function setDefaultLogicalSeparator($defaultLogicalSeparator): self |
|
| 338 | + { |
|
| 339 | + $this->defaultLogicalSeparator = $defaultLogicalSeparator; |
|
| 340 | + return $this; |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * @return string |
|
| 345 | + */ |
|
| 346 | + public function getLogicalSeparatorForEquals(): string |
|
| 347 | + { |
|
| 348 | + return $this->logicalSeparatorForEquals; |
|
| 349 | + } |
|
| 350 | + |
|
| 351 | + /** |
|
| 352 | + * @param string $logicalSeparatorForEquals |
|
| 353 | + * @return $this |
|
| 354 | + */ |
|
| 355 | + public function setLogicalSeparatorForEquals($logicalSeparatorForEquals): self |
|
| 356 | + { |
|
| 357 | + $this->logicalSeparatorForEquals = $logicalSeparatorForEquals; |
|
| 358 | + return $this; |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + /** |
|
| 362 | + * @return string |
|
| 363 | + */ |
|
| 364 | + public function getLogicalSeparatorForGreaterThan(): string |
|
| 365 | + { |
|
| 366 | + return $this->logicalSeparatorForGreaterThan; |
|
| 367 | + } |
|
| 368 | + |
|
| 369 | + /** |
|
| 370 | + * @param string $logicalSeparatorForGreaterThan |
|
| 371 | + * @return $this |
|
| 372 | + */ |
|
| 373 | + public function setLogicalSeparatorForGreaterThan($logicalSeparatorForGreaterThan): self |
|
| 374 | + { |
|
| 375 | + $this->logicalSeparatorForGreaterThan = $logicalSeparatorForGreaterThan; |
|
| 376 | + return $this; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + /** |
|
| 380 | + * @return string |
|
| 381 | + */ |
|
| 382 | + public function getLogicalSeparatorForGreaterThanOrEqual(): string |
|
| 383 | + { |
|
| 384 | + return $this->logicalSeparatorForGreaterThanOrEqual; |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * @param string $logicalSeparatorForGreaterThanOrEqual |
|
| 389 | + * @return $this |
|
| 390 | + */ |
|
| 391 | + public function setLogicalSeparatorForGreaterThanOrEqual($logicalSeparatorForGreaterThanOrEqual): self |
|
| 392 | + { |
|
| 393 | + $this->logicalSeparatorForGreaterThanOrEqual = $logicalSeparatorForGreaterThanOrEqual; |
|
| 394 | + return $this; |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + /** |
|
| 398 | + * @return string |
|
| 399 | + */ |
|
| 400 | + public function getLogicalSeparatorForLessThan(): string |
|
| 401 | + { |
|
| 402 | + return $this->logicalSeparatorForLessThan; |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + /** |
|
| 406 | + * @param string $logicalSeparatorForLessThan |
|
| 407 | + * @return $this |
|
| 408 | + */ |
|
| 409 | + public function setLogicalSeparatorForLessThan($logicalSeparatorForLessThan): self |
|
| 410 | + { |
|
| 411 | + $this->logicalSeparatorForLessThan = $logicalSeparatorForLessThan; |
|
| 412 | + return $this; |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @return string |
|
| 417 | + */ |
|
| 418 | + public function getLogicalSeparatorForLessThanOrEqual(): string |
|
| 419 | + { |
|
| 420 | + return $this->logicalSeparatorForLessThanOrEqual; |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + /** |
|
| 424 | + * @param string $logicalSeparatorForLessThanOrEqual |
|
| 425 | + * @return $this |
|
| 426 | + */ |
|
| 427 | + public function setLogicalSeparatorForLessThanOrEqual($logicalSeparatorForLessThanOrEqual): self |
|
| 428 | + { |
|
| 429 | + $this->logicalSeparatorForLessThanOrEqual = $logicalSeparatorForLessThanOrEqual; |
|
| 430 | + return $this; |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + /** |
|
| 434 | + * @return string |
|
| 435 | + */ |
|
| 436 | + public function getLogicalSeparatorForIn(): string |
|
| 437 | + { |
|
| 438 | + return $this->logicalSeparatorForIn; |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + /** |
|
| 442 | + * @param string $logicalSeparatorForIn |
|
| 443 | + * @return $this |
|
| 444 | + */ |
|
| 445 | + public function setLogicalSeparatorForIn($logicalSeparatorForIn): self |
|
| 446 | + { |
|
| 447 | + $this->logicalSeparatorForIn = $logicalSeparatorForIn; |
|
| 448 | + return $this; |
|
| 449 | + } |
|
| 450 | + |
|
| 451 | + /** |
|
| 452 | + * @return string |
|
| 453 | + */ |
|
| 454 | + public function getLogicalSeparatorForLike(): string |
|
| 455 | + { |
|
| 456 | + return $this->logicalSeparatorForLike; |
|
| 457 | + } |
|
| 458 | + |
|
| 459 | + /** |
|
| 460 | + * @param string $logicalSeparatorForLike |
|
| 461 | + * @return $this |
|
| 462 | + */ |
|
| 463 | + public function setLogicalSeparatorForLike($logicalSeparatorForLike): self |
|
| 464 | + { |
|
| 465 | + $this->logicalSeparatorForLike = $logicalSeparatorForLike; |
|
| 466 | + return $this; |
|
| 467 | + } |
|
| 468 | + |
|
| 469 | + /** |
|
| 470 | + * @return string |
|
| 471 | + */ |
|
| 472 | + public function getLogicalSeparatorForSearchTerm(): string |
|
| 473 | + { |
|
| 474 | + return $this->logicalSeparatorForSearchTerm; |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + /** |
|
| 478 | + * @param string $logicalSeparatorForSearchTerm |
|
| 479 | + * @return $this |
|
| 480 | + */ |
|
| 481 | + public function setLogicalSeparatorForSearchTerm($logicalSeparatorForSearchTerm): self |
|
| 482 | + { |
|
| 483 | + $this->logicalSeparatorForSearchTerm = $logicalSeparatorForSearchTerm; |
|
| 484 | + return $this; |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + /** |
|
| 488 | + * @return array |
|
| 489 | + */ |
|
| 490 | + public function getSupportedOperators(): array |
|
| 491 | + { |
|
| 492 | + return $this->supportedOperators; |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + /** |
|
| 496 | + * @return string |
|
| 497 | + */ |
|
| 498 | + public function getDataType(): string |
|
| 499 | + { |
|
| 500 | + return $this->dataType; |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + /** |
|
| 504 | + * @param string $dataType |
|
| 505 | + * @return $this |
|
| 506 | + */ |
|
| 507 | + public function setDataType($dataType): self |
|
| 508 | + { |
|
| 509 | + $this->dataType = $dataType; |
|
| 510 | + return $this; |
|
| 511 | + } |
|
| 512 | 512 | } |
@@ -19,33 +19,33 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class PidCheck extends AbstractComponentView |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * Renders warnings if storagePid is not properly configured. |
|
| 24 | - * |
|
| 25 | - * @return string |
|
| 26 | - */ |
|
| 27 | - public function render(): string |
|
| 28 | - { |
|
| 29 | - $errors = $this->getModulePidService()->validateConfiguredPid(); |
|
| 22 | + /** |
|
| 23 | + * Renders warnings if storagePid is not properly configured. |
|
| 24 | + * |
|
| 25 | + * @return string |
|
| 26 | + */ |
|
| 27 | + public function render(): string |
|
| 28 | + { |
|
| 29 | + $errors = $this->getModulePidService()->validateConfiguredPid(); |
|
| 30 | 30 | |
| 31 | - return empty($errors) |
|
| 32 | - ? '' |
|
| 33 | - : $this->formatMessagePidIsNotValid($errors); |
|
| 34 | - } |
|
| 31 | + return empty($errors) |
|
| 32 | + ? '' |
|
| 33 | + : $this->formatMessagePidIsNotValid($errors); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Format a message whenever the storage is offline. |
|
| 38 | - * |
|
| 39 | - * @param array $errors |
|
| 40 | - * @return string |
|
| 41 | - */ |
|
| 42 | - protected function formatMessagePidIsNotValid(array $errors): string |
|
| 43 | - { |
|
| 44 | - $configuredPid = $this->getModulePidService()->getConfiguredNewRecordPid(); |
|
| 36 | + /** |
|
| 37 | + * Format a message whenever the storage is offline. |
|
| 38 | + * |
|
| 39 | + * @param array $errors |
|
| 40 | + * @return string |
|
| 41 | + */ |
|
| 42 | + protected function formatMessagePidIsNotValid(array $errors): string |
|
| 43 | + { |
|
| 44 | + $configuredPid = $this->getModulePidService()->getConfiguredNewRecordPid(); |
|
| 45 | 45 | |
| 46 | - $error = implode('<br />', $errors); |
|
| 47 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 48 | - $result = <<< EOF |
|
| 46 | + $error = implode('<br />', $errors); |
|
| 47 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 48 | + $result = <<< EOF |
|
| 49 | 49 | <div class="alert alert-warning"> |
| 50 | 50 | <div class="alert-title"> |
| 51 | 51 | Page id "{$configuredPid}" has found to be a wrong configuration for "{$dataType}" |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | </div> |
| 74 | 74 | EOF; |
| 75 | 75 | |
| 76 | - return $result; |
|
| 77 | - } |
|
| 76 | + return $result; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @return ModulePidService|object |
|
| 81 | - */ |
|
| 82 | - public function getModulePidService() |
|
| 83 | - { |
|
| 84 | - /** @var ModulePidService $modulePidService */ |
|
| 85 | - return GeneralUtility::makeInstance(ModulePidService::class); |
|
| 86 | - } |
|
| 79 | + /** |
|
| 80 | + * @return ModulePidService|object |
|
| 81 | + */ |
|
| 82 | + public function getModulePidService() |
|
| 83 | + { |
|
| 84 | + /** @var ModulePidService $modulePidService */ |
|
| 85 | + return GeneralUtility::makeInstance(ModulePidService::class); |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | } |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | ] |
| 68 | 68 | ); |
| 69 | 69 | if (!empty($record)) { |
| 70 | - $moduleName = 'Vidi' . GeneralUtility::underscoredToUpperCamelCase($dataType) . 'M1'; |
|
| 70 | + $moduleName = 'Vidi'.GeneralUtility::underscoredToUpperCamelCase($dataType).'M1'; |
|
| 71 | 71 | $title = Tca::table($dataType)->getTitle(); |
| 72 | 72 | $modules[$moduleName] = $title; |
| 73 | 73 | } |
@@ -20,105 +20,105 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class ModuleService implements SingletonInterface |
| 22 | 22 | { |
| 23 | - /** |
|
| 24 | - * @var array |
|
| 25 | - */ |
|
| 26 | - protected $storage = []; |
|
| 23 | + /** |
|
| 24 | + * @var array |
|
| 25 | + */ |
|
| 26 | + protected $storage = []; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Returns a class instance |
|
| 30 | - * |
|
| 31 | - * @return \Fab\Vidi\Module\ModuleService|object |
|
| 32 | - */ |
|
| 33 | - public static function getInstance() |
|
| 34 | - { |
|
| 35 | - return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleService::class); |
|
| 36 | - } |
|
| 28 | + /** |
|
| 29 | + * Returns a class instance |
|
| 30 | + * |
|
| 31 | + * @return \Fab\Vidi\Module\ModuleService|object |
|
| 32 | + */ |
|
| 33 | + public static function getInstance() |
|
| 34 | + { |
|
| 35 | + return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleService::class); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Fetch all modules to be displayed on the current pid. |
|
| 40 | - * |
|
| 41 | - * @return array |
|
| 42 | - */ |
|
| 43 | - public function getModulesForCurrentPid(): array |
|
| 44 | - { |
|
| 45 | - $pid = $this->getModuleLoader()->getCurrentPid(); |
|
| 46 | - return $this->getModulesForPid($pid); |
|
| 47 | - } |
|
| 38 | + /** |
|
| 39 | + * Fetch all modules to be displayed on the current pid. |
|
| 40 | + * |
|
| 41 | + * @return array |
|
| 42 | + */ |
|
| 43 | + public function getModulesForCurrentPid(): array |
|
| 44 | + { |
|
| 45 | + $pid = $this->getModuleLoader()->getCurrentPid(); |
|
| 46 | + return $this->getModulesForPid($pid); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Fetch all modules displayed given a pid. |
|
| 51 | - * |
|
| 52 | - * @param int $pid |
|
| 53 | - * @return array |
|
| 54 | - */ |
|
| 55 | - public function getModulesForPid($pid = null): array |
|
| 56 | - { |
|
| 57 | - if (!isset($this->storage[$pid])) { |
|
| 58 | - $modules = []; |
|
| 59 | - foreach ($GLOBALS['TCA'] as $dataType => $configuration) { |
|
| 60 | - if (Tca::table($dataType)->isNotHidden()) { |
|
| 61 | - $record = $this->getDataService()->getRecord( |
|
| 62 | - $dataType, |
|
| 63 | - [ |
|
| 64 | - 'pid' => $pid |
|
| 65 | - ] |
|
| 66 | - ); |
|
| 67 | - if (!empty($record)) { |
|
| 68 | - $moduleName = 'Vidi' . GeneralUtility::underscoredToUpperCamelCase($dataType) . 'M1'; |
|
| 69 | - $title = Tca::table($dataType)->getTitle(); |
|
| 70 | - $modules[$moduleName] = $title; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - $this->storage[$pid] = $modules; |
|
| 75 | - } |
|
| 76 | - return $this->storage[$pid]; |
|
| 77 | - } |
|
| 49 | + /** |
|
| 50 | + * Fetch all modules displayed given a pid. |
|
| 51 | + * |
|
| 52 | + * @param int $pid |
|
| 53 | + * @return array |
|
| 54 | + */ |
|
| 55 | + public function getModulesForPid($pid = null): array |
|
| 56 | + { |
|
| 57 | + if (!isset($this->storage[$pid])) { |
|
| 58 | + $modules = []; |
|
| 59 | + foreach ($GLOBALS['TCA'] as $dataType => $configuration) { |
|
| 60 | + if (Tca::table($dataType)->isNotHidden()) { |
|
| 61 | + $record = $this->getDataService()->getRecord( |
|
| 62 | + $dataType, |
|
| 63 | + [ |
|
| 64 | + 'pid' => $pid |
|
| 65 | + ] |
|
| 66 | + ); |
|
| 67 | + if (!empty($record)) { |
|
| 68 | + $moduleName = 'Vidi' . GeneralUtility::underscoredToUpperCamelCase($dataType) . 'M1'; |
|
| 69 | + $title = Tca::table($dataType)->getTitle(); |
|
| 70 | + $modules[$moduleName] = $title; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + $this->storage[$pid] = $modules; |
|
| 75 | + } |
|
| 76 | + return $this->storage[$pid]; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Fetch the first module for the current pid. |
|
| 81 | - * |
|
| 82 | - * @return string |
|
| 83 | - */ |
|
| 84 | - public function getFirstModuleForCurrentPid(): string |
|
| 85 | - { |
|
| 86 | - $pid = $this->getModuleLoader()->getCurrentPid(); |
|
| 87 | - return $this->getFirstModuleForPid($pid); |
|
| 88 | - } |
|
| 79 | + /** |
|
| 80 | + * Fetch the first module for the current pid. |
|
| 81 | + * |
|
| 82 | + * @return string |
|
| 83 | + */ |
|
| 84 | + public function getFirstModuleForCurrentPid(): string |
|
| 85 | + { |
|
| 86 | + $pid = $this->getModuleLoader()->getCurrentPid(); |
|
| 87 | + return $this->getFirstModuleForPid($pid); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Fetch the module given a pid. |
|
| 92 | - * |
|
| 93 | - * @param int $pid |
|
| 94 | - * @return string |
|
| 95 | - */ |
|
| 96 | - public function getFirstModuleForPid($pid): string |
|
| 97 | - { |
|
| 98 | - $firstModule = ''; |
|
| 99 | - $modules = $this->getModulesForPid($pid); |
|
| 100 | - if (!empty($modules)) { |
|
| 101 | - $firstModule = key($modules); |
|
| 102 | - } |
|
| 90 | + /** |
|
| 91 | + * Fetch the module given a pid. |
|
| 92 | + * |
|
| 93 | + * @param int $pid |
|
| 94 | + * @return string |
|
| 95 | + */ |
|
| 96 | + public function getFirstModuleForPid($pid): string |
|
| 97 | + { |
|
| 98 | + $firstModule = ''; |
|
| 99 | + $modules = $this->getModulesForPid($pid); |
|
| 100 | + if (!empty($modules)) { |
|
| 101 | + $firstModule = key($modules); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - return $firstModule; |
|
| 105 | - } |
|
| 104 | + return $firstModule; |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * @return object|DataService |
|
| 109 | - */ |
|
| 110 | - protected function getDataService(): DataService |
|
| 111 | - { |
|
| 112 | - return GeneralUtility::makeInstance(DataService::class); |
|
| 113 | - } |
|
| 107 | + /** |
|
| 108 | + * @return object|DataService |
|
| 109 | + */ |
|
| 110 | + protected function getDataService(): DataService |
|
| 111 | + { |
|
| 112 | + return GeneralUtility::makeInstance(DataService::class); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Get the Vidi Module Loader. |
|
| 117 | - * |
|
| 118 | - * @return ModuleLoader|object |
|
| 119 | - */ |
|
| 120 | - protected function getModuleLoader() |
|
| 121 | - { |
|
| 122 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 123 | - } |
|
| 115 | + /** |
|
| 116 | + * Get the Vidi Module Loader. |
|
| 117 | + * |
|
| 118 | + * @return ModuleLoader|object |
|
| 119 | + */ |
|
| 120 | + protected function getModuleLoader() |
|
| 121 | + { |
|
| 122 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 123 | + } |
|
| 124 | 124 | } |