📄 pagination.php
字号:
} } /** * Return the pagination footer * * @access public * @return string Pagination footer * @since 1.0 */ function getListFooter() { global $mainframe; $list = array(); $list['limit'] = $this->limit; $list['limitstart'] = $this->limitstart; $list['total'] = $this->total; $list['limitfield'] = $this->getLimitBox(); $list['pagescounter'] = $this->getPagesCounter(); $list['pageslinks'] = $this->getPagesLinks(); $chromePath = JPATH_THEMES.DS.$mainframe->getTemplate().DS.'html'.DS.'pagination.php'; if (file_exists( $chromePath )) { require_once( $chromePath ); if (function_exists( 'pagination_list_footer' )) { return pagination_list_footer( $list ); } } return $this->_list_footer($list); } /** * Creates a dropdown box for selecting how many records to show per page * * @access public * @return string The html for the limit # input box * @since 1.0 */ function getLimitBox() { global $mainframe; // Initialize variables $limits = array (); // Make the option list for ($i = 5; $i <= 30; $i += 5) { $limits[] = JHTML::_('select.option', "$i"); } $limits[] = JHTML::_('select.option', '50'); $limits[] = JHTML::_('select.option', '100'); $limits[] = JHTML::_('select.option', '0', JText::_('all')); $selected = $this->_viewall ? 0 : $this->limit; // Build the select list if ($mainframe->isAdmin()) { $html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="submitform();"', 'value', 'text', $selected); } else { $html = JHTML::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="this.form.submit()"', 'value', 'text', $selected); } return $html; } /** * Return the icon to move an item UP * * @access public * @param int $i The row index * @param boolean $condition True to show the icon * @param string $task The task to fire * @param string $alt The image alternate text string * @return string Either the icon to move an item up or a space * @since 1.0 */ function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'Move Up', $enabled = true) { $alt = JText::_($alt); $html = ' '; if (($i > 0 || ($i + $this->limitstart > 0)) && $condition) { if($enabled) { $html = '<a href="#reorder" onclick="return listItemTask(\'cb'.$i.'\',\''.$task.'\')" title="'.$alt.'">'; $html .= ' <img src="images/uparrow.png" width="16" height="16" border="0" alt="'.$alt.'" />'; $html .= '</a>'; } else { $html = '<img src="images/uparrow0.png" width="16" height="16" border="0" alt="'.$alt.'" />'; } } return $html; } /** * Return the icon to move an item DOWN * * @access public * @param int $i The row index * @param int $n The number of items in the list * @param boolean $condition True to show the icon * @param string $task The task to fire * @param string $alt The image alternate text string * @return string Either the icon to move an item down or a space * @since 1.0 */ function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'Move Down', $enabled = true) { $alt = JText::_($alt); $html = ' '; if (($i < $n -1 || $i + $this->limitstart < $this->total - 1) && $condition) { if($enabled) { $html = '<a href="#reorder" onclick="return listItemTask(\'cb'.$i.'\',\''.$task.'\')" title="'.$alt.'">'; $html .= ' <img src="images/downarrow.png" width="16" height="16" border="0" alt="'.$alt.'" />'; $html .= '</a>'; } else { $html = '<img src="images/downarrow0.png" width="16" height="16" border="0" alt="'.$alt.'" />'; } } return $html; } function _list_footer($list) { // Initialize variables $html = "<div class=\"list-footer\">\n"; $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; } function _list_render($list) { // Initialize variables $html = null; // Reverse output rendering for right-to-left display $html .= '<< '; $html .= $list['start']['data']; $html .= ' < '; $html .= $list['previous']['data']; foreach( $list['pages'] as $page ) { $html .= ' '.$page['data']; } $html .= ' '. $list['next']['data']; $html .= ' >'; $html .= ' '. $list['end']['data']; $html .= ' >>'; return $html; } function _item_active(&$item) { global $mainframe; if ($mainframe->isAdmin()) { if($item->base>0) return "<a title=\"".$item->text."\" onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; submitform();return false;\">".$item->text."</a>"; else return "<a title=\"".$item->text."\" onclick=\"javascript: document.adminForm.limitstart.value=0; submitform();return false;\">".$item->text."</a>"; } else { return "<a title=\"".$item->text."\" href=\"".$item->link."\" class=\"pagenav\">".$item->text."</a>"; } } function _item_inactive(&$item) { global $mainframe; if ($mainframe->isAdmin()) { return "<span>".$item->text."</span>"; } else { return "<span class=\"pagenav\">".$item->text."</span>"; } } /** * Create and return the pagination data object * * @access public * @return object Pagination data object * @since 1.5 */ function _buildDataObject() { // Initialize variables $data = new stdClass(); $data->all = new JPaginationObject(JText::_('View All')); if (!$this->_viewall) { $data->all->base = '0'; $data->all->link = JRoute::_("&limitstart="); } // Set the start and previous data objects $data->start = new JPaginationObject(JText::_('Start')); $data->previous = new JPaginationObject(JText::_('Prev')); if ($this->get('pages.current') > 1) { $page = ($this->get('pages.current') -2) * $this->limit; $page = $page == 0 ? '' : $page; //set the empty for removal from route $data->start->base = '0'; $data->start->link = JRoute::_("&limitstart="); $data->previous->base = $page; $data->previous->link = JRoute::_("&limitstart=".$page); } // Set the next and end data objects $data->next = new JPaginationObject(JText::_('Next')); $data->end = new JPaginationObject(JText::_('End')); if ($this->get('pages.current') < $this->get('pages.total')) { $next = $this->get('pages.current') * $this->limit; $end = ($this->get('pages.total') -1) * $this->limit; $data->next->base = $next; $data->next->link = JRoute::_("&limitstart=".$next); $data->end->base = $end; $data->end->link = JRoute::_("&limitstart=".$end); } $data->pages = array(); $stop = $this->get('pages.stop'); for ($i = $this->get('pages.start'); $i <= $stop; $i ++) { $offset = ($i -1) * $this->limit; $offset = $offset == 0 ? '' : $offset; //set the empty for removal from route $data->pages[$i] = new JPaginationObject($i); if ($i != $this->get('pages.current') || $this->_viewall) { $data->pages[$i]->base = $offset; $data->pages[$i]->link = JRoute::_("&limitstart=".$offset); } } return $data; }}/** * Pagination object representing a particular item in the pagination lists * * @package Joomla.Framework * @subpackage HTML * @since 1.5 */class JPaginationObject extends JObject{ var $text; var $base; var $link; function __construct($text, $base=null, $link=null) { $this->text = $text; $this->base = $base; $this->link = $link; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -