From 3d5ff09969ad58a4585adabf26e253eecf7dd971 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sun, 11 Oct 2020 05:26:51 +0200 Subject: [PATCH] Added more placeholder options for the pagination area in site views. gh-578 --- admin/helpers/compiler/e_Interpretation.php | 127 +++++++++++++++----- 1 file changed, 98 insertions(+), 29 deletions(-) diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index cd9eea5a9..4b7702aa4 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -6883,44 +6883,113 @@ class Interpretation extends Fields if ($view['settings']->main_get->gettype == 2 && $view['settings']->main_get->pagination == 1) { - // build body - $body = array(); - // add limit box - if (strpos( + // does this view have a custom limitbox position + $has_limitbox = (strpos( $view['settings']->default, $this->bbb . 'LIMITBOX' . $this->ddd - ) !== false) + ) !== false); + // does this view have a custom pages counter position + $has_pagescounter = (strpos( + $view['settings']->default, + $this->bbb . 'PAGESCOUNTER' . $this->ddd + ) !== false); + // does this view have a custom pages links position + $has_pageslinks = (strpos( + $view['settings']->default, + $this->bbb . 'PAGESLINKS' . $this->ddd + ) !== false); + // does this view have a custom pagination start position + $has_pagination_start = (strpos( + $view['settings']->default, + $this->bbb . 'PAGINATIONSTART' . $this->ddd + ) !== false); + // does this view have a custom pagination end position + $has_pagination_end = (strpos( + $view['settings']->default, + $this->bbb . 'PAGINATIONEND' . $this->ddd + ) !== false); + + // add pagination start + $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd] + = PHP_EOL + . 'items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>'; + $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd] + .= PHP_EOL . $this->_t(1) . ''; + $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd] + .= PHP_EOL . ''; + + // add limit box + $this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd] + = 'pagination->getLimitBox(); ?>'; + + // add pages counter + $this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd] + = 'pagination->getPagesCounter(); ?>'; + + // add pages links + $this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd] + = 'pagination->getPagesLinks(); ?>'; + + // build body + $body = array(); + // Load the default values to the body $body[] = $this->setPlaceholders( $view['settings']->default, $this->placeholders ); - $body[] = PHP_EOL - . 'items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>'; - $body[] = $this->_t(1) . ''; - $body[] = ''; + // lets clear the placeholders just in case + unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]); // insure the form is added (only if no form exist) if (strpos($view['settings']->default, '