<?php
/**
* @package Joomla.Platform
* @subpackage HTML
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Pagination Class. Provides a common interface for content pagination for the
* Joomla! Platform.
*
* @package Joomla.Platform
* @subpackage HTML
* @since 11.1
*/
/**
* Method to create an active pagination link to the item
*
* @param JPaginationObject &$item The object with which to make an active link.
*
* @return string HTML link
*
* @since 11.1
*/
function pagination_item_active(&$item)
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
if ($item->base > 0)
{
return "<a title=\"" . $item->text . "\" onclick=\"document.adminForm." . $this->prefix . "limitstart.value=" . $item->base
. "; Joomla.submitform();return false;\">" . $item->text . "</a>";
}
else
{
return "<a title=\"" . $item->text . "\" onclick=\"document.adminForm." . $this->prefix
. "limitstart.value=0; Joomla.submitform();return false;\">" . $item->text . "</a>";
}
}
else
{
return "<a title=\"" . $item->text . "\" href=\"" . $item->link . "\" class=\"pagenav\">" . $item->text . "</a>";
}
}
/**
* Method to create an inactive pagination string
*
* @param object &$item The item to be processed
*
* @return string
*
* @since 11.1
*/
function pagination_item_inactive(&$item)
{
$app = JFactory::getApplication();
if ($app->isAdmin())
{
return "<span>" . $item->text . "</span>";
}
else
{
return "<span class=\"pagenav\">" . $item->text . "</span>";
}
}
/**
* Create the html for a list footer
*
* @param array $list Pagination list data structure.
*
* @return string HTML for a list start, previous, next,end
*
* @since 11.1
*/
function pagination_list_render($list)
{
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"pagination\">";
// Reverse output rendering for right-to-left display
if($lang->isRTL())
{
$html .= '« '.$list['start']['data'];
$html .= ' '.$list['previous']['data'];
$list['pages'] = array_reverse( $list['pages'] );
foreach( $list['pages'] as $page ) {
if($page['data']['active']) {
$html .= '<strong>';
}
$html .= ' '.$page['data'];
if($page['data']['active']) {
$html .= '</strong>';
}
}
$html .= ' '.$list['next']['data'];
$html .= ' '.$list['end']['data'];
$html .= ' »';
}
else
{
$html .= '« '.$list['start']['data'];
$html .= $list['previous']['data'];
foreach( $list['pages'] as $page )
{
if($page['data']['active']) {
$html .= '<strong>';
}
$html .= $page['data'];
if($page['data']['active']) {
$html .= '</strong>';
}
}
$html .= $list['next']['data'];
$html .= $list['end']['data'];
$html .= ' »';
}
$html .= "</div>";
return $html;
}
/**
* Create the HTML for a list footer
*
* @param array $list Pagination list data structure.
*
* @return string HTML for a list footer
*
* @since 11.1
*/
function pagination_list_footer($list)
{
if(JRequest::getCmd('option')=='com_virtuemart') {
$uri=JFactory::getURI();
$uri->delVar('type');
$uri->delVar('limitstart');
$uri->delVar('limit');
$list['limitfield']=str_replace('onchange="this.form.submit()"','onchange="loadContent(\''.JFactory::getURI()->toString().'&type=raw&limitstart=0&limit=\'+this.value);"',$list['limitfield']);
}
// Initialize variables
$lang =& JFactory::getLanguage();
$html = "<div class=\"list-footer\">\n";
if ($lang->isRTL())
{
$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
$html .= $list['pageslinks'];
$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
}
else
{
$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
$html .= $list['pageslinks'];
$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
}
$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
$html .= "\n</div>";
return $html;
}
?>