Exemplo n.º 1
0
 /**
  * @test
  */
 public function getCountPagesUids()
 {
     $this->assertTrue(tx_additionalreports_util::getCountPagesUids('1,47') > 0);
 }
 /**
  * Generate the website conf report
  *
  * @return string HTML code
  */
 public static function displayWebsitesConf()
 {
     $items = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, title', 'pages', 'is_siteroot = 1 AND deleted = 0 AND hidden = 0 AND pid != -1', '', '', '', 'uid');
     $websiteconf = array();
     if (!empty($items)) {
         foreach ($items as $itemKey => $itemValue) {
             $websiteconfItem = array();
             $domainRecords = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, pid, domainName', 'sys_domain', 'pid IN(' . $itemValue['uid'] . ') AND hidden=0', '', 'sorting');
             $websiteconfItem['pid'] = $itemValue['uid'];
             $websiteconfItem['pagetitle'] = tx_additionalreports_util::getIconPage() . $itemValue['title'];
             $websiteconfItem['domains'] = '';
             $websiteconfItem['template'] = '';
             foreach ($domainRecords as $domain) {
                 $websiteconfItem['domains'] .= tx_additionalreports_util::getIconDomain() . $domain['domainName'] . '<br/>';
             }
             $templates = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,title,root', 'sys_template', 'pid IN(' . $itemValue['uid'] . ') AND deleted=0 AND hidden=0', '', 'sorting');
             foreach ($templates as $templateObj) {
                 $websiteconfItem['template'] .= '<img src="' . TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR');
                 $websiteconfItem['template'] .= 'sysext/t3skin/icons/gfx/i/template.gif"/> ' . $templateObj['title'] . ' ';
                 $websiteconfItem['template'] .= '[uid=' . $templateObj['uid'] . ',root=' . $templateObj['root'] . ']<br/>';
             }
             // baseurl
             $tmpl = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
             $tmpl->tt_track = 0;
             $tmpl->init();
             $tmpl->runThroughTemplates(tx_additionalreports_util::getRootLine($itemValue['uid']), 0);
             $tmpl->generateConfig();
             $websiteconfItem['baseurl'] = $tmpl->setup['config.']['baseURL'];
             // count pages
             $list = tx_additionalreports_util::getTreeList($itemValue['uid'], 99, 0, '1=1');
             $listArray = explode(',', $list);
             $websiteconfItem['pages'] = count($listArray) - 1;
             $websiteconfItem['pageshidden'] = tx_additionalreports_util::getCountPagesUids($list, 'hidden=1');
             $websiteconfItem['pagesnosearch'] = tx_additionalreports_util::getCountPagesUids($list, 'no_search=1');
             $websiteconf[] = $websiteconfItem;
         }
     }
     $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/websiteconf-fluid.html');
     $view->assign('items', $websiteconf);
     return $view->render();
 }