Skip to content

Commit

Permalink
IS (list views) - Replace html/pagination.php::pagination_list_footer…
Browse files Browse the repository at this point in the history
…() by JLayouts. Fixes #11246
  • Loading branch information
bertmert authored and wilsonge committed Sep 11, 2016
1 parent 97e4048 commit fc41a23
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 18 deletions.
106 changes: 106 additions & 0 deletions administrator/templates/isis/html/layouts/joomla/pagination/link.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_BASE') or die;

/** @var JPaginationObject $item */
$item = $displayData['data'];

if (!empty($displayData['pagOptions']))
{
$options = new Joomla\Registry\Registry($displayData['pagOptions']);
$liClass = $options->get('liClass', '');
$addText = $options->get('addText', '');
}
else
{
$liClass = $addText = '';
}

$display = $item->text;

switch ((string) $item->text)
{
// Check for "Start" item
case JText::_('JLIB_HTML_START') :
$icon = "icon-backward icon-first";
break;

// Check for "Prev" item
case JText::_('JPREV') :
$item->text = JText::_('JPREVIOUS');
$icon = "icon-step-backward icon-previous";
break;

// Check for "Next" item
case JText::_('JNEXT') :
$icon = "icon-step-forward icon-next";
break;

// Check for "End" item
case JText::_('JLIB_HTML_END') :
$icon = "icon-forward icon-last";
break;

default:
$icon = null;
break;
}

$item->text .= $addText ? $addText : '';

if ($icon !== null)
{
$display = '<span class="' . $icon . '"></span>';
}

if ($displayData['active'])
{
if ($item->base > 0)
{
$limit = 'limitstart.value=' . $item->base;
}
else
{
$limit = 'limitstart.value=0';
}

$cssClasses = array();

$title = '';

if (!is_numeric($item->text))
{
JHtml::_('bootstrap.tooltip');
$cssClasses[] = 'hasTooltip';
$title = ' title="' . $item->text . '" ';
}

$onClick = 'document.adminForm.' . $item->prefix . 'limitstart.value=' . ($item->base > 0 ? $item->base : '0') . '; Joomla.submitform();return false;';
}
else
{
$class = (property_exists($item, 'active') && $item->active) ? 'active' : 'disabled';
if ($class != 'active')
{
$class .= $liClass ? ($class ? ' ' : '') . $liClass : '';
}
}
?>
<?php if ($displayData['active']) : ?>
<li<?php echo $liClass ? ' class="' . $liClass . '"' : ''; ?>>
<a class="<?php echo implode(' ', $cssClasses); ?>" <?php echo $title; ?> href="#" onclick="<?php echo $onClick; ?>">
<?php echo $display; ?>
</a>
</li>
<?php else : ?>
<li class="<?php echo $class; ?>">
<span><?php echo $display; ?></span>
</li>
<?php endif;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('JPATH_BASE') or die;

use Joomla\Registry\Registry;

$list = $displayData['list'];
$pages = $list['pages'];
$pagesTotal = $list['pagesTotal'];

$options = new Registry($displayData['options']);

$showLimitBox = $options->get('showLimitBox', 0);
$showPagesLinks = $options->get('showPagesLinks', true);
$showLimitStart = $options->get('showLimitStart', true);
?>

<div class="pagination pagination-toolbar clearfix">

<?php if ($showLimitBox) : ?>
<div class="limit pull-right">
<?php echo $list['limitfield']; ?>
</div>
<?php endif; ?>

<?php if ($showPagesLinks && (!empty($pages))) : ?>
<ul class="pagination-list">
<?php
$pages['start']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', 1, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['start']);
echo JLayoutHelper::render('joomla.pagination.link', $pages['previous']); ?>
<?php foreach ($pages['pages'] as $page) :
$page['pagOptions'] = array('liClass' => 'hidden-phone');
?>
<?php echo JLayoutHelper::render('joomla.pagination.link', $page); ?>
<?php endforeach; ?>
<?php
echo JLayoutHelper::render('joomla.pagination.link', $pages['next']);
$pages['end']['pagOptions'] = array('addText' => ' (' . JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $pagesTotal, $pagesTotal) . ')');
echo JLayoutHelper::render('joomla.pagination.link', $pages['end']); ?>
</ul>
<?php endif; ?>

<?php if ($showLimitStart) : ?>
<input type="hidden" name="<?php echo $list['prefix']; ?>limitstart" value="<?php echo $list['limitstart']; ?>" />
<?php endif; ?>

</div>
18 changes: 0 additions & 18 deletions administrator/templates/isis/html/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,6 @@
* NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
*/

/**
* Renders the pagination footer
*
* @param array $list Array containing pagination footer
*
* @return string HTML markup for the full pagination footer
*
* @since 3.0
*/
function pagination_list_footer($list)
{
$html = "<div class=\"pagination pagination-toolbar\">\n";
$html .= $list['pageslinks'];
$html .= "\n<input type=\"hidden\" name=\"" . $list['prefix'] . "limitstart\" value=\"" . $list['limitstart'] . "\" />";
$html .= "\n</div>";

return $html;
}

/**
* Renders the pagination list
Expand Down
1 change: 1 addition & 0 deletions libraries/cms/pagination/pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ public function getPaginationLinks($layoutId = 'joomla.pagination.links', $optio
'limitfield' => $this->getLimitBox(),
'pagescounter' => $this->getPagesCounter(),
'pages' => $this->getPaginationPages(),
'pagesTotal' => $this->pagesTotal,
);

return JLayoutHelper::render($layoutId, array('list' => $list, 'options' => $options));
Expand Down

0 comments on commit fc41a23

Please sign in to comment.