99cb5cffd1457f3fea003ec99ffd4068e49e0264
[Packages/TYPO3.CMS.git] / typo3 / sysext / reports / Classes / Report / Status / WarningMessagePostProcessor.php
1 <?php
2 namespace TYPO3\CMS\Reports\Report\Status;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2010-2013 Ingo Renner <ingo@typo3.org>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26 /**
27 * Post processes the warning messages found in about modules.
28 *
29 * @author Ingo Renner <ingo@typo3.org>
30 */
31 class WarningMessagePostProcessor {
32
33 /**
34 * Tries to get the highest severity of the system's status first, if
35 * something is found it is assumed that the status update task is set up
36 * properly or the status report has been checked manually and we take over
37 * control over the system warning messages.
38 *
39 * @param array $warningMessages An array of messages related to already found issues.
40 */
41 public function displayWarningMessages_postProcess(array &$warningMessages) {
42 // Get highest severity
43 $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
44 $highestSeverity = $registry->get('tx_reports', 'status.highestSeverity', NULL);
45 if (!is_null($highestSeverity)) {
46 if ($highestSeverity > \TYPO3\CMS\Reports\Status::OK) {
47 // Display a message that there's something wrong and that
48 // the admin should take a look at the detailed status report
49 $GLOBALS['LANG']->includeLLFile('EXT:reports/reports/locallang.xlf');
50 $reportModuleIdentifier = 'system_ReportsTxreportsm1';
51 $reportModuleParameters = array(
52 'tx_reports_system_reportstxreportsm1[extension]=tx_reports',
53 'tx_reports_system_reportstxreportsm1[report]=status',
54 'tx_reports_system_reportstxreportsm1[action]=detail',
55 'tx_reports_system_reportstxreportsm1[controller]=Report',
56 );
57 $warningMessages['tx_reports_status_notification'] = sprintf(
58 $GLOBALS['LANG']->getLL('status_problemNotification'),
59 '<a href="javascript:top.goToModule(\'' . $reportModuleIdentifier . '\', 1, \'&' . implode('&', $reportModuleParameters) . '\');">', '</a>'
60 );
61 }
62 }
63 }
64
65 }