mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
fixed error cfv status
Former-commit-id: cccd14ea5d2e202124233372e3db47564b2d8475
This commit is contained in:
parent
e54112641d
commit
94932d23ac
@ -159,22 +159,22 @@ if (check_login()) {
|
|||||||
switch ($value) {
|
switch ($value) {
|
||||||
default:
|
default:
|
||||||
case AGENT_STATUS_NORMAL:
|
case AGENT_STATUS_NORMAL:
|
||||||
$status_module_search .= ' temp.critical_count = 0 AND temp.warning_count = 0 AND temp.unknown_count = 0 AND temp.notinit_count <> temp.total_count ) ';
|
$status_module_search .= ' temp.normal_count > 0) ';
|
||||||
break;
|
break;
|
||||||
case AGENT_STATUS_CRITICAL:
|
case AGENT_STATUS_CRITICAL:
|
||||||
$status_module_search .= ' temp.critical_count > 0) ';
|
$status_module_search .= ' temp.critical_count > 0) ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGENT_STATUS_WARNING:
|
case AGENT_STATUS_WARNING:
|
||||||
$status_module_search .= ' temp.critical_count = 0 AND temp.warning_count > 0) ';
|
$status_module_search .= ' temp.warning_count > 0) ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGENT_STATUS_UNKNOWN:
|
case AGENT_STATUS_UNKNOWN:
|
||||||
$status_module_search .= ' temp.critical_count = 0 AND temp.warning_count = 0 AND temp.unknown_count > 0) ';
|
$status_module_search .= ' temp.unknown_count > 0) ';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGENT_STATUS_NOT_INIT:
|
case AGENT_STATUS_NOT_INIT:
|
||||||
$status_module_search .= ' temp.total_count = temp.notinit_count) ';
|
$status_module_search .= ' temp.notinit_count > 0) ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ if (check_login()) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not normal.
|
// Not normal.
|
||||||
$status_module_search = ' AND NOT ( temp.critical_count = 0 AND temp.warning_count = 0 AND temp.unknown_count = 0 AND temp.notinit_count <> temp.total_count)';
|
$status_module_search = ' AND ( temp.critical_count > 0 OR temp.warning_count > 0 OR temp.unknown_count > 0 AND temp.notinit_count > 0 )';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,3 +658,38 @@ function get_group_filter_custom_field_view($id)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function for print counters agents or modules.
|
||||||
|
*
|
||||||
|
* @param array $status_array Array need value, image, title, color, counter.
|
||||||
|
* @param string $id_form Id form default value ''.
|
||||||
|
* @param string $id_input Id input default value ''.
|
||||||
|
*
|
||||||
|
* @return array Return html print div container counters.
|
||||||
|
*/
|
||||||
|
function print_counters_cfv(
|
||||||
|
array $status_array,
|
||||||
|
string $id_form='',
|
||||||
|
string $id_input=''
|
||||||
|
) {
|
||||||
|
$html_result = '<form class = "cfv_status_agent" id="'.$id_form.'">';
|
||||||
|
foreach ($status_array as $key => $value) {
|
||||||
|
$checked = ($value['checked'] === 1) ? 'checked=true' : '';
|
||||||
|
$disabled = ($value['counter'] === 0) ? 'disabled=true' : '';
|
||||||
|
|
||||||
|
$html_result .= '<input id="lists_'.$id_input.'['.$key.']" '.$checked.' '.$disabled.' type="checkbox" name="lists_'.$id_input.'['.$key.']" />';
|
||||||
|
$html_result .= '<label for="lists_'.$id_input.'['.$key.']" style="background-color:'.$value['color'].';">';
|
||||||
|
$html_result .= html_print_image(
|
||||||
|
$value['image'],
|
||||||
|
true,
|
||||||
|
['title' => $value['title']]
|
||||||
|
);
|
||||||
|
$html_result .= $value['counter'];
|
||||||
|
$html_result .= '</label>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$html_result .= '</form>';
|
||||||
|
return $html_result;
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user