From ea21ab9f3ae9a4f315eff536de48b530220221c2 Mon Sep 17 00:00:00 2001 From: Tomasz Dziuda Date: Fri, 19 Oct 2012 11:22:47 +0200 Subject: [PATCH] Fixed problems with pagination.php file --- meet_gavern/html/pagination.php | 334 +++++++++++++++++++++----------- 1 file changed, 223 insertions(+), 111 deletions(-) diff --git a/meet_gavern/html/pagination.php b/meet_gavern/html/pagination.php index ca37b11..70addb1 100644 --- a/meet_gavern/html/pagination.php +++ b/meet_gavern/html/pagination.php @@ -1,114 +1,226 @@ -base : integer - * $item->link : string - * $item->text : string - * - * pagination_item_inactive - * Input variable $item is an object with fields: - * $item->base : integer - * $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) -{ - $html = "
\n"; - $html .= $list['pageslinks']; - $html .= "\n"; - $html .= "\n
"; - - return $html; -} - -function pagination_list_render($list) -{ - // Initialize variables - $html = ""; +base : integer + * $item->link : string + * $item->text : string + * + * pagination_item_inactive + * Input variable $item is an object with fields: + * $item->base : integer + * $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 + */ + +/** + * 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 = "
\n"; + $html .= $list['pageslinks']; + $html .= "\n"; + $html .= "\n
"; + + return $html; +} + +/** + * Renders the pagination list + * + * @param array $list Array containing pagination information + * + * @return string HTML markup for the full pagination object + * + * @since 3.0 + */ +function pagination_list_render($list) +{ + // Calculate to display range of pages + $currentPage = 1; + $range = 1; + $step = 5; + foreach ($list['pages'] as $k => $page) + { + if (!$page['active']) + { + $currentPage = $k; + } + } + if ($currentPage >= $step) + { + if ($currentPage % $step == 0) + { + $range = ceil($currentPage / $step) + 1; + } + else + { + $range = ceil($currentPage / $step); + } + } + + $html = ''; return $html; - -} +} + +/** + * Renders an active item in the pagination block + * + * @param JPaginationObject $item The current pagination object + * + * @return string HTML markup for active item + * + * @since 3.0 + */ function pagination_item_active(&$item) { - if ($item->base>0) - return "
  • text."\" onclick=\"document.adminForm." . $item->prefix . "limitstart.value=".$item->base."; Joomla.submitform();return false;\">".$item->text."
  • "; - else - return "
  • text."\" onclick=\"document.adminForm." . $item->prefix . "limitstart.value=0; Joomla.submitform();return false;\">".$item->text."
  • "; -} - -function pagination_item_inactive(&$item) { - return "
  • ".$item->text."
  • "; -} -?> \ No newline at end of file + // Check for "Start" item + if ($item->text == JText::_('JLIB_HTML_START')) + { + $display = ''; + } + + // Check for "Prev" item + if ($item->text == JText::_('JPREV')) + { + $display = ''; + } + + // Check for "Next" item + if ($item->text == JText::_('JNEXT')) + { + $display = ''; + } + + // Check for "End" item + if ($item->text == JText::_('JLIB_HTML_END')) + { + $display = ''; + } + + // If the display object isn't set already, just render the item with its text + if (!isset($display)) + { + $display = $item->text; + } + + return "
  • text . "\" href=\"" . $item->link . "\" class=\"pagenav\">" . $item->text . "
  • "; +} + +/** + * Renders an inactive item in the pagination block + * + * @param JPaginationObject $item The current pagination object + * + * @return string HTML markup for inactive item + * + * @since 3.0 + */ +function pagination_item_inactive(&$item) +{ + // Check for "Start" item + if ($item->text == JText::_('JLIB_HTML_START')) + { + return '
  • '.JText::_('JLIB_HTML_START').'
  • '; + } + + // Check for "Prev" item + if ($item->text == JText::_('JPREV')) + { + return '
  • '.JText::_('JPREV').'
  • '; + } + + // Check for "Next" item + if ($item->text == JText::_('JNEXT')) + { + return '
  • '.JText::_('JNEXT').'
  • '; + } + + // Check for "End" item + if ($item->text == JText::_('JLIB_HTML_END')) + { + return '
  • '.JText::_('JLIB_HTML_END').'
  • '; + } + + // Check if the item is the active page + if (isset($item->active) && ($item->active)) + { + return '
  • ' . $item->text . '
  • '; + } + + // Doesn't match any other condition, render a normal item + return '
  • ' . $item->text . '
  • '; +} \ No newline at end of file