Skip to content

Commit

Permalink
GH-230 Use constants for alert types
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jul 9, 2022
1 parent f511993 commit 785ab10
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
* @param arrayRef $props['user']
*/
function render($props) {
$adminAlertTypes = [
'REPORTS' => 'reports',
'DECLARATIONS' => 'declarations',
'SYSTEM_ALERTS' => 'system_alerts',
];

global $_Lang;

$hasAccess = CheckAuth(
Expand All @@ -27,7 +33,7 @@ function render($props) {
(
"SELECT " .
"COUNT(*) AS `count`, " .
"'reports' AS `type` " .
"'{$adminAlertTypes['REPORTS']}' AS `type` " .
"FROM `{{prefix}}reports` " .
"WHERE " .
"`status` = 0 "
Expand All @@ -36,7 +42,7 @@ function render($props) {
(
"SELECT " .
"COUNT(*) AS `count`, " .
"'declarations' AS `type` " .
"'{$adminAlertTypes['DECLARATIONS']}' AS `type` " .
"FROM `{{prefix}}declarations` " .
"WHERE " .
"`status` = 0 "
Expand All @@ -45,7 +51,7 @@ function render($props) {
(
"SELECT " .
"COUNT(*) AS `count`, " .
"'system_alerts' AS `type` " .
"'{$adminAlertTypes['SYSTEM_ALERTS']}' AS `type` " .
"FROM `{{prefix}}system_alerts` " .
"WHERE " .
"`status` = 0 "
Expand Down Expand Up @@ -73,9 +79,9 @@ function render($props) {
$tplBodyParams = [
'content' => sprintf(
$_Lang['AdminAlertsBox'],
$alertsCounts['reports'],
$alertsCounts['declarations'],
$alertsCounts['system_alerts']
$alertsCounts[$adminAlertTypes['REPORTS']],
$alertsCounts[$adminAlertTypes['DECLARATIONS']],
$alertsCounts[$adminAlertTypes['SYSTEM_ALERTS']]
),
];
$tplBodyParams = array_merge($_Lang, $tplBodyParams);
Expand Down

0 comments on commit 785ab10

Please sign in to comment.