Blame view

administrator/templates/hathor/html/pagination.php 4.37 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  Template.hathor
 *
 * @copyright   Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * This is a file to add template specific chrome to pagination rendering.
 *
 * pagination_list_footer
 *	Input variable $list is an array with offsets:
 *		$list[prefix]		: string
 *		$list[limit]		: int
 *		$list[limitstart]	: int
 *		$list[total]		: int
 *		$list[limitfield]	: string
 *		$list[pagescounter]	: string
 *		$list[pageslinks]	: string
 *
 * pagination_list_render
 *	Input variable $list is an array with offsets:
 *		$list[all]
 *			[data]		: string
 *			[active]	: boolean
 *		$list[start]
 *			[data]		: string
 *			[active]	: boolean
 *		$list[previous]
 *			[data]		: string
 *			[active]	: boolean
 *		$list[next]
 *			[data]		: string
 *			[active]	: boolean
 *		$list[end]
 *			[data]		: string
 *			[active]	: boolean
 *		$list[pages]
 *			[{PAGE}][data]		: string
 *			[{PAGE}][active]	: boolean
 *
 * pagination_item_active
 *	Input variable $item is an object with fields:
 *		$item->base	: integer
 *		$item->prefix	: string
 *		$item->link	: string
 *		$item->text	: string
 *
 * pagination_item_inactive
 *	Input variable $item is an object with fields:
 *		$item->base	: integer
 *		$item->prefix	: string
 *		$item->link	: string
 *		$item->text	: string
 *
 * This gives template designers ultimate control over how pagination is rendered.
 *
 * NOTE: If you override pagination_item_active OR pagination_item_inactive you MUST override them both
 */

function pagination_list_footer($list)
{
	/**
	 * Fix javascript jump menu
	 *
	 * Remove the onchange=Joomla.submitform from the select tag
	 * Add in a button with onclick instead
	 */
	$fixlimit = $list['limitfield'];
	$fixlimit = preg_replace('/onchange="Joomla.submitform\(\);"/', '', $fixlimit);

	$html = '<div class="containerpg"><div class="pagination">';

	$html .= '<div class="limit"><label for="limit">' . JText::_('JGLOBAL_DISPLAY_NUM') . ' </label>';
	$html .= "\n" . $fixlimit;
	$html .= "\n" . '<button id="pagination-go" type="button" onclick="Joomla.submitform()">' . JText::_('JSUBMIT') . '</button></div>';
	$html .= "\n" . $list['pageslinks'];
	$html .= "\n" . '<div class="limit">' . $list['pagescounter'] . '</div>';

	$html .= "\n" . '<input type="hidden" name="' . $list['prefix'] . 'limitstart" value="' . $list['limitstart'] . '" />';
	$html .= "\n" . '<div class="clr"></div></div></div>';

	return $html;
}

function pagination_list_render($list)
{
	$html = null;

	if ($list['start']['active'])
	{
		$html .= '<div class="button2-right"><div class="start">'. $list['start']['data']. '</div></div>';
	} else {
		$html .= '<div class="button2-right off"><div class="start">'. $list['start']['data']. '</div></div>';
	}
	if ($list['previous']['active'])
	{
		$html .= '<div class="button2-right"><div class="prev">'. $list['previous']['data']. '</div></div>';
	} else {
		$html .= '<div class="button2-right off"><div class="prev">'. $list['previous']['data']. '</div></div>';
	}

	$html .= '<div class="button2-left"><div class="page">';
	foreach ($list['pages'] as $page)
	{
		$html .= $page['data'];
	}
	$html .= '</div></div>';

	if ($list['next']['active'])
	{
		$html .= '<div class="button2-left"><div class="next">'. $list['next']['data']. '</div></div>';
	} else {
		$html .= '<div class="button2-left off"><div class="next">'. $list['next']['data']. '</div></div>';
	}
	if ($list['end']['active'])
	{
		$html .= '<div class="button2-left"><div class="end">'. $list['end']['data']. '</div></div>';
	} else {
		$html .= '<div class="button2-left off"><div class="end">'. $list['end']['data']. '</div></div>';
	}

	return $html;
}

function pagination_item_active(&$item)
{
	if ($item->base > 0)
	{
		return '<a href="#" title="'.$item->text.'" onclick="document.adminForm.' . $item->prefix . 'limitstart.value=' .$item->base.'; Joomla.submitform();return false;">'.$item->text. '</a>';
	}
	else
	{
		return '<a href="#" title="'.$item->text.'" onclick="document.adminForm.' . $item->prefix . 'limitstart.value=0; Joomla.submitform();return false;">'.$item->text. '</a>';
	}
}

function pagination_item_inactive(&$item)
{
	if ($item->active)
	{
		$class = 'class="active"';
	}
	else
	{
		$class = '';
	}
	return '<span ' . $class . '>' . $item->text . '</span>';
}