[UPDATE] switch instead of if

This commit is contained in:
iAmShorty 2014-05-05 14:35:05 +02:00
parent 2c24099e93
commit 7358b420f1
2 changed files with 16 additions and 11 deletions

View File

@ -24,7 +24,7 @@ $aSettings['website'][] = array(
'display' => 'MOTD Style', 'type' => 'select',
'options' => array( 0 => 'Success', 1 => 'Information', 2 => 'Warning', 3 => 'Danger' ),
'default' => 0,
'name' => 'motd_style', 'value' => $setting->getValue('motd_style'),
'name' => 'system_motd_style', 'value' => $setting->getValue('system_motd_style'),
'tooltip' => 'Set the Style what MOTD looks like.'
);
$aSettings['website'][] = array(

View File

@ -188,16 +188,21 @@ if (@$_SESSION['USERDATA']['id']) {
if ($setting->getValue('maintenance'))
$_SESSION['POPUP'][] = array('CONTENT' => 'This pool is currently in maintenance mode.', 'TYPE' => 'alert alert-warning');
if ($motd = $setting->getValue('system_motd'))
if ($setting->getValue('motd_style') == 0) {
$motd_style = "alert-success";
} else if ($setting->getValue('motd_style') == 1) {
$motd_style = "alert-info";
} else if ($setting->getValue('motd_style') == 2) {
$motd_style = "alert-warning";
} else if ($setting->getValue('motd_style') == 3) {
$motd_style = "alert-danger";
} else {
$motd_style = "alert-info";
switch ($setting->getValue('system_motd_style')) {
case 0:
$motd_style = "alert-success";
break;
case 1:
$motd_style = "alert-info";
break;
case 2:
$motd_style = "alert-warning";
break;
case 3:
$motd_style = "alert-danger";
break;
default:
$motd_style = "alert-info";
}
$_SESSION['POPUP'][] = array('CONTENT' => $motd, 'DISMISS' => 'yes', 'ID' => 'motd', 'TYPE' => 'alert ' . $motd_style . '');