views_php_plugin_pager.inc in Views PHP 7
File
plugins/views/views_php_plugin_pager.inc
View source
<?php
class views_php_plugin_pager extends views_php_plugin_wrapper {
public function pre_execute($query) {
$this->wrapped
->pre_execute($query);
foreach (array(
'field',
'filter',
'sort',
) as $type) {
foreach ($this->wrapped->view->{$type} as $id => $handler) {
if (is_callable(array(
$handler,
'php_pre_execute',
))) {
$handler
->php_pre_execute();
}
}
}
$this->wrapped->view->query
->set_limit(0);
$this->wrapped->view->query
->set_offset(0);
}
public function post_execute(&$result) {
foreach (array(
'field',
'filter',
'sort',
) as $type) {
foreach ($this->wrapped->view->{$type} as $id => $handler) {
if (is_callable(array(
$handler,
'php_post_execute',
))) {
$handler
->php_post_execute();
}
}
}
$this->wrapped->total_items = count($this->wrapped->view->result);
$this->wrapped
->update_page_info();
$item_per_page = $this->wrapped
->get_items_per_page();
if ($item_per_page > 0) {
$offset = $this->wrapped
->get_current_page() * $item_per_page + $this->wrapped
->get_offset();
$this->wrapped->view->result = array_slice($this->wrapped->view->result, $offset, $item_per_page);
}
$this->wrapped
->post_execute($result);
}
public function execute_count_query(&$count_query) {
$this->wrapped
->execute_count_query($count_query);
}
}