/** * Generate the xclass report * * @return string HTML code */ public static function displayXclass() { $xclassList = array('BE' => $GLOBALS['TYPO3_CONF_VARS']['BE']['XCLASS'], 'FE' => $GLOBALS['TYPO3_CONF_VARS']['FE']['XCLASS']); $xclassList['autoload'] = tx_additionalreports_util::getAutoloadXlass(); $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('additional_reports') . 'Resources/Private/Templates/xclass-fluid.html'); $view->assign('xclass', $xclassList); $view->assign('typo3version', tx_additionalreports_util::intFromVer(TYPO3_version)); return $view->render(); }
/** * @test */ public function intFromVer() { $this->assertTrue(tx_additionalreports_util::intFromVer('4.5.5') == '4005005'); }
/** * Main action which does all the fun * * @param integer $currentPage * @return void */ public function indexAction($currentPage = 1) { // ugly patch to work without extbase (sry for that) $widgetIdentifier = '__widget_0'; if (tx_additionalreports_util::intFromVer(TYPO3_version) >= 6002000) { $widgetIdentifier = '@widget_0'; } if ($currentPage == 1 && !empty($_GET['tx__'][$widgetIdentifier]['currentPage'])) { $currentPage = (int) $_GET['tx__'][$widgetIdentifier]['currentPage']; } // set current page $this->currentPage = (int) $currentPage; if ($this->currentPage < 1) { $this->currentPage = 1; } elseif (!empty($this->numberOfPages) && $this->currentPage > $this->numberOfPages) { $this->currentPage = $this->numberOfPages; } // modify query $itemsPerPage = (int) $this->configuration['itemsPerPage']; $this->query['LIMIT'] = (int) ($itemsPerPage * ($this->currentPage - 1)) . ',' . $itemsPerPage; $res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($this->query); $modifiedObjects = array(); while ($tempRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { $modifiedObjects[] = $tempRow; } $GLOBALS['TYPO3_DB']->sql_free_result($res); $this->view->assign('contentArguments', array($this->widgetConfiguration['as'] => $modifiedObjects)); $this->view->assign('configuration', $this->configuration); $this->view->assign('pagination', $this->buildPagination()); }
/** * Main action which does all the fun * * @param integer $currentPage * @return void */ public function indexAction($currentPage = 1) { // ugly patch to work without extbase (sry for that) $widgetIdentifier = '__widget_0'; if (tx_additionalreports_util::intFromVer(TYPO3_version) >= 6002000) { $widgetIdentifier = '@widget_0'; } if ($currentPage == 1 && !empty($_GET['tx__'][$widgetIdentifier]['currentPage'])) { $currentPage = (int) $_GET['tx__'][$widgetIdentifier]['currentPage']; } // set current page $this->currentPage = (int) $currentPage; if ($this->currentPage < 1) { $this->currentPage = 1; } elseif ($this->currentPage > $this->numberOfPages) { $this->currentPage = $this->numberOfPages; } // modify query $itemsPerPage = (int) $this->configuration['itemsPerPage']; if (is_a($this->objects, '\\TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface')) { $query = $this->objects->getQuery(); // limit should only be used if needed and pagination only if results > itemsPerPage if ($itemsPerPage < $this->objects->count()) { $query->setLimit($itemsPerPage); } if ($this->currentPage > 1) { $query->setOffset((int) ($itemsPerPage * ($this->currentPage - 1))); } $modifiedObjects = $query->execute(); } else { $offset = 0; if ($this->currentPage > 1) { $offset = (int) ($itemsPerPage * ($this->currentPage - 1)); } $modifiedObjects = array_slice($this->objects, $offset, (int) $itemsPerPage); } $this->view->assign('contentArguments', array($this->widgetConfiguration['as'] => $modifiedObjects)); $this->view->assign('configuration', $this->configuration); $this->view->assign('pagination', $this->buildPagination()); }
/** * Build the TSFE (for the BE for example) * * @param int $pid * @return void */ public static function initTSFE($id) { if (tx_additionalreports_util::intFromVer(TYPO3_version) < 6002000) { require_once PATH_t3lib . 'class.t3lib_befunc.php'; require_once PATH_t3lib . 'stddb/tables.php'; require_once PATH_tslib . 'class.tslib_pagegen.php'; require_once PATH_tslib . 'class.tslib_fe.php'; require_once PATH_t3lib . 'class.t3lib_page.php'; require_once PATH_tslib . 'class.tslib_content.php'; require_once PATH_t3lib . 'class.t3lib_userauth.php'; require_once PATH_tslib . 'class.tslib_feuserauth.php'; require_once PATH_t3lib . 'class.t3lib_tstemplate.php'; require_once PATH_t3lib . 'class.t3lib_cs.php'; } if (!is_object($GLOBALS['TT'])) { $GLOBALS['TT'] = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_TimeTrackNull'); } if (version_compare(TYPO3_version, '4.3.0', '<')) { $tsfeClassName = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstanceClassName('tslib_fe'); $GLOBALS['TSFE'] = new $tsfeClassName($GLOBALS['TYPO3_CONF_VARS'], $id, ''); } else { $GLOBALS['TSFE'] = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tslib_fe', $GLOBALS['TYPO3_CONF_VARS'], $id, ''); } $GLOBALS['TSFE']->connectToDB(); $GLOBALS['TSFE']->initFEuser(); //$GLOBALS['TSFE']->checkAlternativeIdMethods(); $GLOBALS['TSFE']->determineId(); $GLOBALS['TSFE']->getCompressedTCarray(); $GLOBALS['TSFE']->initTemplate(); $GLOBALS['TSFE']->getConfigArray(); }