@@ -25,55 +25,55 @@ |
||
| 25 | 25 | class FacetController extends ActionController |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Suggest values according to a facet. |
|
| 30 | - * Output a json list of key / values. |
|
| 31 | - * |
|
| 32 | - * @param string $facet |
|
| 33 | - * @param string $searchTerm |
|
| 34 | - * @validate $facet Fab\Vidi\Domain\Validator\FacetValidator |
|
| 35 | - * @return string |
|
| 36 | - */ |
|
| 37 | - public function autoSuggestAction($facet, $searchTerm) |
|
| 38 | - { |
|
| 28 | + /** |
|
| 29 | + * Suggest values according to a facet. |
|
| 30 | + * Output a json list of key / values. |
|
| 31 | + * |
|
| 32 | + * @param string $facet |
|
| 33 | + * @param string $searchTerm |
|
| 34 | + * @validate $facet Fab\Vidi\Domain\Validator\FacetValidator |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 37 | + public function autoSuggestAction($facet, $searchTerm) |
|
| 38 | + { |
|
| 39 | 39 | |
| 40 | - $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet); |
|
| 40 | + $suggestions = $this->getFacetSuggestionService()->getSuggestions($facet); |
|
| 41 | 41 | |
| 42 | - # Json header is not automatically sent in the BE... |
|
| 43 | - $this->response->setHeader('Content-Type', 'application/json'); |
|
| 44 | - $this->response->sendHeaders(); |
|
| 45 | - return json_encode($suggestions); |
|
| 46 | - } |
|
| 42 | + # Json header is not automatically sent in the BE... |
|
| 43 | + $this->response->setHeader('Content-Type', 'application/json'); |
|
| 44 | + $this->response->sendHeaders(); |
|
| 45 | + return json_encode($suggestions); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Suggest values for all configured facets in the Grid. |
|
| 50 | - * Output a json list of key / values. |
|
| 51 | - * |
|
| 52 | - * @return string |
|
| 53 | - * @throws \Exception |
|
| 54 | - */ |
|
| 55 | - public function autoSuggestsAction() |
|
| 56 | - { |
|
| 48 | + /** |
|
| 49 | + * Suggest values for all configured facets in the Grid. |
|
| 50 | + * Output a json list of key / values. |
|
| 51 | + * |
|
| 52 | + * @return string |
|
| 53 | + * @throws \Exception |
|
| 54 | + */ |
|
| 55 | + public function autoSuggestsAction() |
|
| 56 | + { |
|
| 57 | 57 | |
| 58 | - $suggestions = array(); |
|
| 59 | - foreach (Tca::grid()->getFacets() as $facet) { |
|
| 60 | - /** @var FacetInterface $facet */ |
|
| 61 | - $name = $facet->getName(); |
|
| 62 | - $suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name); |
|
| 63 | - } |
|
| 58 | + $suggestions = array(); |
|
| 59 | + foreach (Tca::grid()->getFacets() as $facet) { |
|
| 60 | + /** @var FacetInterface $facet */ |
|
| 61 | + $name = $facet->getName(); |
|
| 62 | + $suggestions[$name] = $this->getFacetSuggestionService()->getSuggestions($name); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - # Json header is not automatically sent in the BE... |
|
| 66 | - $this->response->setHeader('Content-Type', 'application/json'); |
|
| 67 | - $this->response->sendHeaders(); |
|
| 68 | - return json_encode($suggestions); |
|
| 69 | - } |
|
| 65 | + # Json header is not automatically sent in the BE... |
|
| 66 | + $this->response->setHeader('Content-Type', 'application/json'); |
|
| 67 | + $this->response->sendHeaders(); |
|
| 68 | + return json_encode($suggestions); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * @return \Fab\Vidi\Facet\FacetSuggestionService |
|
| 73 | - */ |
|
| 74 | - protected function getFacetSuggestionService() |
|
| 75 | - { |
|
| 76 | - return GeneralUtility::makeInstance('Fab\Vidi\Facet\FacetSuggestionService'); |
|
| 77 | - } |
|
| 71 | + /** |
|
| 72 | + * @return \Fab\Vidi\Facet\FacetSuggestionService |
|
| 73 | + */ |
|
| 74 | + protected function getFacetSuggestionService() |
|
| 75 | + { |
|
| 76 | + return GeneralUtility::makeInstance('Fab\Vidi\Facet\FacetSuggestionService'); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | } |
@@ -25,94 +25,94 @@ |
||
| 25 | 25 | class SelectionController extends ActionController |
| 26 | 26 | { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var \Fab\Vidi\Domain\Repository\SelectionRepository |
|
| 30 | - * @inject |
|
| 31 | - */ |
|
| 32 | - protected $selectionRepository; |
|
| 28 | + /** |
|
| 29 | + * @var \Fab\Vidi\Domain\Repository\SelectionRepository |
|
| 30 | + * @inject |
|
| 31 | + */ |
|
| 32 | + protected $selectionRepository; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * @param Selection $selection |
|
| 36 | - * @throws \Fab\Vidi\Exception\InvalidKeyInArrayException |
|
| 37 | - */ |
|
| 38 | - public function createAction(Selection $selection = NULL) |
|
| 39 | - { |
|
| 40 | - $selection->setDataType($this->getModuleLoader()->getDataType()); |
|
| 34 | + /** |
|
| 35 | + * @param Selection $selection |
|
| 36 | + * @throws \Fab\Vidi\Exception\InvalidKeyInArrayException |
|
| 37 | + */ |
|
| 38 | + public function createAction(Selection $selection = NULL) |
|
| 39 | + { |
|
| 40 | + $selection->setDataType($this->getModuleLoader()->getDataType()); |
|
| 41 | 41 | |
| 42 | - $selection->setOwner($this->getBackendUser()->user['uid']); |
|
| 43 | - $this->selectionRepository->add($selection); |
|
| 44 | - $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); |
|
| 45 | - } |
|
| 42 | + $selection->setOwner($this->getBackendUser()->user['uid']); |
|
| 43 | + $this->selectionRepository->add($selection); |
|
| 44 | + $this->redirect('edit', 'Selection', 'vidi', array('dataType' => $selection->getDataType())); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @param Selection $selection |
|
| 49 | - * @return string |
|
| 50 | - * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException |
|
| 51 | - */ |
|
| 52 | - public function deleteAction(Selection $selection) |
|
| 53 | - { |
|
| 54 | - $this->selectionRepository->remove($selection); |
|
| 55 | - return 'ok'; |
|
| 56 | - } |
|
| 47 | + /** |
|
| 48 | + * @param Selection $selection |
|
| 49 | + * @return string |
|
| 50 | + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException |
|
| 51 | + */ |
|
| 52 | + public function deleteAction(Selection $selection) |
|
| 53 | + { |
|
| 54 | + $this->selectionRepository->remove($selection); |
|
| 55 | + return 'ok'; |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @param Selection $selection |
|
| 60 | - * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException |
|
| 61 | - * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException |
|
| 62 | - * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException |
|
| 63 | - */ |
|
| 64 | - public function updateAction(Selection $selection) |
|
| 65 | - { |
|
| 66 | - $this->selectionRepository->update($selection); |
|
| 67 | - $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); |
|
| 68 | - } |
|
| 58 | + /** |
|
| 59 | + * @param Selection $selection |
|
| 60 | + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException |
|
| 61 | + * @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException |
|
| 62 | + * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException |
|
| 63 | + */ |
|
| 64 | + public function updateAction(Selection $selection) |
|
| 65 | + { |
|
| 66 | + $this->selectionRepository->update($selection); |
|
| 67 | + $this->redirect('show', 'Selection', 'vidi', array('selection' => $selection->getUid())); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @param Selection $selection |
|
| 72 | - */ |
|
| 73 | - public function showAction(Selection $selection) |
|
| 74 | - { |
|
| 75 | - $this->view->assign('selection', $selection); |
|
| 76 | - } |
|
| 70 | + /** |
|
| 71 | + * @param Selection $selection |
|
| 72 | + */ |
|
| 73 | + public function showAction(Selection $selection) |
|
| 74 | + { |
|
| 75 | + $this->view->assign('selection', $selection); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Returns an editing form for a given data type. |
|
| 80 | - * |
|
| 81 | - * @param string $dataType |
|
| 82 | - */ |
|
| 83 | - public function editAction($dataType) |
|
| 84 | - { |
|
| 85 | - $selections = $this->selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
| 86 | - $this->view->assign('selections', $selections); |
|
| 87 | - } |
|
| 78 | + /** |
|
| 79 | + * Returns an editing form for a given data type. |
|
| 80 | + * |
|
| 81 | + * @param string $dataType |
|
| 82 | + */ |
|
| 83 | + public function editAction($dataType) |
|
| 84 | + { |
|
| 85 | + $selections = $this->selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
| 86 | + $this->view->assign('selections', $selections); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @param string $dataType |
|
| 91 | - */ |
|
| 92 | - public function listAction($dataType) |
|
| 93 | - { |
|
| 94 | - $selections = $this->selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
| 95 | - $this->view->assign('selections', $selections); |
|
| 96 | - } |
|
| 89 | + /** |
|
| 90 | + * @param string $dataType |
|
| 91 | + */ |
|
| 92 | + public function listAction($dataType) |
|
| 93 | + { |
|
| 94 | + $selections = $this->selectionRepository->findByDataTypeForCurrentBackendUser($dataType); |
|
| 95 | + $this->view->assign('selections', $selections); |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Get the Vidi Module Loader. |
|
| 100 | - * |
|
| 101 | - * @return ModuleLoader |
|
| 102 | - */ |
|
| 103 | - protected function getModuleLoader() |
|
| 104 | - { |
|
| 105 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 106 | - } |
|
| 98 | + /** |
|
| 99 | + * Get the Vidi Module Loader. |
|
| 100 | + * |
|
| 101 | + * @return ModuleLoader |
|
| 102 | + */ |
|
| 103 | + protected function getModuleLoader() |
|
| 104 | + { |
|
| 105 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Returns an instance of the current Backend User. |
|
| 110 | - * |
|
| 111 | - * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
| 112 | - */ |
|
| 113 | - protected function getBackendUser() |
|
| 114 | - { |
|
| 115 | - return $GLOBALS['BE_USER']; |
|
| 116 | - } |
|
| 108 | + /** |
|
| 109 | + * Returns an instance of the current Backend User. |
|
| 110 | + * |
|
| 111 | + * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication |
|
| 112 | + */ |
|
| 113 | + protected function getBackendUser() |
|
| 114 | + { |
|
| 115 | + return $GLOBALS['BE_USER']; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | 118 | } |
| 119 | 119 | \ No newline at end of file |
@@ -24,74 +24,74 @@ |
||
| 24 | 24 | class ToJsonViewHelper extends AbstractViewHelper |
| 25 | 25 | { |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * Render a Json response |
|
| 29 | - * |
|
| 30 | - * @return boolean |
|
| 31 | - * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException |
|
| 32 | - */ |
|
| 33 | - public function render() |
|
| 34 | - { |
|
| 27 | + /** |
|
| 28 | + * Render a Json response |
|
| 29 | + * |
|
| 30 | + * @return boolean |
|
| 31 | + * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException |
|
| 32 | + */ |
|
| 33 | + public function render() |
|
| 34 | + { |
|
| 35 | 35 | |
| 36 | - $objects = $this->templateVariableContainer->get('objects'); |
|
| 37 | - $columns = $this->templateVariableContainer->get('columns'); |
|
| 38 | - $output = array( |
|
| 39 | - 'sEcho' => $this->getNextTransactionId(), |
|
| 40 | - 'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 41 | - 'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 42 | - 'iNumberOfRecords' => count($objects), |
|
| 43 | - 'aaData' => $this->getRowsViewHelper()->render($objects, $columns), |
|
| 44 | - ); |
|
| 36 | + $objects = $this->templateVariableContainer->get('objects'); |
|
| 37 | + $columns = $this->templateVariableContainer->get('columns'); |
|
| 38 | + $output = array( |
|
| 39 | + 'sEcho' => $this->getNextTransactionId(), |
|
| 40 | + 'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 41 | + 'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 42 | + 'iNumberOfRecords' => count($objects), |
|
| 43 | + 'aaData' => $this->getRowsViewHelper()->render($objects, $columns), |
|
| 44 | + ); |
|
| 45 | 45 | |
| 46 | - $output = $this->encodeItems($output); |
|
| 47 | - $this->setHttpHeaders(); |
|
| 48 | - return json_encode($output); |
|
| 49 | - } |
|
| 46 | + $output = $this->encodeItems($output); |
|
| 47 | + $this->setHttpHeaders(); |
|
| 48 | + return json_encode($output); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * @return int |
|
| 53 | - */ |
|
| 54 | - protected function getNextTransactionId() |
|
| 55 | - { |
|
| 56 | - $transaction = 0; |
|
| 57 | - if (GeneralUtility::_GET('sEcho')) { |
|
| 58 | - $transaction = (int)GeneralUtility::_GET('sEcho') + 1; |
|
| 59 | - } |
|
| 60 | - return $transaction; |
|
| 61 | - } |
|
| 51 | + /** |
|
| 52 | + * @return int |
|
| 53 | + */ |
|
| 54 | + protected function getNextTransactionId() |
|
| 55 | + { |
|
| 56 | + $transaction = 0; |
|
| 57 | + if (GeneralUtility::_GET('sEcho')) { |
|
| 58 | + $transaction = (int)GeneralUtility::_GET('sEcho') + 1; |
|
| 59 | + } |
|
| 60 | + return $transaction; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * @param array $values |
|
| 65 | - * @return mixed |
|
| 66 | - */ |
|
| 67 | - protected function encodeItems(array $values) { |
|
| 68 | - foreach($values as $key => $value) { |
|
| 69 | - if(is_array($value)) { |
|
| 70 | - $values[$key] = $this->encodeItems($value); |
|
| 71 | - } |
|
| 72 | - else { |
|
| 73 | - $values[$key] = utf8_encode($value); |
|
| 74 | - } |
|
| 75 | - } |
|
| 76 | - return $values; |
|
| 77 | - } |
|
| 63 | + /** |
|
| 64 | + * @param array $values |
|
| 65 | + * @return mixed |
|
| 66 | + */ |
|
| 67 | + protected function encodeItems(array $values) { |
|
| 68 | + foreach($values as $key => $value) { |
|
| 69 | + if(is_array($value)) { |
|
| 70 | + $values[$key] = $this->encodeItems($value); |
|
| 71 | + } |
|
| 72 | + else { |
|
| 73 | + $values[$key] = utf8_encode($value); |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | + return $values; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @return void |
|
| 81 | - */ |
|
| 82 | - protected function setHttpHeaders() |
|
| 83 | - { |
|
| 84 | - /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */ |
|
| 85 | - $response = $this->templateVariableContainer->get('response'); |
|
| 86 | - $response->setHeader('Content-Type', 'application/json'); |
|
| 87 | - $response->sendHeaders(); |
|
| 88 | - } |
|
| 79 | + /** |
|
| 80 | + * @return void |
|
| 81 | + */ |
|
| 82 | + protected function setHttpHeaders() |
|
| 83 | + { |
|
| 84 | + /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */ |
|
| 85 | + $response = $this->templateVariableContainer->get('response'); |
|
| 86 | + $response->setHeader('Content-Type', 'application/json'); |
|
| 87 | + $response->sendHeaders(); |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @return RowsViewHelper |
|
| 92 | - */ |
|
| 93 | - protected function getRowsViewHelper() |
|
| 94 | - { |
|
| 95 | - return $this->objectManager->get(RowsViewHelper::class); |
|
| 96 | - } |
|
| 90 | + /** |
|
| 91 | + * @return RowsViewHelper |
|
| 92 | + */ |
|
| 93 | + protected function getRowsViewHelper() |
|
| 94 | + { |
|
| 95 | + return $this->objectManager->get(RowsViewHelper::class); |
|
| 96 | + } |
|
| 97 | 97 | } |
@@ -65,8 +65,8 @@ |
||
| 65 | 65 | * @return mixed |
| 66 | 66 | */ |
| 67 | 67 | protected function encodeItems(array $values) { |
| 68 | - foreach($values as $key => $value) { |
|
| 69 | - if(is_array($value)) { |
|
| 68 | + foreach ($values as $key => $value) { |
|
| 69 | + if (is_array($value)) { |
|
| 70 | 70 | $values[$key] = $this->encodeItems($value); |
| 71 | 71 | } |
| 72 | 72 | else { |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | foreach($values as $key => $value) { |
| 69 | 69 | if(is_array($value)) { |
| 70 | 70 | $values[$key] = $this->encodeItems($value); |
| 71 | - } |
|
| 72 | - else { |
|
| 71 | + } else { |
|
| 73 | 72 | $values[$key] = utf8_encode($value); |
| 74 | 73 | } |
| 75 | 74 | } |
@@ -1,28 +1,28 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | $EM_CONF[$_EXTKEY] = [ |
| 4 | - 'title' => 'Versatile and Interactive Display - List Component', |
|
| 5 | - 'description' => 'Generic listing of records with versatile ways of interacting with the data, e.g. advanced filter, inline editing, mass editing, ... Veni, vidi, vici!', |
|
| 6 | - 'category' => 'module', |
|
| 7 | - 'author' => 'Fabien Udriot', |
|
| 8 | - 'author_email' => '[email protected]', |
|
| 9 | - 'module' => '', |
|
| 10 | - 'state' => 'stable', |
|
| 11 | - 'version' => '2.3.0-dev', |
|
| 12 | - 'autoload' => [ |
|
| 13 | - 'psr-4' => ['Fab\\Vidi\\' => 'Classes'] |
|
| 14 | - ], |
|
| 15 | - 'constraints' => |
|
| 16 | - [ |
|
| 17 | - 'depends' => |
|
| 18 | - [ |
|
| 19 | - 'typo3' => '7.6.0-7.99.99', |
|
| 20 | - ], |
|
| 21 | - 'conflicts' => |
|
| 22 | - [ |
|
| 23 | - ], |
|
| 24 | - 'suggests' => |
|
| 25 | - [ |
|
| 26 | - ], |
|
| 27 | - ] |
|
| 4 | + 'title' => 'Versatile and Interactive Display - List Component', |
|
| 5 | + 'description' => 'Generic listing of records with versatile ways of interacting with the data, e.g. advanced filter, inline editing, mass editing, ... Veni, vidi, vici!', |
|
| 6 | + 'category' => 'module', |
|
| 7 | + 'author' => 'Fabien Udriot', |
|
| 8 | + 'author_email' => '[email protected]', |
|
| 9 | + 'module' => '', |
|
| 10 | + 'state' => 'stable', |
|
| 11 | + 'version' => '2.3.0-dev', |
|
| 12 | + 'autoload' => [ |
|
| 13 | + 'psr-4' => ['Fab\\Vidi\\' => 'Classes'] |
|
| 14 | + ], |
|
| 15 | + 'constraints' => |
|
| 16 | + [ |
|
| 17 | + 'depends' => |
|
| 18 | + [ |
|
| 19 | + 'typo3' => '7.6.0-7.99.99', |
|
| 20 | + ], |
|
| 21 | + 'conflicts' => |
|
| 22 | + [ |
|
| 23 | + ], |
|
| 24 | + 'suggests' => |
|
| 25 | + [ |
|
| 26 | + ], |
|
| 27 | + ] |
|
| 28 | 28 | ]; |