Как изменить pagination, чтоб страницы шли по порядку? Что мне нужно изменить?
Вот весь код РНР
class JPagination extends JObject { /** * @var integer The record number to start displaying from. * @since 11.1 */ public $limitstart = null;
/** * @var integer Number of rows to display per page. * @since 11.1 */ public $limit = null;
/** * @var integer Total number of rows. * @since 11.1 */ public $total = null;
/** * @var integer Prefix used for request variables. * @since 11.1 */ public $prefix = null;
/** * @var boolean View all flag * @since 11.1 */ protected $_viewall = false;
/** * Additional URL parameters to be added to the pagination URLs generated by the class. These * may be useful for filters and extra values when dealing with lists and GET requests. * * @var array * @since 11.1 */ protected $_additionalUrlParams = array();
/** * Constructor. * * @param integer $total The total number of items. * @param integer $limitstart The offset of the item to start at. * @param integer $limit The number of items to display per page. * @param string $prefix The prefix used for request variables. * * @since 11.1 */ public function __construct($total, $limitstart, $limit, $prefix = '') { // Value/type checking. $this->total = (int) $total; $this->limitstart = (int) max($limitstart, 0); $this->limit = (int) max($limit, 0); $this->prefix = $prefix;
if ($this->limit > $this->total) { $this->limitstart = 0; }
if (!$this->limit) { $this->limit = $total; $this->limitstart = 0; }
/* * If limitstart is greater than total (i.e. we are asked to display records that don't exist) * then set limitstart to display the last natural page of results */ if ($this->limitstart > $this->total - $this->limit) { $this->limitstart = max(0, (int) (ceil($this->total / $this->limit) - 0) * $this->limit); }
// Set the total pages and current page values. if ($this->limit > 0) { $this->set('pages.total', ceil($this->total / $this->limit)); $this->set('pages.current', ceil(($this->limitstart + 1) / $this->limit)); }
// If we are viewing all records set the view all flag to true. if ($limit == 0) { $this->_viewall = true; } }
/** * Method to set an additional URL parameter to be added to all pagination class generated * links. * * @param string $key The name of the URL parameter for which to set a value. * @param mixed $value The value to set for the URL parameter. * * @return mixed The old value for the parameter. * * @since 11.1 */ public function setAdditionalUrlParam($key, $value) { // Get the old value to return and set the new one for the URL parameter. $result = isset($this->_additionalUrlParams[$key]) ? $this->_additionalUrlParams[$key] : null;
// If the passed parameter value is null unset the parameter, otherwise set it to the given value. if ($value === null) { unset($this->_additionalUrlParams[$key]); } else { $this->_additionalUrlParams[$key] = $value; }
return $result; }
/** * Method to get an additional URL parameter (if it exists) to be added to * all pagination class generated links. * * @param string $key The name of the URL parameter for which to get the value. * * @return mixed The value if it exists or null if it does not. * * @since 11.1 */ public function getAdditionalUrlParam($key) { $result = isset($this->_additionalUrlParams[$key]) ? $this->_additionalUrlParams[$key] : null;
return $result; }
/** * Return the rationalised offset for a row with a given index. * * @param integer $index The row index * * @return integer Rationalised offset for a row with a given index. * * @since 11.1 */ public function getRowOffset($index) { return $index + 1 + $this->limitstart; }
/** * Return the pagination data object, only creating it if it doesn't already exist. * * @return object Pagination data object. * * @since 11.1 */ public function getData() { static $data; if (!is_object($data)) { $data = $this->_buildDataObject(); } return $data; }
/** * Create and return the pagination pages counter string, ie. Page 2 of 4. * * @return string Pagination pages counter string. * * @since 11.1 */ public function getPagesCounter() { // Initialise variables. $html = null; if ($this->get('pages.total') > 1) { $html .= JText::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $this->get('pages.current'), $this->get('pages.total')); } return $html; }
/** * Create and return the pagination result set counter string, e.g. Results 1-10 of 42 * * @return string Pagination result set counter string. * * @since 11.1 */ public function getResultsCounter() { // Initialise variables. $html = null; $fromResult = $this->limitstart + 1;
// If the limit is reached before the end of the list. if ($this->limitstart + $this->limit < $this->total) { $toResult = $this->limitstart + $this->limit; } else { $toResult = $this->total; }
// If there are results found. if ($this->total > 0) { $msg = JText::sprintf('JLIB_HTML_RESULTS_OF', $fromResult, $toResult, $this->total); $html .= "\n" . $msg; } else { $html .= "\n" . JText::_('JLIB_HTML_NO_RECORDS_FOUND'); }
return $html; }
/** * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x. * * @return string Pagination page list string. * * @since 11.1 */ public function getPagesLinks() { $app = JFactory::getApplication();
// Build the page navigation list. $data = $this->_buildDataObject();
/** * Creates a dropdown box for selecting how many records to show per page. * * @return string The HTML for the limit # input box. * * @since 11.1 */ public function getLimitBox() { $app = JFactory::getApplication();
/** * Return the icon to move an item UP. * * @param integer $i The row index. * @param boolean $condition True to show the icon. * @param string $task The task to fire. * @param string $alt The image alternative text string. * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string Either the icon to move an item up or a space. * * @since 11.1 */ public function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'JLIB_HTML_MOVE_UP', $enabled = true, $checkbox = 'cb') { if (($i > 0 || ($i + $this->limitstart > 0)) && $condition) { return JHtml::_('jgrid.orderUp', $i, $task, '', $alt, $enabled, $checkbox); } else { return ' '; } }
/** * Return the icon to move an item DOWN. * * @param integer $i The row index. * @param integer $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 alternative text string. * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * * @return string Either the icon to move an item down or a space. * * @since 11.1 */ public function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'JLIB_HTML_MOVE_DOWN', $enabled = true, $checkbox = 'cb') { if (($i < $n - 1 || $i + $this->limitstart < $this->total - 1) && $condition) { return JHtml::_('jgrid.orderDown', $i, $task, '', $alt, $enabled, $checkbox); } else { return ' '; } }
/** * Create the HTML for a list footer * * @param array $list Pagination list data structure. * * @return string HTML for a list footer * * @since 11.1 */ protected function _list_footer($list) { $html = "<div class=\"list-footer\">\n";
// Set the start and previous data objects. $data->start = new JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix); $data->previous = new JPaginationObject(JText::_('JPREV'), $this->prefix);
// Set the next and end data objects. $data->next = new JPaginationObject(JText::_('JNEXT'), $this->prefix); $data->end = new JPaginationObject(JText::_('JLIB_HTML_END'), $this->prefix);
/** * Pagination object representing a particular item in the pagination lists. * * @package Joomla.Platform * @subpackage HTML * @since 11.1 */ class JPaginationObject extends JObject { /** * @var string The link text. * @since 11.1 */ public $text;
/** * @var integer The number of rows as a base offset. * @since 11.1 */ public $base;
/** * @var string The link URL. * @since 11.1 */ public $link;
/** * @var integer The prefix used for request variables. * @since 11.1 */ public $prefix;
/** * Class constructor. * * @param string $text The link text. * @param integer $prefix The prefix used for request variables. * @param integer $base The number of rows as a base offset. * @param string $link The link URL. * * @since 11.1 */ public function __construct($text, $prefix = '', $base = null, $link = null) { $this->text = $text; $this->prefix = $prefix; $this->base = $base; $this->link = $link; } }
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Здравствуйте, подскажите какой тег использовать для увеличения значения, пример на картинке.
Вроде, про такой тег я слышала. Если есть тег прогресс бар, значит и такое должно быть.
Question
Bismuth
Как изменить pagination, чтоб страницы шли по порядку? Что мне нужно изменить?
Вот весь код РНР
Edited by BismuthLink to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.