/** * Displays the table of broken links or a note if there were no broken links * * @return string Content of the table or of the note */ protected function renderBrokenLinksTable() { $brokenLinkItems = ''; $brokenLinksTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###NOBROKENLINKS_CONTENT###'); $keyOpt = array(); if (is_array($this->checkOpt)) { $keyOpt = array_keys($this->checkOpt); } // Table header $brokenLinksMarker = $this->startTable(); $rootLineHidden = $this->linkAnalyzer->getRootLineIsHidden($this->pObj->pageinfo); if (!$rootLineHidden || (bool) $this->modTS['checkhidden']) { $pageList = $this->linkAnalyzer->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $this->getBackendUser()->getPagePermsClause(1), $this->modTS['checkhidden']); // Always add the current page, because we are just displaying the results $pageList .= $this->pObj->id; $records = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'tx_linkvalidator_link', 'record_pid IN (' . $pageList . ') AND link_type IN (\'' . implode('\',\'', $keyOpt) . '\')', '', 'record_uid ASC, uid ASC'); if (!empty($records)) { // Display table with broken links $brokenLinksTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_CONTENT###'); $brokenLinksItemTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_ITEM###'); // Table rows containing the broken links $items = array(); foreach ($records as $record) { $items[] = $this->renderTableRow($record['table_name'], $record, $brokenLinksItemTemplate); } $brokenLinkItems = implode(LF, $items); } else { $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker); } } else { $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker); } $brokenLinksTemplate = HtmlParser::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE); return HtmlParser::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems); }
/** * Displays the table of broken links or a note if there were no broken links * * @return string Content of the table or of the note */ protected function renderBrokenLinksTable() { $items = $brokenLinksMarker = array(); $brokenLinkItems = ''; $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###NOBROKENLINKS_CONTENT###'); $keyOpt = array(); if (is_array($this->checkOpt)) { $keyOpt = array_keys($this->checkOpt); } $rootLineHidden = $this->processor->getRootLineIsHidden($this->pObj->pageinfo); if (!$rootLineHidden || $this->modTS['checkhidden'] == 1) { $pageList = $this->processor->extGetTreeList($this->pObj->id, $this->searchLevel, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS['checkhidden']); // Always add the current page, because we are just displaying the results $pageList .= $this->pObj->id; if ($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_linkvalidator_link', 'record_pid in (' . $pageList . ') and link_type in (\'' . implode('\',\'', $keyOpt) . '\')', '', 'record_uid ASC, uid ASC')) { // Display table with broken links if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) { $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_CONTENT###'); $brokenLinksItemTemplate = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($this->doc->moduleTemplate, '###BROKENLINKS_ITEM###'); // Table header $brokenLinksMarker = $this->startTable(); // Table rows containing the broken links while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) { $items[] = $this->renderTableRow($row['table_name'], $row, $brokenLinksItemTemplate); } $brokenLinkItems = implode(chr(10), $items); } else { $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker); } $GLOBALS['TYPO3_DB']->sql_free_result($res); } } else { $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker); } $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($brokenLinksTemplate, $brokenLinksMarker, '###|###', TRUE); $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems); return $content; }