@@ -18,58 +18,58 @@ |
||
| 18 | 18 | class ToJsonViewHelper extends AbstractViewHelper |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * Render a Json response |
|
| 23 | - * |
|
| 24 | - * @return boolean |
|
| 25 | - * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException |
|
| 26 | - */ |
|
| 27 | - public function render() |
|
| 28 | - { |
|
| 21 | + /** |
|
| 22 | + * Render a Json response |
|
| 23 | + * |
|
| 24 | + * @return boolean |
|
| 25 | + * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception\InvalidVariableException |
|
| 26 | + */ |
|
| 27 | + public function render() |
|
| 28 | + { |
|
| 29 | 29 | |
| 30 | - $objects = $this->templateVariableContainer->get('objects'); |
|
| 31 | - $columns = $this->templateVariableContainer->get('columns'); |
|
| 32 | - $output = array( |
|
| 33 | - 'sEcho' => $this->getNextTransactionId(), |
|
| 34 | - 'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 35 | - 'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 36 | - 'iNumberOfRecords' => count($objects), |
|
| 37 | - 'aaData' => $this->getRowsViewHelper()->render($objects, $columns), |
|
| 38 | - ); |
|
| 30 | + $objects = $this->templateVariableContainer->get('objects'); |
|
| 31 | + $columns = $this->templateVariableContainer->get('columns'); |
|
| 32 | + $output = array( |
|
| 33 | + 'sEcho' => $this->getNextTransactionId(), |
|
| 34 | + 'iTotalRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 35 | + 'iTotalDisplayRecords' => $this->templateVariableContainer->get('numberOfObjects'), |
|
| 36 | + 'iNumberOfRecords' => count($objects), |
|
| 37 | + 'aaData' => $this->getRowsViewHelper()->render($objects, $columns), |
|
| 38 | + ); |
|
| 39 | 39 | |
| 40 | - $this->setHttpHeaders(); |
|
| 41 | - return json_encode($output); |
|
| 42 | - } |
|
| 40 | + $this->setHttpHeaders(); |
|
| 41 | + return json_encode($output); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @return int |
|
| 46 | - */ |
|
| 47 | - protected function getNextTransactionId() |
|
| 48 | - { |
|
| 49 | - $transaction = 0; |
|
| 50 | - if (GeneralUtility::_GET('sEcho')) { |
|
| 51 | - $transaction = (int)GeneralUtility::_GET('sEcho') + 1; |
|
| 52 | - } |
|
| 53 | - return $transaction; |
|
| 54 | - } |
|
| 44 | + /** |
|
| 45 | + * @return int |
|
| 46 | + */ |
|
| 47 | + protected function getNextTransactionId() |
|
| 48 | + { |
|
| 49 | + $transaction = 0; |
|
| 50 | + if (GeneralUtility::_GET('sEcho')) { |
|
| 51 | + $transaction = (int)GeneralUtility::_GET('sEcho') + 1; |
|
| 52 | + } |
|
| 53 | + return $transaction; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @return void |
|
| 58 | - * @throws \InvalidArgumentException |
|
| 59 | - */ |
|
| 60 | - protected function setHttpHeaders() |
|
| 61 | - { |
|
| 62 | - /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */ |
|
| 63 | - $response = $this->templateVariableContainer->get('response'); |
|
| 64 | - $response->setHeader('Content-Type', 'application/json'); |
|
| 65 | - $response->sendHeaders(); |
|
| 66 | - } |
|
| 56 | + /** |
|
| 57 | + * @return void |
|
| 58 | + * @throws \InvalidArgumentException |
|
| 59 | + */ |
|
| 60 | + protected function setHttpHeaders() |
|
| 61 | + { |
|
| 62 | + /** @var \TYPO3\CMS\Extbase\Mvc\Web\Response $response */ |
|
| 63 | + $response = $this->templateVariableContainer->get('response'); |
|
| 64 | + $response->setHeader('Content-Type', 'application/json'); |
|
| 65 | + $response->sendHeaders(); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * @return RowsViewHelper |
|
| 70 | - */ |
|
| 71 | - protected function getRowsViewHelper() |
|
| 72 | - { |
|
| 73 | - return $this->objectManager->get(RowsViewHelper::class); |
|
| 74 | - } |
|
| 68 | + /** |
|
| 69 | + * @return RowsViewHelper |
|
| 70 | + */ |
|
| 71 | + protected function getRowsViewHelper() |
|
| 72 | + { |
|
| 73 | + return $this->objectManager->get(RowsViewHelper::class); |
|
| 74 | + } |
|
| 75 | 75 | } |