/** * Get the starting index of the paged listData * */ protected function getPageStartingIndex() { $listIdentifier = $this->rendererConfiguration->getListIdentifier(); $dataBackend = Tx_PtExtlist_Domain_DataBackend_DataBackendFactory::getInstanceByListIdentifier($listIdentifier); $pager = $dataBackend->getPagerCollection(); $startIndex = $pager->getItemsPerPage() * ($pager->getCurrentPage() - 1); return $startIndex; }
/** * Initialize and return a DataBackend with the given listIndentifier * * @param string $listIdentifier * @return Tx_PtExtlist_Domain_DataBackend_AbstractDataBackend */ public static function getDataBackend($listIdentifier) { $extListBackend = Tx_PtExtlist_Domain_DataBackend_DataBackendFactory::getInstanceByListIdentifier($listIdentifier, false); if ($extListBackend == null) { $extListTs = self::getExtListTyposcriptSettings($listIdentifier); self::loadLifeCycleManager(); // TODO Remove this, once we have DI $configurationBuilderFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('Tx_PtExtlist_Domain_Configuration_ConfigurationBuilderFactory'); /* @var $configurationBuilderFactory Tx_PtExtlist_Domain_Configuration_ConfigurationBuilderFactory */ $configurationBuilderFactory->setSettings($extListTs); $configurationBuilder = $configurationBuilderFactory->getInstance($listIdentifier); $extListBackend = Tx_PtExtlist_Domain_DataBackend_DataBackendFactory::createDataBackend($configurationBuilder); } return $extListBackend; }
/** * @throws Exception * @return array of options */ protected function getDataFromSqlServer() { $query = $this->dbObj->SELECTquery($this->selectPart, $this->fromPart, $this->wherePart, $this->groupByPart, $this->orderByPart, $this->limitPart); // this method only combines the parts $dataSource = Tx_PtExtlist_Domain_DataBackend_DataBackendFactory::getInstanceByListIdentifier($this->filterConfig->getListIdentifier())->getDataSource(); if (!method_exists($dataSource, 'executeQuery')) { throw new Exception('The defined dataSource has no method executeQuery and is therefore not usable with this dataProvider!', 1315216209); } $data = $dataSource->executeQuery($query)->fetchAll(); if (TYPO3_DLOG) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('MYSQL QUERY : ' . $this->filterConfig->getListIdentifier() . ' -> Filter::ExplicitSQLQuery', 'pt_extlist', 1, array('executionTime' => $dataSource->getLastQueryExecutionTime(), 'query' => $query)); } return $data; }