roll back events.php

This commit is contained in:
Andrew Bauer 2020-11-02 14:33:40 -06:00
parent 4e80c04d23
commit 96a9a73320
1 changed files with 1 additions and 9 deletions

View File

@ -181,9 +181,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
if ( $where )
$where = ' WHERE '.$where;
# total has to be the # of available rows. Not sure what totalNotFiltered is actually used for yet.
$data['totalNotFiltered'] = $data['total'] = dbFetchOne('SELECT count(*) AS Total FROM Events AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'. $where, 'Total', $query['values']);
$sort = $sort == 'Monitor' ? 'M.Name' : 'E.'.$sort;
$col_str = 'E.*, M.Name AS Monitor';
$query['sql'] = 'SELECT ' .$col_str. ' FROM `' .$table. '` AS E INNER JOIN Monitors AS M ON E.MonitorId = M.Id'.$where.' ORDER BY ' .$sort. ' ' .$order. ' LIMIT ?, ?';
@ -198,10 +195,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
}
$rows = array();
$results = dbFetchAll($query['sql'], NULL, $query['values']);
if ( ! $results ) {
return $data;
}
foreach ( dbFetchAll($query['sql'], NULL, $query['values']) as $row ) {
$event = new ZM\Event($row);
if ( !$filter->test_post_sql_conditions($event) ) {
@ -229,7 +222,6 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
}
$data['rows'] = $rows;
if ( 0 ) {
# totalNotFiltered must equal total, except when either search bar has been used
$data['totalNotFiltered'] = dbFetchOne('SELECT count(*) AS Total FROM ' .$table. ' AS E'. ($filter->sql() ? ' WHERE '.$filter->sql():''), 'Total');
if ( $search != '' || count($advsearch) ) {
@ -237,7 +229,7 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
} else {
$data['total'] = $data['totalNotFiltered'];
}
}
return $data;
}
?>