2 namespace TYPO3\CMS\Reports\Report\Status;
37 $GLOBALS[
'LANG']->includeLLFile(
'EXT:reports/Resources/Private/Language/locallang_reports.xlf');
49 $highestSeverity = $this->getHighestSeverity($status);
51 $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
52 $registry->set(
'tx_reports',
'status.highestSeverity', $highestSeverity);
53 $content .=
'<p class="lead">' .
$GLOBALS[
'LANG']->getLL(
'status_report_explanation') .
'</p>';
54 return $content . $this->renderStatus($status);
64 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'reports'][
'tx_reports'][
'status'][
'providers'] as $key => $statusProvidersList) {
65 $this->statusProviders[$key] = array();
66 foreach ($statusProvidersList as $statusProvider) {
67 $statusProviderInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($statusProvider);
69 $this->statusProviders[$key][] = $statusProviderInstance;
83 foreach ($this->statusProviders as $statusProviderId => $statusProviderList) {
84 $status[$statusProviderId] = array();
85 foreach ($statusProviderList as $statusProvider) {
86 $statuses = $statusProvider->getStatus();
87 $status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
101 foreach ($this->statusProviders as $statusProviderId => $statusProviderList) {
102 $status[$statusProviderId] = array();
103 foreach ($statusProviderList as $statusProvider) {
105 $statuses = $statusProvider->getDetailedStatus();
106 $status[$statusProviderId] = array_merge($status[$statusProviderId], $statuses);
119 public function getHighestSeverity(array $statusCollection)
121 $highestSeverity = \TYPO3\CMS\Reports\Status::NOTICE;
122 foreach ($statusCollection as $statusProvider => $providerStatuses) {
124 foreach ($providerStatuses as $status) {
125 if ($status->getSeverity() > $highestSeverity) {
126 $highestSeverity = $status->getSeverity();
134 return $highestSeverity;
143 protected function renderStatus(array $statusCollection)
148 <td class="###CLASS### col-xs-6">###HEADER###</td>
149 <td class="###CLASS### col-xs-6">###STATUS###<br>###CONTENT###</td>
154 foreach ($statuses as $provider => $providerStatus) {
155 $providerState = $this->sortStatuses($providerStatus);
166 foreach ($providerState as $status) {
167 $severity = $status->getSeverity();
168 $messages .= strtr($template, array(
169 '###CLASS###' => $classes[$severity],
170 '###HEADER###' => $status->getTitle(),
171 '###STATUS###' => $status->getValue(),
172 '###CONTENT###' => $status->getMessage()
175 $header =
'<h2>' . $provider .
'</h2>';
176 $table =
'<table class="table table-striped table-hover">';
177 $table .=
'<tbody>' . $messages .
'</tbody>';
178 $table .=
'</table>';
180 $content .= $header . $table;
196 $primaryStatuses = array(
197 $GLOBALS[
'LANG']->getLL(
'status_typo3') => $statusCollection[
'typo3'],
198 $GLOBALS[
'LANG']->getLL(
'status_system') => $statusCollection[
'system'],
199 $GLOBALS[
'LANG']->getLL(
'status_security') => $statusCollection[
'security'],
200 $GLOBALS[
'LANG']->getLL(
'status_configuration') => $statusCollection[
'configuration']
202 unset($statusCollection[
'typo3'], $statusCollection[
'system'], $statusCollection[
'security'], $statusCollection[
'configuration']);
206 $secondaryStatuses = array();
207 foreach ($statusCollection as $statusProviderId => $collection) {
209 if (strpos($statusProviderId,
'LLL:') === 0) {
211 $label =
$GLOBALS[
'LANG']->sL($statusProviderId);
214 $label =
$GLOBALS[
'LANG']->getLL(
'status_' . $statusProviderId);
216 $providerLabel = empty($label) ? $statusProviderId : $label;
217 $secondaryStatuses[$providerLabel] = $collection;
220 ksort($secondaryStatuses);
221 $orderedStatusCollection = array_merge($primaryStatuses, $secondaryStatuses);
222 return $orderedStatusCollection;
231 protected function sortStatuses(array $statusCollection)
234 $sortTitle = array();
237 foreach ($statusCollection as $status) {
238 if ($status->getTitle() ===
'TYPO3') {
242 $statuses[] = $status;
243 $sortTitle[] = $status->getSeverity();
245 array_multisort($sortTitle, SORT_DESC, $statuses);
247 if (is_object($header)) {
248 array_unshift($statuses, $header);