new: Add pre-pagination result count to headers

Fixes #4161
pull/4163/head
Hannah Ward 2019-02-15 13:48:48 +00:00
parent 4b71eced00
commit d4224f10c1
No known key found for this signature in database
GPG Key ID: 6F3BAD60DE190290
1 changed files with 6 additions and 2 deletions

View File

@ -1389,7 +1389,7 @@ class Event extends AppModel
return $tempConditions;
}
public function filterEventIds($user, &$params = array())
public function filterEventIds($user, &$params = array(), &$result_count = 0)
{
$conditions = $this->createEventConditions($user);
if (isset($params['wildcard'])) {
@ -1471,6 +1471,10 @@ class Event extends AppModel
'recursive' => -1,
'fields' => $fields
);
// Get the count (but not the actual data) of results for paginators
$result_count = $this->find('count', $find_params);
if (isset($params['limit'])) {
$find_params['limit'] = $params['limit'];
if (isset($params['page'])) {
@ -5612,7 +5616,7 @@ class Event extends AppModel
}
}
$filters['include_attribute_count'] = 1;
$eventid = $this->filterEventIds($user, $filters);
$eventid = $this->filterEventIds($user, $filters, $elementCounter);
$eventCount = count($eventid);
$eventids_chunked = $this->__clusterEventIds($exportTool, $eventid);
unset($eventid);