english/libraries/joomla/html/pagination.php
/**
	 * Create and return the pagination data object.
	 *
	 * @return  object  Pagination data object.
	 * @since   11.1
	 */
Create and return the pagination data object.
@return  object  Pagination data object.
Create and return the pagination data object . @return object Pagination data object .
protected function _buildDataObject()
	{
		$data = new stdClass;
		$params = '';
		if (!empty($this->_additionalUrlParams))
		{
			foreach($this->_additionalUrlParams as $key => $value)
			{
				$params .= '&'.$key.'='.$value;
			}
		}
		$data->all = new JPaginationObject(JText::_('JLIB_HTML_VIEW_ALL'), $this->prefix);
		if (!$this->_viewall) {
			$data->all->base	= '0';
			$data->all->link	= JRoute::_($params.'&'.$this->prefix.'limitstart=');
		}
		$data->start	= new JPaginationObject(JText::_('JLIB_HTML_START'), $this->prefix);
		$data->previous	= new JPaginationObject(JText::_('JPREV'), $this->prefix);
		if ($this->get('pages.current') > 1)
		{
			$page = ($this->get('pages.current') -2) * $this->limit;
			$data->start->base	= '0';
			$data->start->link	= JRoute::_($params.'&'.$this->prefix.'limitstart=0');
			$data->previous->base	= $page;
			$data->previous->link	= JRoute::_($params.'&'.$this->prefix.'limitstart='.$page);
		}
		$data->next	= new JPaginationObject(JText::_('JNEXT'), $this->prefix);
		$data->end	= new JPaginationObject(JText::_('JLIB_HTML_END'), $this->prefix);
		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::_($params.'&'.$this->prefix.'limitstart='.$next);
			$data->end->base	= $end;
			$data->end->link	= JRoute::_($params.'&'.$this->prefix.'limitstart='.$end);
		}
		$data->pages = array();
		$stop = $this->get('pages.stop');
		for ($i = $this->get('pages.start'); $i <= $stop; $i ++)
		{
			$offset = ($i -1) * $this->limit;
			$data->pages[$i] = new JPaginationObject($i, $this->prefix);
			if ($i != $this->get('pages.current') || $this->_viewall)
			{
				$data->pages[$i]->base	= $offset;
				$data->pages[$i]->link	= JRoute::_($params.'&'.$this->prefix.'limitstart='.$offset);
			}
		}
		return $data;
	}
protected function _buildDataObject ( ) { $ data = new stdClass ; $ params = '' ; if ( ! empty ( $ this -> _additionalUrlParams ) ) { foreach ( $ this -> _additionalUrlParams as $ key => $ value ) { $ params .= '&' . $ key . '=' . $ value ; } } $ data -> all = new JPaginationObject ( JText :: _ ( 'JLIB_HTML_VIEW_ALL' ) , $ this -> prefix ) ; if ( ! $ this -> _viewall ) { $ data -> all -> base = '0' ; $ data -> all -> link = JRoute :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=' ) ; } $ data -> start = new JPaginationObject ( JText :: _ ( 'JLIB_HTML_START' ) , $ this -> prefix ) ; $ data -> previous = new JPaginationObject ( JText :: _ ( 'JPREV' ) , $ this -> prefix ) ; if ( $ this -> get ( 'pages.current' ) > 1 ) { $ page = ( $ this -> get ( 'pages.current' ) - 2 ) * $ this -> limit ; $ data -> start -> base = '0' ; $ data -> start -> link = JRoute :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=0' ) ; $ data -> previous -> base = $ page ; $ data -> previous -> link = JRoute :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=' . $ page ) ; } $ data -> next = new JPaginationObject ( JText :: _ ( 'JNEXT' ) , $ this -> prefix ) ; $ data -> end = new JPaginationObject ( JText :: _ ( 'JLIB_HTML_END' ) , $ this -> prefix ) ; 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 :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=' . $ next ) ; $ data -> end -> base = $ end ; $ data -> end -> link = JRoute :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=' . $ end ) ; } $ data -> pages = array ( ) ; $ stop = $ this -> get ( 'pages.stop' ) ; for ( $ i = $ this -> get ( 'pages.start' ) ; $ i <= $ stop ; $ i ++ ) { $ offset = ( $ i - 1 ) * $ this -> limit ; $ data -> pages [ $ i ] = new JPaginationObject ( $ i , $ this -> prefix ) ; if ( $ i != $ this -> get ( 'pages.current' ) || $ this -> _viewall ) { $ data -> pages [ $ i ] -> base = $ offset ; $ data -> pages [ $ i ] -> link = JRoute :: _ ( $ params . '&' . $ this -> prefix . 'limitstart=' . $ offset ) ; } } return $ data ; }
Create and return the pagination data object.
Create and return the pagination data object .
// Initialise variables. // Build the additional URL parameters string. // Set the start and previous data objects. // Set the empty for removal from route //$page = $page == 0 ? '' : $page; // Set the next and end data objects. // Set the empty for removal from route //$offset = $offset == 0 ? '' : $offset;