‪TYPO3CMS  9.5
WarningMessagePostProcessor.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
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.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
20 use ‪TYPO3\CMS\Reports\Status as ReportStatus;
21 
26 {
35  public function ‪displayWarningMessages_postProcess(array &$warningMessages)
36  {
37  if (!$this->‪getBackendUser()->isAdmin()) {
38  return;
39  }
40  // Get highest severity
42  $registry = GeneralUtility::makeInstance(Registry::class);
43  $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', null);
44  if ($highestSeverity !== null) {
45  if ($highestSeverity > ReportStatus::OK) {
46  // Display a message that there's something wrong and that
47  // the admin should take a look at the detailed status report
48  $this->‪getLanguageService()->‪includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');
49  $reportModuleIdentifier = 'system_ReportsTxreportsm1';
50  $reportModuleParameters = [
51  'tx_reports_system_reportstxreportsm1[extension]=tx_reports',
52  'tx_reports_system_reportstxreportsm1[report]=status',
53  'tx_reports_system_reportstxreportsm1[action]=detail',
54  'tx_reports_system_reportstxreportsm1[controller]=Report',
55  ];
56  $warningMessages['tx_reports_status_notification'] = sprintf(
57  $this->‪getLanguageService()->getLL('status_problemNotification'),
58  '<a href="javascript:top.goToModule(' . GeneralUtility::quoteJSvalue($reportModuleIdentifier) . ', 1, ' . GeneralUtility::quoteJSvalue('&' . implode('&', $reportModuleParameters)) . ');">',
59  '</a>'
60  );
61  }
62  }
63  }
64 
68  protected function ‪getLanguageService()
69  {
70  return ‪$GLOBALS['LANG'];
71  }
72 
76  protected function ‪getBackendUser()
77  {
78  return ‪$GLOBALS['BE_USER'];
79  }
80 }
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪mixed includeLLFile($fileRef, $setGlobal=true, $mergeLocalOntoDefault=false)
Definition: LanguageService.php:260
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: WarningMessagePostProcessor.php:76
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:32
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor
Definition: WarningMessagePostProcessor.php:26
‪TYPO3\CMS\Reports\Status
Definition: Status.php:22
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:45
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getLanguageService
‪LanguageService getLanguageService()
Definition: WarningMessagePostProcessor.php:68
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\displayWarningMessages_postProcess
‪displayWarningMessages_postProcess(array &$warningMessages)
Definition: WarningMessagePostProcessor.php:35
‪TYPO3\CMS\Reports\Report\Status
Definition: ConfigurationStatus.php:2
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:29
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45