Back to Pagination class

Method getPagesLinks

public string
()
Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x.
Returns
  • string Pagination page list string.
Since
  • 1.5
Class: Pagination
Project: Joomla

Method getPagesLinks - Source code

/**
 * Create and return the pagination page list string, ie. Previous, Next, 1 2 3 ... x.
 *
 * @return  string  Pagination page list string.
 *
 * @since   1.5
 */
public function getPagesLinks()
{
    // Build the page navigation list.
    $data = $this->_buildDataObject();
    $list = array();
    $list['prefix'] = $this->prefix;
    $chromePath = JPATH_THEMES . '/' . $this->app->getTemplate() . '/html/pagination.php';
    if (is_file($chromePath)) {
        include_once $chromePath;
    }
    // Build the select list
    if ($data->all->base !== null) {
        $list['all']['active'] = true;
        $list['all']['data'] = $this->_item_active($data->all);
    } else {
        $list['all']['active'] = false;
        $list['all']['data'] = $this->_item_inactive($data->all);
    }
    if ($data->start->base !== null) {
        $list['start']['active'] = true;
        $list['start']['data'] = $this->_item_active($data->start);
    } else {
        $list['start']['active'] = false;
        $list['start']['data'] = $this->_item_inactive($data->start);
    }
    if ($data->previous->base !== null) {
        $list['previous']['active'] = true;
        $list['previous']['data'] = $this->_item_active($data->previous);
    } else {
        $list['previous']['active'] = false;
        $list['previous']['data'] = $this->_item_inactive($data->previous);
    }
    // Make sure it exists
    $list['pages'] = array();
    foreach ($data->pages as $i => $page) {
        if ($page->base !== null) {
            $list['pages'][$i]['active'] = true;
            $list['pages'][$i]['data'] = $this->_item_active($page);
        } else {
            $list['pages'][$i]['active'] = false;
            $list['pages'][$i]['data'] = $this->_item_inactive($page);
        }
    }
    if ($data->next->base !== null) {
        $list['next']['active'] = true;
        $list['next']['data'] = $this->_item_active($data->next);
    } else {
        $list['next']['active'] = false;
        $list['next']['data'] = $this->_item_inactive($data->next);
    }
    if ($data->end->base !== null) {
        $list['end']['active'] = true;
        $list['end']['data'] = $this->_item_active($data->end);
    } else {
        $list['end']['active'] = false;
        $list['end']['data'] = $this->_item_inactive($data->end);
    }
    if ($this->total > $this->limit) {
        return $this->_list_render($list);
    } else {
        return '';
    }
}