fix errors when no filter specified
This commit is contained in:
parent
5ad9219609
commit
37b7c32465
|
@ -59,34 +59,35 @@ include('_monitor_filters.php');
|
||||||
$filter_bar = ob_get_contents();
|
$filter_bar = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
$filter = array();
|
||||||
if ( isset($_REQUEST['filter']) ) {
|
if ( isset($_REQUEST['filter']) ) {
|
||||||
$filter = $_REQUEST['filter'];
|
$filter = $_REQUEST['filter'];
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) {
|
if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($displayMonitors) != 0) {
|
||||||
$filter = array(
|
$filter = array(
|
||||||
'Query' => array(
|
'Query' => array(
|
||||||
'terms' => array(
|
'terms' => array(
|
||||||
array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'),
|
array('attr' => 'StartDateTime', 'op' => '>=', 'val' => $_REQUEST['minTime'], 'obr' => '1'),
|
||||||
array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and', 'cbr' => '1'),
|
array('attr' => 'StartDateTime', 'op' => '<=', 'val' => $_REQUEST['maxTime'], 'cnj' => 'and', 'cbr' => '1'),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if ( count($selected_monitor_ids) ) {
|
if ( count($selected_monitor_ids) ) {
|
||||||
$filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => implode(',',$selected_monitor_ids), 'cnj' => 'and'));
|
$filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => implode(',',$selected_monitor_ids), 'cnj' => 'and'));
|
||||||
} else if ( ( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) ) {
|
} else if ( ( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) ) {
|
||||||
# this should be redundant
|
# this should be redundant
|
||||||
for ($i=0; $i < count($displayMonitors); $i++) {
|
for ($i=0; $i < count($displayMonitors); $i++) {
|
||||||
if ($i == '0') {
|
if ($i == '0') {
|
||||||
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'and', 'obr' => '1');
|
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'and', 'obr' => '1');
|
||||||
} else if ($i == (count($displayMonitors)-1)) {
|
} else if ($i == (count($displayMonitors)-1)) {
|
||||||
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or', 'cbr' => '1');
|
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or', 'cbr' => '1');
|
||||||
} else {
|
} else {
|
||||||
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or');
|
$filter['Query']['terms'][] = array('attr' => 'MonitorId', 'op' => '=', 'val' => $displayMonitors[$i]['Id'], 'cnj' => 'or');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} # end if REQUEST[Filter]
|
} # end if REQUEST[Filter]
|
||||||
parseFilter($filter);
|
parseFilter($filter);
|
||||||
# This is to enable the download button
|
# This is to enable the download button
|
||||||
session_start();
|
session_start();
|
||||||
|
|
Loading…
Reference in New Issue