‪TYPO3CMS  10.4
WarningMessagePostProcessor.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use ‪TYPO3\CMS\Reports\Status as ReportStatus;
23 
28 {
37  public function ‪displayWarningMessages_postProcess(array &$warningMessages)
38  {
39  if (!$this->‪getBackendUser()->isAdmin()) {
40  return;
41  }
42  // Get highest severity
44  $registry = GeneralUtility::makeInstance(Registry::class);
45  $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', null);
46  if ($highestSeverity !== null) {
47  if ($highestSeverity > ReportStatus::OK) {
48  // Display a message that there's something wrong and that
49  // the admin should take a look at the detailed status report
50  $this->‪getLanguageService()->‪includeLLFile('EXT:reports/Resources/Private/Language/locallang_reports.xlf');
51  $reportModuleIdentifier = 'system_ReportsTxreportsm1';
52  $reportModuleParameters = [
53  'tx_reports_system_reportstxreportsm1[extension]=tx_reports',
54  'tx_reports_system_reportstxreportsm1[report]=status',
55  'tx_reports_system_reportstxreportsm1[action]=detail',
56  'tx_reports_system_reportstxreportsm1[controller]=Report',
57  ];
58  $warningMessages['tx_reports_status_notification'] = sprintf(
59  $this->‪getLanguageService()->getLL('status_problemNotification'),
60  '<a href="javascript:top.goToModule(' . GeneralUtility::quoteJSvalue($reportModuleIdentifier) . ', 1, ' . GeneralUtility::quoteJSvalue('&' . implode('&', $reportModuleParameters)) . ');">',
61  '</a>'
62  );
63  }
64  }
65  }
66 
70  protected function ‪getLanguageService()
71  {
72  return ‪$GLOBALS['LANG'];
73  }
74 
78  protected function ‪getBackendUser()
79  {
80  return ‪$GLOBALS['BE_USER'];
81  }
82 }
‪TYPO3\CMS\Core\Localization\LanguageService\includeLLFile
‪array includeLLFile($fileRef, $setGlobal=null, $mergeLocalOntoDefault=null)
Definition: LanguageService.php:297
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getBackendUser
‪BackendUserAuthentication getBackendUser()
Definition: WarningMessagePostProcessor.php:78
‪TYPO3\CMS\Core\Registry
Definition: Registry.php:33
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor
Definition: WarningMessagePostProcessor.php:28
‪TYPO3\CMS\Reports\Status
Definition: Status.php:24
‪TYPO3\CMS\Core\Authentication\BackendUserAuthentication
Definition: BackendUserAuthentication.php:62
‪TYPO3\CMS\Reports\Report\Status\WarningMessagePostProcessor\getLanguageService
‪LanguageService getLanguageService()
Definition: WarningMessagePostProcessor.php:70
‪$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:37
‪TYPO3\CMS\Reports\Report\Status
Definition: ConfigurationStatus.php:16
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46