Allow jumping to random pages through pagination fillers.
This commit is contained in:
@@ -42,7 +42,7 @@ class Dispatcher
|
||||
return new ViewPhotoAlbum();
|
||||
}
|
||||
// Look for particular actions...
|
||||
elseif (preg_match('~^/(?<action>[a-z]+)/?~', $_SERVER['PATH_INFO'], $path) && isset($possibleActions[$path['action']]))
|
||||
elseif (preg_match('~^/(?<action>[a-z]+)(?:/page/(?<page>\d+))?/?~', $_SERVER['PATH_INFO'], $path) && isset($possibleActions[$path['action']]))
|
||||
{
|
||||
$_GET = array_merge($_GET, $path);
|
||||
return new $possibleActions[$path['action']]();
|
||||
|
||||
@@ -201,7 +201,7 @@ class GenericTable extends PageIndex
|
||||
}
|
||||
}
|
||||
|
||||
protected function getLink($start = null, $order = null, $dir = null)
|
||||
public function getLink($start = null, $order = null, $dir = null)
|
||||
{
|
||||
if ($start === null)
|
||||
$start = $this->start;
|
||||
|
||||
@@ -132,14 +132,14 @@ class PageIndex
|
||||
$this->page_index['next'] = $this->page_index[$this->current_page + 1];
|
||||
}
|
||||
|
||||
protected function getLink($start = null, $order = null, $dir = null)
|
||||
public function getLink($start = null, $order = null, $dir = null)
|
||||
{
|
||||
$url = $this->base_url;
|
||||
$amp = strpos($this->base_url, '?') ? '&' : '?';
|
||||
|
||||
if (!empty($start))
|
||||
{
|
||||
$page = ($start / $this->items_per_page) + 1;
|
||||
$page = $start !== '%d' ? ($start / $this->items_per_page) + 1 : $start;
|
||||
$url .= strtr($this->page_slug, ['%PAGE%' => $page, '%AMP%' => $amp]);
|
||||
$amp = '&';
|
||||
}
|
||||
@@ -167,6 +167,21 @@ class PageIndex
|
||||
return $this->page_index;
|
||||
}
|
||||
|
||||
public function getItemsPerPage()
|
||||
{
|
||||
return $this->items_per_page;
|
||||
}
|
||||
|
||||
public function getSortOrder()
|
||||
{
|
||||
return $this->sort_order;
|
||||
}
|
||||
|
||||
public function getSortDirection()
|
||||
{
|
||||
return $this->sort_direction;
|
||||
}
|
||||
|
||||
public function getPageIndexClass()
|
||||
{
|
||||
return $this->index_class;
|
||||
|
||||
Reference in New Issue
Block a user