forked from joomla/Component-Builder
Added more placeholder options for the pagination area in site views. gh-578
This commit is contained in:
parent
8190e72902
commit
3d5ff09969
@ -6883,44 +6883,113 @@ class Interpretation extends Fields
|
|||||||
if ($view['settings']->main_get->gettype == 2
|
if ($view['settings']->main_get->gettype == 2
|
||||||
&& $view['settings']->main_get->pagination == 1)
|
&& $view['settings']->main_get->pagination == 1)
|
||||||
{
|
{
|
||||||
// build body
|
// does this view have a custom limitbox position
|
||||||
$body = array();
|
$has_limitbox = (strpos(
|
||||||
// add limit box
|
|
||||||
if (strpos(
|
|
||||||
$view['settings']->default,
|
$view['settings']->default,
|
||||||
$this->bbb . 'LIMITBOX' . $this->ddd
|
$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
|
||||||
|
. '<?php if (isset($this->items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>';
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]
|
||||||
|
.= PHP_EOL . $this->_t(1) . '<div class="pagination">';
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]
|
||||||
|
.= PHP_EOL . $this->_t(2)
|
||||||
|
. '<?php if ($this->params->def(\'show_pagination_results\', 1)) : ?>';
|
||||||
|
|
||||||
|
// add pagination end
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]
|
||||||
|
= $this->_t(2) . '<?php endif; ?>';
|
||||||
|
// only add if no custom page link is found
|
||||||
|
if (!$has_pageslinks)
|
||||||
{
|
{
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONEND'
|
||||||
|
. $this->ddd]
|
||||||
|
.= PHP_EOL . $this->_t(2)
|
||||||
|
. '<?php echo $this->pagination->getPagesLinks(); ?>';
|
||||||
|
}
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]
|
||||||
|
.= PHP_EOL . $this->_t(1) . '</div>';
|
||||||
|
$this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]
|
||||||
|
.= PHP_EOL . '<?php endif; ?>';
|
||||||
|
|
||||||
|
// add limit box
|
||||||
$this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]
|
$this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]
|
||||||
= '<?php echo $this->pagination->getLimitBox(); ?>';
|
= '<?php echo $this->pagination->getLimitBox(); ?>';
|
||||||
}
|
|
||||||
|
// add pages counter
|
||||||
|
$this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]
|
||||||
|
= '<?php echo $this->pagination->getPagesCounter(); ?>';
|
||||||
|
|
||||||
|
// add pages links
|
||||||
|
$this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd]
|
||||||
|
= '<?php echo $this->pagination->getPagesLinks(); ?>';
|
||||||
|
|
||||||
|
// build body
|
||||||
|
$body = array();
|
||||||
|
// Load the default values to the body
|
||||||
$body[] = $this->setPlaceholders(
|
$body[] = $this->setPlaceholders(
|
||||||
$view['settings']->default, $this->placeholders
|
$view['settings']->default, $this->placeholders
|
||||||
);
|
);
|
||||||
$body[] = PHP_EOL
|
// only load these if at-least one is not set via a custom placeholder
|
||||||
. '<?php if (isset($this->items) && isset($this->pagination) && isset($this->pagination->pagesTotal) && $this->pagination->pagesTotal > 1): ?>';
|
if (!$has_limitbox || !$has_pagescounter || !$has_pageslinks ||
|
||||||
$body[] = $this->_t(1) . '<div class="pagination">';
|
!$has_pagination_start || !$has_pagination_end)
|
||||||
$body[] = $this->_t(2)
|
{
|
||||||
. '<?php if ($this->params->def(\'show_pagination_results\', 1)) : ?>';
|
// add pagination start
|
||||||
|
if (!$has_pagination_start)
|
||||||
|
{
|
||||||
|
$body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd];
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos(
|
if (!$has_limitbox && !$has_pagescounter)
|
||||||
$view['settings']->default,
|
|
||||||
$this->bbb . 'LIMITBOX' . $this->ddd
|
|
||||||
) === false)
|
|
||||||
{
|
{
|
||||||
$body[] = $this->_t(3)
|
$body[] = $this->_t(3)
|
||||||
. '<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> <?php echo $this->pagination->getLimitBox(); ?></p>';
|
. '<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> <?php echo $this->pagination->getLimitBox(); ?></p>';
|
||||||
}
|
}
|
||||||
else
|
elseif (!$has_limitbox)
|
||||||
|
{
|
||||||
|
$body[] = $this->_t(3)
|
||||||
|
. '<p class="counter pull-right"> <?php echo $this->pagination->getLimitBox(); ?></p>';
|
||||||
|
}
|
||||||
|
elseif (!$has_pagescounter)
|
||||||
{
|
{
|
||||||
$body[] = $this->_t(3)
|
$body[] = $this->_t(3)
|
||||||
. '<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>';
|
. '<p class="counter pull-right"> <?php echo $this->pagination->getPagesCounter(); ?> </p>';
|
||||||
}
|
}
|
||||||
$body[] = $this->_t(2) . '<?php endif; ?>';
|
// add pagination end
|
||||||
$body[] = $this->_t(2)
|
if (!$has_pagination_end)
|
||||||
. '<?php echo $this->pagination->getPagesLinks(); ?>';
|
{
|
||||||
$body[] = $this->_t(1) . '</div>';
|
$body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd];
|
||||||
$body[] = '<?php endif; ?>';
|
}
|
||||||
|
}
|
||||||
|
// 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)
|
// insure the form is added (only if no form exist)
|
||||||
if (strpos($view['settings']->default, '<form') === false)
|
if (strpos($view['settings']->default, '<form') === false)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user