@@ -18,45 +18,45 @@ |
||
| 18 | 18 | class VidiCommandController extends CommandController |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Check TCA configuration for relations used in grid. |
|
| 23 | - * |
|
| 24 | - * @param string $table the table name. If not defined check for every table. |
|
| 25 | - * @return void |
|
| 26 | - */ |
|
| 27 | - public function analyseRelationsCommand($table = '') |
|
| 28 | - { |
|
| 29 | - |
|
| 30 | - foreach ($GLOBALS['TCA'] as $tableName => $TCA) { |
|
| 31 | - |
|
| 32 | - if ($table != '' && $table !== $tableName) { |
|
| 33 | - continue; |
|
| 34 | - } |
|
| 35 | - |
|
| 36 | - $fields = Tca::grid($tableName)->getFields(); |
|
| 37 | - if (!empty($fields)) { |
|
| 38 | - |
|
| 39 | - $relations = $this->getGridAnalyserService()->checkRelationForTable($tableName); |
|
| 40 | - if (!empty($relations)) { |
|
| 41 | - |
|
| 42 | - $this->outputLine(); |
|
| 43 | - $this->outputLine('--------------------------------------------------------------------'); |
|
| 44 | - $this->outputLine(); |
|
| 45 | - $this->outputLine(sprintf('Relations for "%s"', $tableName)); |
|
| 46 | - $this->outputLine(); |
|
| 47 | - $this->outputLine(implode("\n", $relations)); |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * Get the Vidi Module Loader. |
|
| 55 | - * |
|
| 56 | - * @return \Fab\Vidi\Grid\GridAnalyserService |
|
| 57 | - */ |
|
| 58 | - protected function getGridAnalyserService() |
|
| 59 | - { |
|
| 60 | - return GeneralUtility::makeInstance('Fab\Vidi\Grid\GridAnalyserService'); |
|
| 61 | - } |
|
| 21 | + /** |
|
| 22 | + * Check TCA configuration for relations used in grid. |
|
| 23 | + * |
|
| 24 | + * @param string $table the table name. If not defined check for every table. |
|
| 25 | + * @return void |
|
| 26 | + */ |
|
| 27 | + public function analyseRelationsCommand($table = '') |
|
| 28 | + { |
|
| 29 | + |
|
| 30 | + foreach ($GLOBALS['TCA'] as $tableName => $TCA) { |
|
| 31 | + |
|
| 32 | + if ($table != '' && $table !== $tableName) { |
|
| 33 | + continue; |
|
| 34 | + } |
|
| 35 | + |
|
| 36 | + $fields = Tca::grid($tableName)->getFields(); |
|
| 37 | + if (!empty($fields)) { |
|
| 38 | + |
|
| 39 | + $relations = $this->getGridAnalyserService()->checkRelationForTable($tableName); |
|
| 40 | + if (!empty($relations)) { |
|
| 41 | + |
|
| 42 | + $this->outputLine(); |
|
| 43 | + $this->outputLine('--------------------------------------------------------------------'); |
|
| 44 | + $this->outputLine(); |
|
| 45 | + $this->outputLine(sprintf('Relations for "%s"', $tableName)); |
|
| 46 | + $this->outputLine(); |
|
| 47 | + $this->outputLine(implode("\n", $relations)); |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * Get the Vidi Module Loader. |
|
| 55 | + * |
|
| 56 | + * @return \Fab\Vidi\Grid\GridAnalyserService |
|
| 57 | + */ |
|
| 58 | + protected function getGridAnalyserService() |
|
| 59 | + { |
|
| 60 | + return GeneralUtility::makeInstance('Fab\Vidi\Grid\GridAnalyserService'); |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -17,44 +17,44 @@ |
||
| 17 | 17 | class ContentRepositoryFactory implements SingletonInterface |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var array |
|
| 22 | - */ |
|
| 23 | - static protected $instances = array(); |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Returns a class instance of a repository. |
|
| 27 | - * If not data type is given, get the value from the module loader. |
|
| 28 | - * |
|
| 29 | - * @param string $dataType |
|
| 30 | - * @param string $sourceFieldName |
|
| 31 | - * @return \Fab\Vidi\Domain\Repository\ContentRepository |
|
| 32 | - */ |
|
| 33 | - static public function getInstance($dataType = NULL, $sourceFieldName = '') |
|
| 34 | - { |
|
| 35 | - |
|
| 36 | - /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */ |
|
| 37 | - if (is_null($dataType)) { |
|
| 38 | - |
|
| 39 | - // Try to get the data type from the module loader. |
|
| 40 | - $moduleLoader = GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader'); |
|
| 41 | - $dataType = $moduleLoader->getDataType(); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - // This should not happen. |
|
| 45 | - if (!$dataType) { |
|
| 46 | - throw new \RuntimeException('No data type given nor could be fetched by the module loader.', 1376118278); |
|
| 47 | - } |
|
| 48 | - |
|
| 49 | - if (empty(self::$instances[$dataType])) { |
|
| 50 | - $className = 'Fab\Vidi\Domain\Repository\ContentRepository'; |
|
| 51 | - self::$instances[$dataType] = GeneralUtility::makeInstance($className, $dataType, $sourceFieldName); |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** @var ContentRepository $contentRepository */ |
|
| 55 | - $contentRepository = self::$instances[$dataType]; |
|
| 56 | - $contentRepository->setSourceFieldName($sourceFieldName); |
|
| 57 | - return $contentRepository; |
|
| 58 | - } |
|
| 20 | + /** |
|
| 21 | + * @var array |
|
| 22 | + */ |
|
| 23 | + static protected $instances = array(); |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Returns a class instance of a repository. |
|
| 27 | + * If not data type is given, get the value from the module loader. |
|
| 28 | + * |
|
| 29 | + * @param string $dataType |
|
| 30 | + * @param string $sourceFieldName |
|
| 31 | + * @return \Fab\Vidi\Domain\Repository\ContentRepository |
|
| 32 | + */ |
|
| 33 | + static public function getInstance($dataType = NULL, $sourceFieldName = '') |
|
| 34 | + { |
|
| 35 | + |
|
| 36 | + /** @var \Fab\Vidi\Module\ModuleLoader $moduleLoader */ |
|
| 37 | + if (is_null($dataType)) { |
|
| 38 | + |
|
| 39 | + // Try to get the data type from the module loader. |
|
| 40 | + $moduleLoader = GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader'); |
|
| 41 | + $dataType = $moduleLoader->getDataType(); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + // This should not happen. |
|
| 45 | + if (!$dataType) { |
|
| 46 | + throw new \RuntimeException('No data type given nor could be fetched by the module loader.', 1376118278); |
|
| 47 | + } |
|
| 48 | + |
|
| 49 | + if (empty(self::$instances[$dataType])) { |
|
| 50 | + $className = 'Fab\Vidi\Domain\Repository\ContentRepository'; |
|
| 51 | + self::$instances[$dataType] = GeneralUtility::makeInstance($className, $dataType, $sourceFieldName); |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** @var ContentRepository $contentRepository */ |
|
| 55 | + $contentRepository = self::$instances[$dataType]; |
|
| 56 | + $contentRepository->setSourceFieldName($sourceFieldName); |
|
| 57 | + return $contentRepository; |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | } |
@@ -14,46 +14,46 @@ |
||
| 14 | 14 | interface ColumnRendererInterface |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Render a column in the Grid. |
|
| 19 | - * |
|
| 20 | - * @return string |
|
| 21 | - */ |
|
| 22 | - public function render(); |
|
| 23 | - |
|
| 24 | - /** |
|
| 25 | - * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 26 | - * @return $this |
|
| 27 | - */ |
|
| 28 | - public function setObject($object); |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @param string $fieldName |
|
| 32 | - * @return $this |
|
| 33 | - */ |
|
| 34 | - public function setFieldName($fieldName); |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @param int $index |
|
| 38 | - * @return $this |
|
| 39 | - */ |
|
| 40 | - public function setRowIndex($index); |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * @param array $configuration |
|
| 44 | - * @return $this |
|
| 45 | - */ |
|
| 46 | - public function setFieldConfiguration($configuration); |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * @param array $configuration |
|
| 50 | - * @return $this |
|
| 51 | - */ |
|
| 52 | - public function setGridRendererConfiguration($configuration); |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * @return array |
|
| 56 | - */ |
|
| 57 | - public function getConfiguration(); |
|
| 17 | + /** |
|
| 18 | + * Render a column in the Grid. |
|
| 19 | + * |
|
| 20 | + * @return string |
|
| 21 | + */ |
|
| 22 | + public function render(); |
|
| 23 | + |
|
| 24 | + /** |
|
| 25 | + * @param \Fab\Vidi\Domain\Model\Content $object |
|
| 26 | + * @return $this |
|
| 27 | + */ |
|
| 28 | + public function setObject($object); |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param string $fieldName |
|
| 32 | + * @return $this |
|
| 33 | + */ |
|
| 34 | + public function setFieldName($fieldName); |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @param int $index |
|
| 38 | + * @return $this |
|
| 39 | + */ |
|
| 40 | + public function setRowIndex($index); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * @param array $configuration |
|
| 44 | + * @return $this |
|
| 45 | + */ |
|
| 46 | + public function setFieldConfiguration($configuration); |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * @param array $configuration |
|
| 50 | + * @return $this |
|
| 51 | + */ |
|
| 52 | + public function setGridRendererConfiguration($configuration); |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * @return array |
|
| 56 | + */ |
|
| 57 | + public function getConfiguration(); |
|
| 58 | 58 | |
| 59 | 59 | } |
@@ -18,145 +18,145 @@ |
||
| 18 | 18 | class StandardFacet implements FacetInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - protected $name; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var string |
|
| 28 | - */ |
|
| 29 | - protected $label; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @var array |
|
| 33 | - */ |
|
| 34 | - protected $suggestions = array(); |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * @var string |
|
| 38 | - */ |
|
| 39 | - protected $dataType; |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * @var bool |
|
| 43 | - */ |
|
| 44 | - protected $canModifyMatcher = false; |
|
| 45 | - |
|
| 46 | - /** |
|
| 47 | - * Constructor of a Generic Facet in Vidi. |
|
| 48 | - * |
|
| 49 | - * @param string $name |
|
| 50 | - * @param string $label |
|
| 51 | - * @param array $suggestions |
|
| 52 | - */ |
|
| 53 | - public function __construct($name, $label = '', array $suggestions = array()) |
|
| 54 | - { |
|
| 55 | - $this->name = $name; |
|
| 56 | - if (empty($label)) { |
|
| 57 | - $label = $this->name; |
|
| 58 | - } |
|
| 59 | - $this->label = $label; |
|
| 60 | - $this->suggestions = $suggestions; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * @return string |
|
| 65 | - */ |
|
| 66 | - public function getName() |
|
| 67 | - { |
|
| 68 | - return $this->name; |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @return string |
|
| 73 | - */ |
|
| 74 | - public function getLabel() |
|
| 75 | - { |
|
| 76 | - if ($this->label === $this->name) { |
|
| 77 | - $label = Tca::table($this->dataType)->field($this->getName())->getLabel(); |
|
| 78 | - } else { |
|
| 79 | - $label = LocalizationUtility::translate($this->label, ''); |
|
| 80 | - if (empty($label)) { |
|
| 81 | - $label = $this->label; |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - return $label; |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * @return array |
|
| 90 | - */ |
|
| 91 | - public function getSuggestions() |
|
| 92 | - { |
|
| 93 | - |
|
| 94 | - $values = array(); |
|
| 95 | - foreach ($this->suggestions as $key => $label) { |
|
| 96 | - $localizedLabel = $this->getLanguageService()->sL($label); |
|
| 97 | - if (!empty($localizedLabel)) { |
|
| 98 | - $label = $localizedLabel; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $values[] = [$key => $label]; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - return $values; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @return \TYPO3\CMS\Lang\LanguageService |
|
| 109 | - */ |
|
| 110 | - protected function getLanguageService() |
|
| 111 | - { |
|
| 112 | - return $GLOBALS['LANG']; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * @return bool |
|
| 117 | - */ |
|
| 118 | - public function hasSuggestions() |
|
| 119 | - { |
|
| 120 | - return !empty($this->suggestions); |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @param string $dataType |
|
| 125 | - * @return $this |
|
| 126 | - */ |
|
| 127 | - public function setDataType($dataType) |
|
| 128 | - { |
|
| 129 | - $this->dataType = $dataType; |
|
| 130 | - return $this; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * @return bool |
|
| 135 | - */ |
|
| 136 | - public function canModifyMatcher() |
|
| 137 | - { |
|
| 138 | - return $this->canModifyMatcher; |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * @param Matcher $matcher |
|
| 143 | - * @param $value |
|
| 144 | - * @return Matcher |
|
| 145 | - */ |
|
| 146 | - public function modifyMatcher(Matcher $matcher, $value) |
|
| 147 | - { |
|
| 148 | - return $matcher; |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - /** |
|
| 152 | - * Magic method implementation for retrieving state. |
|
| 153 | - * |
|
| 154 | - * @param array $states |
|
| 155 | - * @return StandardFacet |
|
| 156 | - */ |
|
| 157 | - static public function __set_state($states) |
|
| 158 | - { |
|
| 159 | - return new StandardFacet($states['name'], $states['label'], $states['suggestions']); |
|
| 160 | - } |
|
| 21 | + /** |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + protected $name; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var string |
|
| 28 | + */ |
|
| 29 | + protected $label; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @var array |
|
| 33 | + */ |
|
| 34 | + protected $suggestions = array(); |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * @var string |
|
| 38 | + */ |
|
| 39 | + protected $dataType; |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * @var bool |
|
| 43 | + */ |
|
| 44 | + protected $canModifyMatcher = false; |
|
| 45 | + |
|
| 46 | + /** |
|
| 47 | + * Constructor of a Generic Facet in Vidi. |
|
| 48 | + * |
|
| 49 | + * @param string $name |
|
| 50 | + * @param string $label |
|
| 51 | + * @param array $suggestions |
|
| 52 | + */ |
|
| 53 | + public function __construct($name, $label = '', array $suggestions = array()) |
|
| 54 | + { |
|
| 55 | + $this->name = $name; |
|
| 56 | + if (empty($label)) { |
|
| 57 | + $label = $this->name; |
|
| 58 | + } |
|
| 59 | + $this->label = $label; |
|
| 60 | + $this->suggestions = $suggestions; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * @return string |
|
| 65 | + */ |
|
| 66 | + public function getName() |
|
| 67 | + { |
|
| 68 | + return $this->name; |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @return string |
|
| 73 | + */ |
|
| 74 | + public function getLabel() |
|
| 75 | + { |
|
| 76 | + if ($this->label === $this->name) { |
|
| 77 | + $label = Tca::table($this->dataType)->field($this->getName())->getLabel(); |
|
| 78 | + } else { |
|
| 79 | + $label = LocalizationUtility::translate($this->label, ''); |
|
| 80 | + if (empty($label)) { |
|
| 81 | + $label = $this->label; |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + return $label; |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * @return array |
|
| 90 | + */ |
|
| 91 | + public function getSuggestions() |
|
| 92 | + { |
|
| 93 | + |
|
| 94 | + $values = array(); |
|
| 95 | + foreach ($this->suggestions as $key => $label) { |
|
| 96 | + $localizedLabel = $this->getLanguageService()->sL($label); |
|
| 97 | + if (!empty($localizedLabel)) { |
|
| 98 | + $label = $localizedLabel; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $values[] = [$key => $label]; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + return $values; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @return \TYPO3\CMS\Lang\LanguageService |
|
| 109 | + */ |
|
| 110 | + protected function getLanguageService() |
|
| 111 | + { |
|
| 112 | + return $GLOBALS['LANG']; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * @return bool |
|
| 117 | + */ |
|
| 118 | + public function hasSuggestions() |
|
| 119 | + { |
|
| 120 | + return !empty($this->suggestions); |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @param string $dataType |
|
| 125 | + * @return $this |
|
| 126 | + */ |
|
| 127 | + public function setDataType($dataType) |
|
| 128 | + { |
|
| 129 | + $this->dataType = $dataType; |
|
| 130 | + return $this; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * @return bool |
|
| 135 | + */ |
|
| 136 | + public function canModifyMatcher() |
|
| 137 | + { |
|
| 138 | + return $this->canModifyMatcher; |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * @param Matcher $matcher |
|
| 143 | + * @param $value |
|
| 144 | + * @return Matcher |
|
| 145 | + */ |
|
| 146 | + public function modifyMatcher(Matcher $matcher, $value) |
|
| 147 | + { |
|
| 148 | + return $matcher; |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + /** |
|
| 152 | + * Magic method implementation for retrieving state. |
|
| 153 | + * |
|
| 154 | + * @param array $states |
|
| 155 | + * @return StandardFacet |
|
| 156 | + */ |
|
| 157 | + static public function __set_state($states) |
|
| 158 | + { |
|
| 159 | + return new StandardFacet($states['name'], $states['label'], $states['suggestions']); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | } |
@@ -19,45 +19,45 @@ |
||
| 19 | 19 | class JsonView extends AbstractView |
| 20 | 20 | { |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var \TYPO3\CMS\Extbase\Mvc\Web\Response |
|
| 24 | - */ |
|
| 25 | - protected $response; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * @var JsonResult |
|
| 29 | - */ |
|
| 30 | - protected $result; |
|
| 31 | - |
|
| 32 | - /** |
|
| 33 | - * @return string |
|
| 34 | - */ |
|
| 35 | - public function render() |
|
| 36 | - { |
|
| 37 | - # As of this writing, Json header is not automatically sent in the BE... even with json=format. |
|
| 38 | - $this->response->setHeader('Content-Type', 'application/json'); |
|
| 39 | - $this->response->sendHeaders(); |
|
| 40 | - |
|
| 41 | - return json_encode($this->result->toArray()); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param \TYPO3\CMS\Extbase\Mvc\Web\Response $response |
|
| 46 | - * @return void |
|
| 47 | - */ |
|
| 48 | - public function setResponse(Response $response) |
|
| 49 | - { |
|
| 50 | - $this->response = $response; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @param \Fab\Vidi\Mvc\JsonResult $result |
|
| 55 | - * @return $this |
|
| 56 | - */ |
|
| 57 | - public function setResult(JsonResult $result) |
|
| 58 | - { |
|
| 59 | - $this->result = $result; |
|
| 60 | - return $this; |
|
| 61 | - } |
|
| 22 | + /** |
|
| 23 | + * @var \TYPO3\CMS\Extbase\Mvc\Web\Response |
|
| 24 | + */ |
|
| 25 | + protected $response; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * @var JsonResult |
|
| 29 | + */ |
|
| 30 | + protected $result; |
|
| 31 | + |
|
| 32 | + /** |
|
| 33 | + * @return string |
|
| 34 | + */ |
|
| 35 | + public function render() |
|
| 36 | + { |
|
| 37 | + # As of this writing, Json header is not automatically sent in the BE... even with json=format. |
|
| 38 | + $this->response->setHeader('Content-Type', 'application/json'); |
|
| 39 | + $this->response->sendHeaders(); |
|
| 40 | + |
|
| 41 | + return json_encode($this->result->toArray()); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param \TYPO3\CMS\Extbase\Mvc\Web\Response $response |
|
| 46 | + * @return void |
|
| 47 | + */ |
|
| 48 | + public function setResponse(Response $response) |
|
| 49 | + { |
|
| 50 | + $this->response = $response; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @param \Fab\Vidi\Mvc\JsonResult $result |
|
| 55 | + * @return $this |
|
| 56 | + */ |
|
| 57 | + public function setResult(JsonResult $result) |
|
| 58 | + { |
|
| 59 | + $this->result = $result; |
|
| 60 | + return $this; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | \ No newline at end of file |
@@ -15,48 +15,48 @@ |
||
| 15 | 15 | abstract class AbstractTool implements ToolInterface |
| 16 | 16 | { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @param string $templateNameAndPath |
|
| 20 | - * @return \TYPO3\CMS\Fluid\View\StandaloneView |
|
| 21 | - */ |
|
| 22 | - protected function initializeStandaloneView($templateNameAndPath) |
|
| 23 | - { |
|
| 24 | - |
|
| 25 | - $templateNameAndPath = GeneralUtility::getFileAbsFileName($templateNameAndPath); |
|
| 26 | - |
|
| 27 | - /** @var \TYPO3\CMS\Fluid\View\StandaloneView $view */ |
|
| 28 | - $view = $this->getObjectManager()->get('TYPO3\CMS\Fluid\View\StandaloneView'); |
|
| 29 | - |
|
| 30 | - $view->setTemplatePathAndFilename($templateNameAndPath); |
|
| 31 | - return $view; |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - /** |
|
| 35 | - * Returns an instance of the current Backend User. |
|
| 36 | - * |
|
| 37 | - * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
| 38 | - */ |
|
| 39 | - protected function getBackendUser() |
|
| 40 | - { |
|
| 41 | - return $GLOBALS['BE_USER']; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @return \TYPO3\CMS\Extbase\Object\ObjectManager |
|
| 46 | - */ |
|
| 47 | - protected function getObjectManager() |
|
| 48 | - { |
|
| 49 | - return GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager'); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Get the Vidi Module Loader. |
|
| 54 | - * |
|
| 55 | - * @return \Fab\Vidi\Module\ModuleLoader |
|
| 56 | - */ |
|
| 57 | - protected function getModuleLoader() |
|
| 58 | - { |
|
| 59 | - return GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader'); |
|
| 60 | - } |
|
| 18 | + /** |
|
| 19 | + * @param string $templateNameAndPath |
|
| 20 | + * @return \TYPO3\CMS\Fluid\View\StandaloneView |
|
| 21 | + */ |
|
| 22 | + protected function initializeStandaloneView($templateNameAndPath) |
|
| 23 | + { |
|
| 24 | + |
|
| 25 | + $templateNameAndPath = GeneralUtility::getFileAbsFileName($templateNameAndPath); |
|
| 26 | + |
|
| 27 | + /** @var \TYPO3\CMS\Fluid\View\StandaloneView $view */ |
|
| 28 | + $view = $this->getObjectManager()->get('TYPO3\CMS\Fluid\View\StandaloneView'); |
|
| 29 | + |
|
| 30 | + $view->setTemplatePathAndFilename($templateNameAndPath); |
|
| 31 | + return $view; |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + /** |
|
| 35 | + * Returns an instance of the current Backend User. |
|
| 36 | + * |
|
| 37 | + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
| 38 | + */ |
|
| 39 | + protected function getBackendUser() |
|
| 40 | + { |
|
| 41 | + return $GLOBALS['BE_USER']; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @return \TYPO3\CMS\Extbase\Object\ObjectManager |
|
| 46 | + */ |
|
| 47 | + protected function getObjectManager() |
|
| 48 | + { |
|
| 49 | + return GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager'); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Get the Vidi Module Loader. |
|
| 54 | + * |
|
| 55 | + * @return \Fab\Vidi\Module\ModuleLoader |
|
| 56 | + */ |
|
| 57 | + protected function getModuleLoader() |
|
| 58 | + { |
|
| 59 | + return GeneralUtility::makeInstance('Fab\Vidi\Module\ModuleLoader'); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | } |
@@ -18,43 +18,43 @@ |
||
| 18 | 18 | class OrderObjectFactory implements SingletonInterface |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Gets a singleton instance of this class. |
|
| 23 | - * |
|
| 24 | - * @return \Fab\Vidi\Persistence\OrderObjectFactory |
|
| 25 | - */ |
|
| 26 | - static public function getInstance() |
|
| 27 | - { |
|
| 28 | - return GeneralUtility::makeInstance('Fab\Vidi\Persistence\OrderObjectFactory'); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * Returns an order object. |
|
| 33 | - * |
|
| 34 | - * @param string $dataType |
|
| 35 | - * @return \Fab\Vidi\Persistence\Order |
|
| 36 | - */ |
|
| 37 | - public function getOrder($dataType = '') |
|
| 38 | - { |
|
| 39 | - |
|
| 40 | - // Default ordering |
|
| 41 | - $order = Tca::table($dataType)->getDefaultOrderings(); |
|
| 42 | - |
|
| 43 | - // Retrieve a possible id of the column from the request |
|
| 44 | - $orderings = GeneralUtility::_GP('order'); |
|
| 45 | - |
|
| 46 | - if (is_array($orderings) && isset($orderings[0])) { |
|
| 47 | - $columnPosition = $orderings[0]['column']; |
|
| 48 | - $direction = $orderings[0]['dir']; |
|
| 49 | - |
|
| 50 | - if ($columnPosition > 0) { |
|
| 51 | - $field = Tca::grid()->getFieldNameByPosition($columnPosition); |
|
| 52 | - |
|
| 53 | - $order = array( |
|
| 54 | - $field => strtoupper($direction) |
|
| 55 | - ); |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - return GeneralUtility::makeInstance('Fab\Vidi\Persistence\Order', $order); |
|
| 59 | - } |
|
| 21 | + /** |
|
| 22 | + * Gets a singleton instance of this class. |
|
| 23 | + * |
|
| 24 | + * @return \Fab\Vidi\Persistence\OrderObjectFactory |
|
| 25 | + */ |
|
| 26 | + static public function getInstance() |
|
| 27 | + { |
|
| 28 | + return GeneralUtility::makeInstance('Fab\Vidi\Persistence\OrderObjectFactory'); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * Returns an order object. |
|
| 33 | + * |
|
| 34 | + * @param string $dataType |
|
| 35 | + * @return \Fab\Vidi\Persistence\Order |
|
| 36 | + */ |
|
| 37 | + public function getOrder($dataType = '') |
|
| 38 | + { |
|
| 39 | + |
|
| 40 | + // Default ordering |
|
| 41 | + $order = Tca::table($dataType)->getDefaultOrderings(); |
|
| 42 | + |
|
| 43 | + // Retrieve a possible id of the column from the request |
|
| 44 | + $orderings = GeneralUtility::_GP('order'); |
|
| 45 | + |
|
| 46 | + if (is_array($orderings) && isset($orderings[0])) { |
|
| 47 | + $columnPosition = $orderings[0]['column']; |
|
| 48 | + $direction = $orderings[0]['dir']; |
|
| 49 | + |
|
| 50 | + if ($columnPosition > 0) { |
|
| 51 | + $field = Tca::grid()->getFieldNameByPosition($columnPosition); |
|
| 52 | + |
|
| 53 | + $order = array( |
|
| 54 | + $field => strtoupper($direction) |
|
| 55 | + ); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + return GeneralUtility::makeInstance('Fab\Vidi\Persistence\Order', $order); |
|
| 59 | + } |
|
| 60 | 60 | } |