@@ -20,13 +20,13 @@ |
||
| 20 | 20 | interface TcaServiceInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - const TYPE_TABLE = 'table'; |
|
| 23 | + const TYPE_TABLE = 'table'; |
|
| 24 | 24 | |
| 25 | - const TYPE_FIELD = 'field'; |
|
| 25 | + const TYPE_FIELD = 'field'; |
|
| 26 | 26 | |
| 27 | - const TYPE_GRID = 'grid'; |
|
| 27 | + const TYPE_GRID = 'grid'; |
|
| 28 | 28 | |
| 29 | - const TYPE_FORM = 'form'; |
|
| 29 | + const TYPE_FORM = 'form'; |
|
| 30 | 30 | |
| 31 | - const TYPE_FACET = 'facet'; |
|
| 31 | + const TYPE_FACET = 'facet'; |
|
| 32 | 32 | } |
@@ -22,28 +22,28 @@ |
||
| 22 | 22 | class FieldType extends Enumeration |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - const TEXT = 'text'; |
|
| 25 | + const TEXT = 'text'; |
|
| 26 | 26 | |
| 27 | - const NUMBER = 'number'; |
|
| 27 | + const NUMBER = 'number'; |
|
| 28 | 28 | |
| 29 | - const EMAIL = 'email'; |
|
| 29 | + const EMAIL = 'email'; |
|
| 30 | 30 | |
| 31 | - const DATE = 'date'; |
|
| 31 | + const DATE = 'date'; |
|
| 32 | 32 | |
| 33 | - const DATETIME = 'datetime'; |
|
| 33 | + const DATETIME = 'datetime'; |
|
| 34 | 34 | |
| 35 | - const TEXTAREA = 'textarea'; |
|
| 35 | + const TEXTAREA = 'textarea'; |
|
| 36 | 36 | |
| 37 | - const SELECT = 'select'; |
|
| 37 | + const SELECT = 'select'; |
|
| 38 | 38 | |
| 39 | - const RADIO = 'radio'; |
|
| 39 | + const RADIO = 'radio'; |
|
| 40 | 40 | |
| 41 | - const CHECKBOX = 'check'; |
|
| 41 | + const CHECKBOX = 'check'; |
|
| 42 | 42 | |
| 43 | - const FILE = 'file'; |
|
| 43 | + const FILE = 'file'; |
|
| 44 | 44 | |
| 45 | - const MULTISELECT = 'multiselect'; |
|
| 45 | + const MULTISELECT = 'multiselect'; |
|
| 46 | 46 | |
| 47 | - const TREE = 'tree'; |
|
| 47 | + const TREE = 'tree'; |
|
| 48 | 48 | |
| 49 | 49 | } |
| 50 | 50 | \ No newline at end of file |
@@ -23,52 +23,52 @@ |
||
| 23 | 23 | interface FacetInterface |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Return the "key" of the facet. |
|
| 28 | - * |
|
| 29 | - * @return string |
|
| 30 | - */ |
|
| 31 | - public function getName(); |
|
| 26 | + /** |
|
| 27 | + * Return the "key" of the facet. |
|
| 28 | + * |
|
| 29 | + * @return string |
|
| 30 | + */ |
|
| 31 | + public function getName(); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Return the "label" of the facet. |
|
| 35 | - * |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - public function getLabel(); |
|
| 33 | + /** |
|
| 34 | + * Return the "label" of the facet. |
|
| 35 | + * |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + public function getLabel(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Return possible "suggestions" of the facet. |
|
| 42 | - * |
|
| 43 | - * @return array |
|
| 44 | - */ |
|
| 45 | - public function getSuggestions(); |
|
| 40 | + /** |
|
| 41 | + * Return possible "suggestions" of the facet. |
|
| 42 | + * |
|
| 43 | + * @return array |
|
| 44 | + */ |
|
| 45 | + public function getSuggestions(); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Tell whether the Facet has suggestion or not. |
|
| 49 | - * |
|
| 50 | - * @return bool |
|
| 51 | - */ |
|
| 52 | - public function hasSuggestions(); |
|
| 47 | + /** |
|
| 48 | + * Tell whether the Facet has suggestion or not. |
|
| 49 | + * |
|
| 50 | + * @return bool |
|
| 51 | + */ |
|
| 52 | + public function hasSuggestions(); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Set the data type. |
|
| 56 | - * |
|
| 57 | - * @param string $dataType |
|
| 58 | - * @return $this |
|
| 59 | - */ |
|
| 60 | - public function setDataType($dataType); |
|
| 54 | + /** |
|
| 55 | + * Set the data type. |
|
| 56 | + * |
|
| 57 | + * @param string $dataType |
|
| 58 | + * @return $this |
|
| 59 | + */ |
|
| 60 | + public function setDataType($dataType); |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * @return bool |
|
| 64 | - */ |
|
| 65 | - public function canModifyMatcher(); |
|
| 62 | + /** |
|
| 63 | + * @return bool |
|
| 64 | + */ |
|
| 65 | + public function canModifyMatcher(); |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * @param Matcher $matcher |
|
| 69 | - * @param $value |
|
| 70 | - * @return Matcher |
|
| 71 | - */ |
|
| 72 | - public function modifyMatcher(Matcher $matcher, $value); |
|
| 67 | + /** |
|
| 68 | + * @param Matcher $matcher |
|
| 69 | + * @param $value |
|
| 70 | + * @return Matcher |
|
| 71 | + */ |
|
| 72 | + public function modifyMatcher(Matcher $matcher, $value); |
|
| 73 | 73 | |
| 74 | 74 | } |
@@ -22,20 +22,20 @@ |
||
| 22 | 22 | class ModulePosition extends Enumeration |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - const DOC_HEADER = 'doc-header'; |
|
| 25 | + const DOC_HEADER = 'doc-header'; |
|
| 26 | 26 | |
| 27 | - const TOP = 'top'; |
|
| 27 | + const TOP = 'top'; |
|
| 28 | 28 | |
| 29 | - const BOTTOM = 'bottom'; |
|
| 29 | + const BOTTOM = 'bottom'; |
|
| 30 | 30 | |
| 31 | - const LEFT = 'left'; |
|
| 31 | + const LEFT = 'left'; |
|
| 32 | 32 | |
| 33 | - const RIGHT = 'right'; |
|
| 33 | + const RIGHT = 'right'; |
|
| 34 | 34 | |
| 35 | - const GRID = 'grid'; |
|
| 35 | + const GRID = 'grid'; |
|
| 36 | 36 | |
| 37 | - const BUTTONS = 'buttons'; |
|
| 37 | + const BUTTONS = 'buttons'; |
|
| 38 | 38 | |
| 39 | - const MENU_MASS_ACTION = 'menu-mass-action'; |
|
| 39 | + const MENU_MASS_ACTION = 'menu-mass-action'; |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | \ No newline at end of file |
@@ -22,14 +22,14 @@ |
||
| 22 | 22 | class ModuleName extends Enumeration |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - const WEB = 'web'; |
|
| 25 | + const WEB = 'web'; |
|
| 26 | 26 | |
| 27 | - const FILE = 'file'; |
|
| 27 | + const FILE = 'file'; |
|
| 28 | 28 | |
| 29 | - const USER = 'user'; |
|
| 29 | + const USER = 'user'; |
|
| 30 | 30 | |
| 31 | - const ADMIN = 'admin'; |
|
| 31 | + const ADMIN = 'admin'; |
|
| 32 | 32 | |
| 33 | - const SYSTEM = 'system'; |
|
| 33 | + const SYSTEM = 'system'; |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | \ No newline at end of file |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | class Access extends Enumeration |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - const USER = 'user,group'; |
|
| 25 | + const USER = 'user,group'; |
|
| 26 | 26 | |
| 27 | - const ADMIN = 'admin'; |
|
| 27 | + const ADMIN = 'admin'; |
|
| 28 | 28 | } |
| 29 | 29 | \ No newline at end of file |
@@ -20,33 +20,33 @@ |
||
| 20 | 20 | interface ToolInterface |
| 21 | 21 | { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Display the title of the tool on the welcome screen. |
|
| 25 | - * |
|
| 26 | - * @return string |
|
| 27 | - */ |
|
| 28 | - public function getTitle(); |
|
| 23 | + /** |
|
| 24 | + * Display the title of the tool on the welcome screen. |
|
| 25 | + * |
|
| 26 | + * @return string |
|
| 27 | + */ |
|
| 28 | + public function getTitle(); |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Display the description of the tool on the welcome screen. |
|
| 32 | - * |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function getDescription(); |
|
| 30 | + /** |
|
| 31 | + * Display the description of the tool on the welcome screen. |
|
| 32 | + * |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function getDescription(); |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Do the job. |
|
| 39 | - * |
|
| 40 | - * @param array $arguments |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function work(array $arguments = array()); |
|
| 37 | + /** |
|
| 38 | + * Do the job. |
|
| 39 | + * |
|
| 40 | + * @param array $arguments |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function work(array $arguments = array()); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Tell whether the tools should be displayed. |
|
| 47 | - * |
|
| 48 | - * @return bool |
|
| 49 | - */ |
|
| 50 | - public function isShown(); |
|
| 45 | + /** |
|
| 46 | + * Tell whether the tools should be displayed. |
|
| 47 | + * |
|
| 48 | + * @return bool |
|
| 49 | + */ |
|
| 50 | + public function isShown(); |
|
| 51 | 51 | |
| 52 | 52 | } |
@@ -58,8 +58,7 @@ |
||
| 58 | 58 | { |
| 59 | 59 | // Resolve the table name. |
| 60 | 60 | self::$currentTable = $tableNameOrContentObject instanceof Content ? |
| 61 | - $tableNameOrContentObject->getDataType() : |
|
| 62 | - $tableNameOrContentObject; |
|
| 61 | + $tableNameOrContentObject->getDataType() : $tableNameOrContentObject; |
|
| 63 | 62 | return $this; |
| 64 | 63 | } |
| 65 | 64 | |
@@ -18,98 +18,98 @@ |
||
| 18 | 18 | class Field implements SingletonInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - static protected $currentField; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - static protected $currentTable; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @var array |
|
| 33 | - */ |
|
| 34 | - protected $storage = []; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param string $fieldName |
|
| 38 | - * @return $this |
|
| 39 | - * @throws \InvalidArgumentException |
|
| 40 | - */ |
|
| 41 | - static public function name($fieldName) |
|
| 42 | - { |
|
| 43 | - self::$currentField = $fieldName; |
|
| 44 | - self::$currentTable = ''; // reset the table name value. |
|
| 45 | - return GeneralUtility::makeInstance(self::class); |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @param string|Content $tableNameOrContentObject |
|
| 50 | - * @return $this |
|
| 51 | - */ |
|
| 52 | - public function of($tableNameOrContentObject) |
|
| 53 | - { |
|
| 54 | - // Resolve the table name. |
|
| 55 | - self::$currentTable = $tableNameOrContentObject instanceof Content ? |
|
| 56 | - $tableNameOrContentObject->getDataType() : |
|
| 57 | - $tableNameOrContentObject; |
|
| 58 | - return $this; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * @return string |
|
| 63 | - * @throws \RuntimeException |
|
| 64 | - */ |
|
| 65 | - public function toPropertyName() |
|
| 66 | - { |
|
| 67 | - |
|
| 68 | - $fieldName = $this->getFieldName(); |
|
| 69 | - $tableName = $this->getTableName(); |
|
| 70 | - |
|
| 71 | - if (empty($this->storage[$tableName][$fieldName])) { |
|
| 72 | - if ($this->storage[$tableName]) { |
|
| 73 | - $this->storage[$tableName] = []; |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - // Special case when the field name does not follow the conventions "field_name" => "fieldName". |
|
| 77 | - // Rely on mapping for those cases. |
|
| 78 | - if (!empty($GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName])) { |
|
| 79 | - $propertyName = $GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName]; |
|
| 80 | - } else { |
|
| 81 | - $propertyName = GeneralUtility::underscoredToLowerCamelCase($fieldName); |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - $this->storage[$tableName][$fieldName] = $propertyName; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - return $this->storage[$tableName][$fieldName]; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @return string |
|
| 92 | - * @throws \RuntimeException |
|
| 93 | - */ |
|
| 94 | - protected function getFieldName() |
|
| 95 | - { |
|
| 96 | - $fieldName = self::$currentField; |
|
| 97 | - if (empty($fieldName)) { |
|
| 98 | - throw new \RuntimeException('I could not find a field name value.', 1403203290); |
|
| 99 | - } |
|
| 100 | - return $fieldName; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @return string |
|
| 105 | - */ |
|
| 106 | - protected function getTableName() |
|
| 107 | - { |
|
| 108 | - $tableName = self::$currentTable; |
|
| 109 | - if (empty($tableName)) { |
|
| 110 | - throw new \RuntimeException('I could not find a table name value.', 1403203291); |
|
| 111 | - } |
|
| 112 | - return $tableName; |
|
| 113 | - } |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + static protected $currentField; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + static protected $currentTable; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @var array |
|
| 33 | + */ |
|
| 34 | + protected $storage = []; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param string $fieldName |
|
| 38 | + * @return $this |
|
| 39 | + * @throws \InvalidArgumentException |
|
| 40 | + */ |
|
| 41 | + static public function name($fieldName) |
|
| 42 | + { |
|
| 43 | + self::$currentField = $fieldName; |
|
| 44 | + self::$currentTable = ''; // reset the table name value. |
|
| 45 | + return GeneralUtility::makeInstance(self::class); |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @param string|Content $tableNameOrContentObject |
|
| 50 | + * @return $this |
|
| 51 | + */ |
|
| 52 | + public function of($tableNameOrContentObject) |
|
| 53 | + { |
|
| 54 | + // Resolve the table name. |
|
| 55 | + self::$currentTable = $tableNameOrContentObject instanceof Content ? |
|
| 56 | + $tableNameOrContentObject->getDataType() : |
|
| 57 | + $tableNameOrContentObject; |
|
| 58 | + return $this; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * @return string |
|
| 63 | + * @throws \RuntimeException |
|
| 64 | + */ |
|
| 65 | + public function toPropertyName() |
|
| 66 | + { |
|
| 67 | + |
|
| 68 | + $fieldName = $this->getFieldName(); |
|
| 69 | + $tableName = $this->getTableName(); |
|
| 70 | + |
|
| 71 | + if (empty($this->storage[$tableName][$fieldName])) { |
|
| 72 | + if ($this->storage[$tableName]) { |
|
| 73 | + $this->storage[$tableName] = []; |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + // Special case when the field name does not follow the conventions "field_name" => "fieldName". |
|
| 77 | + // Rely on mapping for those cases. |
|
| 78 | + if (!empty($GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName])) { |
|
| 79 | + $propertyName = $GLOBALS['TCA'][$tableName]['vidi']['mappings'][$fieldName]; |
|
| 80 | + } else { |
|
| 81 | + $propertyName = GeneralUtility::underscoredToLowerCamelCase($fieldName); |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + $this->storage[$tableName][$fieldName] = $propertyName; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + return $this->storage[$tableName][$fieldName]; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @return string |
|
| 92 | + * @throws \RuntimeException |
|
| 93 | + */ |
|
| 94 | + protected function getFieldName() |
|
| 95 | + { |
|
| 96 | + $fieldName = self::$currentField; |
|
| 97 | + if (empty($fieldName)) { |
|
| 98 | + throw new \RuntimeException('I could not find a field name value.', 1403203290); |
|
| 99 | + } |
|
| 100 | + return $fieldName; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @return string |
|
| 105 | + */ |
|
| 106 | + protected function getTableName() |
|
| 107 | + { |
|
| 108 | + $tableName = self::$currentTable; |
|
| 109 | + if (empty($tableName)) { |
|
| 110 | + throw new \RuntimeException('I could not find a table name value.', 1403203291); |
|
| 111 | + } |
|
| 112 | + return $tableName; |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | } |
@@ -26,32 +26,32 @@ |
||
| 26 | 26 | class ToolButton extends AbstractComponentView |
| 27 | 27 | { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Renders a dropdown menu for storage. |
|
| 31 | - * |
|
| 32 | - * @return string |
|
| 33 | - */ |
|
| 34 | - public function render() |
|
| 35 | - { |
|
| 36 | - $result = ''; |
|
| 37 | - |
|
| 38 | - // Compute the additional parameters. |
|
| 39 | - $additionalParameters = array( |
|
| 40 | - $this->getModuleLoader()->getParameterPrefix() => array('controller' => 'Tool', 'action' => 'welcome'), |
|
| 41 | - ); |
|
| 42 | - |
|
| 43 | - // Get current data type and tell whether there are registered tools. |
|
| 44 | - $dataType = $this->getModuleLoader()->getDataType(); |
|
| 45 | - |
|
| 46 | - if (ToolRegistry::getInstance()->hasAnyTools($dataType)) { |
|
| 47 | - $result = sprintf( |
|
| 48 | - '<a href="%s&returnUrl=%s" class="btn btn-default btn-sm btn-doc-header" title="%s"><span class="t3-icon fa fa-cog" aria-hidden="true"></span></a>', |
|
| 49 | - $this->getModuleLoader()->getModuleUrl($additionalParameters), |
|
| 50 | - urlencode($this->getModuleLoader()->getModuleUrl()), |
|
| 51 | - $this->getLanguageService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:open_tools') |
|
| 52 | - ); |
|
| 53 | - } |
|
| 54 | - return $result; |
|
| 55 | - } |
|
| 29 | + /** |
|
| 30 | + * Renders a dropdown menu for storage. |
|
| 31 | + * |
|
| 32 | + * @return string |
|
| 33 | + */ |
|
| 34 | + public function render() |
|
| 35 | + { |
|
| 36 | + $result = ''; |
|
| 37 | + |
|
| 38 | + // Compute the additional parameters. |
|
| 39 | + $additionalParameters = array( |
|
| 40 | + $this->getModuleLoader()->getParameterPrefix() => array('controller' => 'Tool', 'action' => 'welcome'), |
|
| 41 | + ); |
|
| 42 | + |
|
| 43 | + // Get current data type and tell whether there are registered tools. |
|
| 44 | + $dataType = $this->getModuleLoader()->getDataType(); |
|
| 45 | + |
|
| 46 | + if (ToolRegistry::getInstance()->hasAnyTools($dataType)) { |
|
| 47 | + $result = sprintf( |
|
| 48 | + '<a href="%s&returnUrl=%s" class="btn btn-default btn-sm btn-doc-header" title="%s"><span class="t3-icon fa fa-cog" aria-hidden="true"></span></a>', |
|
| 49 | + $this->getModuleLoader()->getModuleUrl($additionalParameters), |
|
| 50 | + urlencode($this->getModuleLoader()->getModuleUrl()), |
|
| 51 | + $this->getLanguageService()->sL('LLL:EXT:vidi/Resources/Private/Language/locallang.xlf:open_tools') |
|
| 52 | + ); |
|
| 53 | + } |
|
| 54 | + return $result; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | } |