/** * Main method of modfuncreport * * @return string Module content */ public function main() { $this->getLanguageService()->includeLLFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf'); $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); $this->searchLevel = GeneralUtility::_GP('search_levels'); if (isset($this->pObj->id)) { $this->modTS = BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator'); $this->modTS = $this->modTS['properties']; } $update = GeneralUtility::_GP('updateLinkList'); $prefix = ''; if (!empty($update)) { $prefix = 'check'; } $set = GeneralUtility::_GP($prefix . 'SET'); $this->pObj->handleExternalFunctionValue(); if (isset($this->searchLevel)) { $this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel; } else { $this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel']; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) { // Compile list of all available types. Used for checking with button "Check Links". if (strpos($this->modTS['linktypes'], $linkType) !== false) { $this->availableOptions[$linkType] = 1; } // Compile list of types currently selected by the checkboxes if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) { $this->checkOpt[$linkType] = 1; $this->pObj->MOD_SETTINGS[$linkType] = 1; } else { $this->pObj->MOD_SETTINGS[$linkType] = 0; unset($this->checkOpt[$linkType]); } } } $this->getBackendUser()->pushModuleData('web_info', $this->pObj->MOD_SETTINGS); $this->initialize(); // Localization $this->getPageRenderer()->addInlineLanguageLabelFile(ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')); if ($this->modTS['showCheckLinkTab'] == 1) { $this->updateListHtml = '<input class="btn btn-default" type="submit" name="updateLinkList" id="updateLinkList" value="' . $this->getLanguageService()->getLL('label_update') . '"/>'; } $this->refreshListHtml = '<input class="btn btn-default" type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $this->getLanguageService()->getLL('label_refresh') . '"/>'; $this->linkAnalyzer = GeneralUtility::makeInstance(LinkAnalyzer::class); $this->updateBrokenLinks(); $brokenLinkOverView = $this->linkAnalyzer->getLinkCounts($this->pObj->id); $this->checkOptionsHtml = $this->getCheckOptions($brokenLinkOverView); $this->checkOptionsHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check'); $this->render(); $pageTile = ''; if ($this->pObj->id) { $pageRecord = BackendUtility::getRecord('pages', $this->pObj->id); $pageTile = '<h1>' . htmlspecialchars(BackendUtility::getRecordTitle('pages', $pageRecord)) . '</h1>'; } return '<div id="linkvalidator-modfuncreport">' . $pageTile . $this->createTabs() . '</div>'; }
/** * Main method of modfuncreport * * @return string Module content */ public function main() { $GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf'); $this->searchLevel = GeneralUtility::_GP('search_levels'); if (isset($this->pObj->id)) { $this->modTS = BackendUtility::getModTSconfig($this->pObj->id, 'mod.linkvalidator'); $this->modTS = $this->modTS['properties']; } $update = GeneralUtility::_GP('updateLinkList'); $prefix = ''; if (!empty($update)) { $prefix = 'check'; } $set = GeneralUtility::_GP($prefix . 'SET'); $this->pObj->handleExternalFunctionValue(); if (isset($this->searchLevel)) { $this->pObj->MOD_SETTINGS['searchlevel'] = $this->searchLevel; } else { $this->searchLevel = $this->pObj->MOD_SETTINGS['searchlevel']; } if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) { // Compile list of all available types. Used for checking with button "Check Links". if (strpos($this->modTS['linktypes'], $linkType) !== FALSE) { $this->availableOptions[$linkType] = 1; } // Compile list of types currently selected by the checkboxes if ($this->pObj->MOD_SETTINGS[$linkType] && empty($set) || $set[$linkType]) { $this->checkOpt[$linkType] = 1; $this->pObj->MOD_SETTINGS[$linkType] = 1; } else { $this->pObj->MOD_SETTINGS[$linkType] = 0; unset($this->checkOpt[$linkType]); } } } $GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj->MOD_SETTINGS); $this->initialize(); // Localization $this->pageRenderer->addInlineLanguageLabelFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')); $this->pageRenderer->addJsInlineCode('linkvalidator', 'function toggleActionButton(prefix) { var buttonDisable = true; Ext.select(\'.\' + prefix ,false).each(function(checkBox,i){ checkDom = checkBox.dom; if (checkDom.checked){ buttonDisable = false; } }); if (prefix == \'check\'){ checkSub = document.getElementById(\'updateLinkList\'); } else { checkSub = document.getElementById(\'refreshLinkList\'); } checkSub.disabled = buttonDisable; }'); // Add JS $this->pageRenderer->addJsFile($this->doc->backPath . 'js/extjs/ux/Ext.ux.FitToParent.js'); $this->pageRenderer->addJsFile($this->doc->backPath . 'sysext/backend/Resources/Public/JavaScript/flashmessages.js'); $this->pageRenderer->addJsFile($this->doc->backPath . 'sysext/backend/Resources/Public/JavaScript/iframepanel.js'); if ($this->modTS['showCheckLinkTab'] == 1) { $this->updateListHtml = '<input type="submit" name="updateLinkList" id="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update') . '"/>'; } $this->refreshListHtml = '<input type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $GLOBALS['LANG']->getLL('label_refresh') . '"/>'; $this->processor = GeneralUtility::makeInstance('TYPO3\\CMS\\Linkvalidator\\LinkAnalyzer'); $this->updateBrokenLinks(); $brokenLinkOverView = $this->processor->getLinkCounts($this->pObj->id); $this->checkOptHtml = $this->getCheckOptions($brokenLinkOverView); $this->checkOptHtmlCheck = $this->getCheckOptions($brokenLinkOverView, 'check'); $this->createTabs(); return '<div id="linkvalidator-modfuncreport"></div>'; }