2 namespace TYPO3\CMS\Linkvalidator\Report
;
5 * This file is part of the TYPO3 CMS project.
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
14 * The TYPO3 project - inspiring people to share!
17 use TYPO3\CMS\Backend\Utility\BackendUtility
;
18 use TYPO3\CMS\Core\Messaging\FlashMessage
;
19 use TYPO3\CMS\Core\Utility\GeneralUtility
;
22 * Module 'Linkvalidator' for the 'linkvalidator' extension
24 * @author Michael Miousse <michael.miousse@infoglobe.ca>
25 * @author Jochen Rieger <j.rieger@connecta.ag>
27 class LinkValidatorReport
extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule
{
30 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
37 protected $relativePath;
40 * Information about the current page record
44 protected $pageRecord = array();
47 * Information, if the module is accessible for the current user or not
51 protected $isAccessibleForCurrentUser = FALSE;
54 * Depth for the recursive traversal of pages for the link validation
58 protected $searchLevel;
61 * Link validation class
63 * @var \TYPO3\CMS\Linkvalidator\LinkAnalyzer
68 * TSconfig of the current module
72 protected $modTS = array();
75 * List of available link types to check defined in the TSconfig
79 protected $availableOptions = array();
82 * List of link types currently chosen in the statistics table
83 * Used to show broken links of these types only
87 protected $checkOpt = array();
90 * Html for the button "Check Links"
94 protected $updateListHtml;
97 * Html for the button "Refresh Display"
101 protected $refreshListHtml;
104 * Html for the statistics table with the checkboxes of the link types
105 * and the numbers of broken links for report tab
109 protected $checkOptHtml;
112 * Html for the statistics table with the checkboxes of the link types
113 * and the numbers of broken links for check links tab
117 protected $checkOptHtmlCheck;
120 * Complete content (html) to be displayed
127 * @var \TYPO3\CMS\Core\Page\PageRenderer
129 protected $pageRenderer;
132 * @var \TYPO3\CMS\Linkvalidator\Linktype\LinktypeInterface[]
134 protected $hookObjectsArr = array();
137 * @var string $checkAllHtml
139 protected $checkAllHtml = '';
142 * Main method of modfuncreport
144 * @return string Module content
146 public function main() {
147 $GLOBALS['LANG']->includeLLFile('EXT:linkvalidator/Resources/Private/Language/Module/locallang.xlf');
148 $this->searchLevel
= GeneralUtility
::_GP('search_levels');
149 if (isset($this->pObj
->id
)) {
150 $this->modTS
= BackendUtility
::getModTSconfig($this->pObj
->id
, 'mod.linkvalidator');
151 $this->modTS
= $this->modTS
['properties'];
153 $update = GeneralUtility
::_GP('updateLinkList');
155 if (!empty($update)) {
158 $set = GeneralUtility
::_GP($prefix . 'SET');
159 $this->pObj
->handleExternalFunctionValue();
160 if (isset($this->searchLevel
)) {
161 $this->pObj
->MOD_SETTINGS
['searchlevel'] = $this->searchLevel
;
163 $this->searchLevel
= $this->pObj
->MOD_SETTINGS
['searchlevel'];
165 if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
166 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
167 // Compile list of all available types. Used for checking with button "Check Links".
168 if (strpos($this->modTS
['linktypes'], $linkType) !== FALSE) {
169 $this->availableOptions
[$linkType] = 1;
171 // Compile list of types currently selected by the checkboxes
172 if ($this->pObj
->MOD_SETTINGS
[$linkType] && empty($set) ||
$set[$linkType]) {
173 $this->checkOpt
[$linkType] = 1;
174 $this->pObj
->MOD_SETTINGS
[$linkType] = 1;
176 $this->pObj
->MOD_SETTINGS
[$linkType] = 0;
177 unset($this->checkOpt
[$linkType]);
181 $GLOBALS['BE_USER']->pushModuleData('web_info', $this->pObj
->MOD_SETTINGS
);
185 $this->pageRenderer
->addInlineLanguageLabelFile(
186 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::extPath('linkvalidator', 'Resources/Private/Language/Module/locallang.xlf')
188 $this->pageRenderer
->addJsInlineCode('linkvalidator', 'function toggleActionButton(prefix) {
189 var buttonDisable = true;
190 Ext.select(\'.\' + prefix ,false).each(function(checkBox,i){
191 checkDom = checkBox.dom;
192 if (checkDom.checked){
193 buttonDisable = false;
197 if (prefix == \'check\'){
198 checkSub = document.getElementById(\'updateLinkList\');
200 checkSub = document.getElementById(\'refreshLinkList\');
202 checkSub.disabled = buttonDisable;
205 $this->pageRenderer
->addJsFile($this->doc
->backPath
. 'js/extjs/ux/Ext.ux.FitToParent.js');
206 $this->pageRenderer
->addJsFile($this->doc
->backPath
. 'sysext/backend/Resources/Public/JavaScript/iframepanel.js');
207 if ($this->modTS
['showCheckLinkTab'] == 1) {
208 $this->updateListHtml
= '<input type="submit" name="updateLinkList" id="updateLinkList" value="' . $GLOBALS['LANG']->getLL('label_update') . '"/>';
210 $this->refreshListHtml
= '<input type="submit" name="refreshLinkList" id="refreshLinkList" value="' . $GLOBALS['LANG']->getLL('label_refresh') . '"/>';
211 $this->processor
= GeneralUtility
::makeInstance(\TYPO3\CMS\Linkvalidator\LinkAnalyzer
::class);
212 $this->updateBrokenLinks();
213 $brokenLinkOverView = $this->processor
->getLinkCounts($this->pObj
->id
);
214 $this->checkOptHtml
= $this->getCheckOptions($brokenLinkOverView);
215 $this->checkOptHtmlCheck
= $this->getCheckOptions($brokenLinkOverView, 'check');
219 if ($this->pObj
->id
) {
220 $pageRecord = BackendUtility
::getRecord('pages', $this->pObj
->id
);
221 $content = '<h1>' . htmlspecialchars(BackendUtility
::getRecordTitle('pages', $pageRecord)) . '</h1>';
224 $content .= '<div id="linkvalidator-modfuncreport"></div>';
229 * Create TabPanel to split the report and the checkLink functions
233 protected function createTabs() {
235 if ($this->modTS
['showCheckLinkTab'] == 1) {
238 title: TYPO3.l10n.localize(\'CheckLink\'),
239 html: ' . json_encode($this->flush()) . ',
243 $js = 'var panel = new Ext.TabPanel( {
244 renderTo: \'linkvalidator-modfuncreport\',
245 id: \'linkvalidator-main\',
248 bodyStyle: \'padding:10px;\',
252 title: TYPO3.l10n.localize(\'Report\'),
253 html: ' . json_encode($this->flush(TRUE)) . '
259 $this->pageRenderer
->addExtOnReadyCode($js);
263 * Initializes the menu array internally
265 * @return array Module menu
267 public function modMenu() {
271 if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
272 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $value) {
273 $modMenu[$linkType] = 1;
280 * Initializes the Module
284 protected function initialize() {
285 if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
286 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $linkType => $classRef) {
287 $this->hookObjectsArr
[$linkType] = GeneralUtility
::getUserObj($classRef);
290 $this->doc
= GeneralUtility
::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate
::class);
291 $this->doc
->backPath
= $GLOBALS['BACK_PATH'];
292 $this->doc
->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::extPath('linkvalidator') . 'Resources/Private/Templates/mod_template.html');
293 $this->relativePath
= \TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::extRelPath('linkvalidator');
294 $this->pageRecord
= BackendUtility
::readPageAccess($this->pObj
->id
, $GLOBALS['BE_USER']->getPagePermsClause(1));
295 $this->pageRenderer
= $this->doc
->getPageRenderer();
296 $this->isAccessibleForCurrentUser
= FALSE;
297 if ($this->pObj
->id
&& is_array($this->pageRecord
) ||
!$this->pObj
->id
&& $this->isCurrentUserAdmin()) {
298 $this->isAccessibleForCurrentUser
= TRUE;
300 $this->loadHeaderData();
301 // Don't access in workspace
302 if ($GLOBALS['BE_USER']->workspace
!== 0) {
303 $this->isAccessibleForCurrentUser
= FALSE;
308 * Updates the table of stored broken links
312 protected function updateBrokenLinks() {
313 $searchFields = array();
314 // Get the searchFields from TypoScript
315 foreach ($this->modTS
['searchFields.'] as $table => $fieldList) {
316 $fields = GeneralUtility
::trimExplode(',', $fieldList);
317 foreach ($fields as $field) {
318 if (!$searchFields ||
!is_array($searchFields[$table]) ||
array_search($field, $searchFields[$table]) == FALSE) {
319 $searchFields[$table][] = $field;
323 $rootLineHidden = $this->processor
->getRootLineIsHidden($this->pObj
->pageinfo
);
324 if (!$rootLineHidden ||
$this->modTS
['checkhidden'] == 1) {
325 // Get children pages
326 $pageList = $this->processor
->extGetTreeList($this->pObj
->id
, $this->searchLevel
, 0, $GLOBALS['BE_USER']->getPagePermsClause(1), $this->modTS
['checkhidden']);
327 if ($this->pObj
->pageinfo
['hidden'] == 0 ||
$this->modTS
['checkhidden'] == 1) {
328 $pageList .= $this->pObj
->id
;
330 $this->processor
->init($searchFields, $pageList, $this->modTS
);
331 // Check if button press
332 $update = GeneralUtility
::_GP('updateLinkList');
333 if (!empty($update)) {
334 $this->processor
->getLinkStatistics($this->checkOpt
, $this->modTS
['checkhidden']);
340 * Renders the content of the module
344 protected function render() {
345 if ($this->isAccessibleForCurrentUser
) {
346 $this->content
= $this->renderBrokenLinksTable();
348 // If no access or if ID == zero
349 /** @var FlashMessage $message */
350 $message = GeneralUtility
::makeInstance(
352 $GLOBALS['LANG']->getLL('no.access'),
353 $GLOBALS['LANG']->getLL('no.access.title'),
356 $this->content
.= $message->render();
361 * Flushes the rendered content to the browser
364 * @return string $content
366 protected function flush($form = FALSE) {
367 $content = $this->doc
->moduleBody(
369 $this->getDocHeaderButtons(),
370 $form ?
$this->getTemplateMarkers() : $this->getTemplateMarkersCheck()
376 * Builds the selector for the level of pages to search
378 * @return string Html code of that selector
380 protected function getLevelSelector() {
381 // Build level selector
384 0 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_0'),
385 1 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_1'),
386 2 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_2'),
387 3 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_3'),
388 999 => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.depth_infi')
390 foreach ($parts as $kv => $label) {
391 $opt[] = '<option value="' . $kv . '"' . ($kv == (int)$this->searchLevel ?
' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
393 $lMenu = '<select name="search_levels">' . implode('', $opt) . '</select>';
398 * Displays the table of broken links or a note if there were no broken links
400 * @return string Content of the table or of the note
402 protected function renderBrokenLinksTable() {
403 $items = ($brokenLinksMarker = array());
404 $brokenLinkItems = '';
405 $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::getSubpart($this->doc
->moduleTemplate
, '###NOBROKENLINKS_CONTENT###');
407 if (is_array($this->checkOpt
)) {
408 $keyOpt = array_keys($this->checkOpt
);
410 $rootLineHidden = $this->processor
->getRootLineIsHidden($this->pObj
->pageinfo
);
411 if (!$rootLineHidden ||
$this->modTS
['checkhidden'] == 1) {
412 $pageList = $this->processor
->extGetTreeList(
416 $GLOBALS['BE_USER']->getPagePermsClause(1),
417 $this->modTS
['checkhidden']
419 // Always add the current page, because we are just displaying the results
420 $pageList .= $this->pObj
->id
;
421 if (($res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
423 'tx_linkvalidator_link',
424 'record_pid in (' . $pageList . ') and link_type in (\'' . implode('\',\'', $keyOpt) . '\')',
426 'record_uid ASC, uid ASC')
428 // Display table with broken links
429 if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
430 $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::getSubpart($this->doc
->moduleTemplate
, '###BROKENLINKS_CONTENT###');
431 $brokenLinksItemTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::getSubpart($this->doc
->moduleTemplate
, '###BROKENLINKS_ITEM###');
433 $brokenLinksMarker = $this->startTable();
434 // Table rows containing the broken links
435 while (($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) !== FALSE) {
436 $items[] = $this->renderTableRow($row['table_name'], $row, $brokenLinksItemTemplate);
438 $brokenLinkItems = implode(chr(10), $items);
440 $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
442 $GLOBALS['TYPO3_DB']->sql_free_result($res);
445 $brokenLinksMarker = $this->getNoBrokenLinkMessage($brokenLinksMarker);
447 $brokenLinksTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::substituteMarkerArray(
448 $brokenLinksTemplate,
449 $brokenLinksMarker, '###|###',
452 $content = \TYPO3\CMS\Core\Html\HtmlParser
::substituteSubpart($brokenLinksTemplate, '###BROKENLINKS_ITEM', $brokenLinkItems);
457 * Replace $brokenLinksMarker['NO_BROKEN_LINKS] with localized flashmessage
459 * @param array $brokenLinksMarker
460 * @return array $brokenLinksMarker['NO_BROKEN_LINKS] replaced with flashmessage
462 protected function getNoBrokenLinkMessage(array $brokenLinksMarker) {
463 $brokenLinksMarker['LIST_HEADER'] = $this->doc
->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
464 /** @var $message FlashMessage */
465 $message = GeneralUtility
::makeInstance(
467 $GLOBALS['LANG']->getLL('list.no.broken.links'),
468 $GLOBALS['LANG']->getLL('list.no.broken.links.title'),
471 $brokenLinksMarker['NO_BROKEN_LINKS'] = $message->render();
472 return $brokenLinksMarker;
476 * Displays the table header of the table with the broken links
478 * @return string Code of content
480 protected function startTable() {
482 $makerTableHead = array();
483 $makerTableHead['tablehead_path'] = $GLOBALS['LANG']->getLL('list.tableHead.path');
484 $makerTableHead['tablehead_element'] = $GLOBALS['LANG']->getLL('list.tableHead.element');
485 $makerTableHead['tablehead_headlink'] = $GLOBALS['LANG']->getLL('list.tableHead.headlink');
486 $makerTableHead['tablehead_linktarget'] = $GLOBALS['LANG']->getLL('list.tableHead.linktarget');
487 $makerTableHead['tablehead_linkmessage'] = $GLOBALS['LANG']->getLL('list.tableHead.linkmessage');
488 $makerTableHead['tablehead_lastcheck'] = $GLOBALS['LANG']->getLL('list.tableHead.lastCheck');
489 // Add CSH to the header of each column
490 foreach ($makerTableHead as $column => $label) {
491 $label = BackendUtility
::wrapInHelp('linkvalidator', $column, $label);
492 $makerTableHead[$column] = $label;
494 // Add section header
495 $makerTableHead['list_header'] = $this->doc
->sectionHeader($GLOBALS['LANG']->getLL('list.header'));
496 return $makerTableHead;
500 * Displays one line of the broken links table
502 * @param string $table Name of database table
503 * @param array $row Record row to be processed
504 * @param array $brokenLinksItemTemplate Markup of the template to be used
505 * @return string HTML of the rendered row
507 protected function renderTableRow($table, array $row, $brokenLinksItemTemplate) {
508 $markerArray = array();
510 // Restore the linktype object
511 $hookObj = $this->hookObjectsArr
[$row['link_type']];
512 $brokenUrl = $hookObj->getBrokenUrl($row);
513 // Construct link to edit the content element
514 $params = '&edit[' . $table . '][' . $row['record_uid'] . ']=edit';
515 $requestUri = GeneralUtility
::getIndpEnv('REQUEST_URI') .
516 '?id=' . $this->pObj
->id
.
517 '&search_levels=' . $this->searchLevel
;
518 $actionLink = '<a href="#" onclick="';
519 $actionLink .= BackendUtility
::editOnClick(
521 $GLOBALS['BACK_PATH'],
524 $actionLink .= '" title="' . $GLOBALS['LANG']->getLL('list.edit') . '">';
525 $actionLink .= \TYPO3\CMS\Backend\Utility\IconUtility
::getSpriteIcon('actions-document-open');
526 $actionLink .= '</a>';
527 $elementHeadline = $row['headline'];
528 if (empty($elementHeadline)) {
529 $elementHeadline = '<i>' . $GLOBALS['LANG']->getLL('list.no.headline') . '</i>';
531 // Get the language label for the field from TCA
532 if ($GLOBALS['TCA'][$table]['columns'][$row['field']]['label']) {
533 $fieldName = $GLOBALS['TCA'][$table]['columns'][$row['field']]['label'];
534 $fieldName = $GLOBALS['LANG']->sL($fieldName);
535 // Crop colon from end if present
536 if (substr($fieldName, '-1', '1') === ':') {
537 $fieldName = substr($fieldName, '0', strlen($fieldName) - 1);
540 // Fallback, if there is no label
541 $fieldName = !empty($fieldName) ?
$fieldName : $row['field'];
543 $element = \TYPO3\CMS\Backend\Utility\IconUtility
::getSpriteIconForRecord(
546 array('title' => $table . ':' . $row['record_uid'])
548 $element .= $elementHeadline;
549 $element .= ' ' . sprintf($GLOBALS['LANG']->getLL('list.field'), $fieldName);
550 $markerArray['actionlink'] = $actionLink;
551 $markerArray['path'] = BackendUtility
::getRecordPath($row['record_pid'], '', 0, 0);
552 $markerArray['element'] = $element;
553 $markerArray['headlink'] = $row['link_title'];
554 $markerArray['linktarget'] = $brokenUrl;
555 $response = unserialize($row['url_response']);
556 if ($response['valid']) {
557 $linkMessage = '<span style="color: green;">' . $GLOBALS['LANG']->getLL('list.msg.ok') . '</span>';
559 $linkMessage = '<span style="color: red;">' . $hookObj->getErrorMessage($response['errorParams']) . '</span>';
561 $markerArray['linkmessage'] = $linkMessage;
562 $lastRunDate = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['last_check']);
563 $lastRunTime = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row['last_check']);
564 $message = sprintf($GLOBALS['LANG']->getLL('list.msg.lastRun'), $lastRunDate, $lastRunTime);
565 $markerArray['lastcheck'] = $message;
566 // Return the table html code as string
567 return \TYPO3\CMS\Core\Html\HtmlParser
::substituteMarkerArray($brokenLinksItemTemplate, $markerArray, '###|###', TRUE, TRUE);
571 * Builds the checkboxes out of the hooks array
573 * @param array $brokenLinkOverView Array of broken links information
574 * @param string $prefix
575 * @return string code content
577 protected function getCheckOptions(array $brokenLinkOverView, $prefix = '') {
578 $markerArray = array();
579 $additionalAttr = '';
580 if (!empty($prefix)) {
581 $additionalAttr = ' onclick="toggleActionButton(\'' . $prefix . '\');" class="' . $prefix . '" ';
583 $additionalAttr = ' onclick="toggleActionButton(\'refresh\');" class="refresh" ';
585 $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::getSubpart($this->doc
->moduleTemplate
, '###CHECKOPTIONS_SECTION###');
586 $hookSectionTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
587 $markerArray['statistics_header'] = $this->doc
->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
588 $totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
589 $totalCountLabel = BackendUtility
::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
590 $markerArray['total_count_label'] = $totalCountLabel;
591 if (empty($brokenLinkOverView['brokenlinkCount'])) {
592 $markerArray['total_count'] = '0';
594 $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'];
596 $linktypes = GeneralUtility
::trimExplode(',', $this->modTS
['linktypes'], TRUE);
597 $hookSectionContent = '';
598 if (is_array($linktypes)) {
599 if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])
600 && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
601 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
602 if (in_array($type, $linktypes)) {
603 $hookSectionMarker = array();
604 if (empty($brokenLinkOverView[$type])) {
605 $hookSectionMarker['count'] = '0';
607 $hookSectionMarker['count'] = $brokenLinkOverView[$type];
609 $translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
610 $translation = $translation ?
$translation : $type;
611 $option = '<input type="checkbox" ' . $additionalAttr . ' id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj
->MOD_SETTINGS
[$type] ?
' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET[' . $type . ']">' . htmlspecialchars($translation) . '</label>';
612 $hookSectionMarker['option'] = $option;
613 $hookSectionContent .= \TYPO3\CMS\Core\Html\HtmlParser
::substituteMarkerArray(
614 $hookSectionTemplate,
615 $hookSectionMarker, '###|###',
623 $checkOptionsTemplate = \TYPO3\CMS\Core\Html\HtmlParser
::substituteSubpart(
624 $checkOptionsTemplate,
625 '###HOOK_SECTION###', $hookSectionContent
627 return \TYPO3\CMS\Core\Html\HtmlParser
::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
631 * Loads data in the HTML head section (e.g. JavaScript or stylesheet information)
635 protected function loadHeaderData() {
636 $this->doc
->addStyleSheet('linkvalidator', $this->relativePath
. 'Resources/Public/Css/linkvalidator.css', 'linkvalidator');
637 $this->pageRenderer
->addJsFile($this->doc
->backPath
. 'js/extjs/ux/Ext.ux.FitToParent.js');
641 * Gets the buttons that shall be rendered in the docHeader
643 * @return array Available buttons for the docHeader
645 protected function getDocHeaderButtons() {
647 'csh' => BackendUtility
::cshItem('_MOD_web_func', ''),
648 'shortcut' => $this->getShortcutButton(),
655 * Gets the button to set a new shortcut in the backend (if current user is allowed to).
657 * @return string HTML representation of the shortcut button
659 protected function getShortcutButton() {
661 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
662 $result = $this->doc
->makeShortcutIcon('', 'function', $this->MCONF
['name']);
668 * Gets the filled markers that are used in the HTML template
670 * @return array The filled marker array
672 protected function getTemplateMarkers() {
674 'FUNC_TITLE' => $GLOBALS['LANG']->getLL('report.func.title'),
675 'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('report.statistics.header'),
676 'FUNC_MENU' => $this->getLevelSelector(),
677 'CONTENT' => $this->content
,
678 'CHECKALLLINK' => $this->checkAllHtml
,
679 'CHECKOPTIONS' => $this->checkOptHtml
,
680 'ID' => '<input type="hidden" name="id" value="' . $this->pObj
->id
. '" />',
681 'REFRESH' => $this->refreshListHtml
,
688 * Gets the filled markers that are used in the HTML template
690 * @return array The filled marker array
692 protected function getTemplateMarkersCheck() {
694 'FUNC_TITLE' => $GLOBALS['LANG']->getLL('checklinks.func.title'),
695 'CHECKOPTIONS_TITLE' => $GLOBALS['LANG']->getLL('checklinks.statistics.header'),
696 'FUNC_MENU' => $this->getLevelSelector(),
698 'CHECKALLLINK' => $this->checkAllHtml
,
699 'CHECKOPTIONS' => $this->checkOptHtmlCheck
,
700 'ID' => '<input type="hidden" name="id" value="' . $this->pObj
->id
. '" />',
702 'UPDATE' => $this->updateListHtml
708 * Determines whether the current user is an admin
710 * @return bool Whether the current user is admin
712 protected function isCurrentUserAdmin() {
713 return (bool)$GLOBALS['BE_USER']->user
['admin'];