diff options
| author | Chad Kieffer <ckieffer@gmail.com> | 2009-11-14 15:48:39 -0700 |
|---|---|---|
| committer | Chad Kieffer <ckieffer@gmail.com> | 2009-11-14 15:48:39 -0700 |
| commit | eb3042650bddd15def809b658c1566a7ce08f4c1 (patch) | |
| tree | 9f3d3f353b77e88920e9d9345c1f52a526ce3448 /modules/gallery/libraries/Theme_View.php | |
| parent | 68886627cf76d69973c5956637b29908f58469ef (diff) | |
| parent | 9fd6a6f9058a89e60f83c6f2e89ae9e994c9e53a (diff) | |
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/libraries/Theme_View.php')
| -rw-r--r-- | modules/gallery/libraries/Theme_View.php | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 7e6a0b2e..5e8bc728 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -135,16 +135,48 @@ class Theme_View_Core extends Gallery_View { return $menu->render(); } + /** + * Set up the data and render a pager. + * + * See themes/wind/views/pager.html for documentation on the variables generated here. + */ public function pager() { - if ($this->children_count) { - $this->pagination = new Pagination(); - $this->pagination->initialize( - array("query_string" => "page", - "total_items" => $this->children_count, - "items_per_page" => $this->page_size, - "style" => "classic")); - return $this->pagination->render(); + $v = new View("pager.html"); + $v->page_type = $this->page_type; + $v->first_page_url = null; + $v->previous_page_url = null; + $v->next_page_url = null; + $v->last_page_url = null; + + if ($this->page_type == "album") { + $v->page = $this->page; + $v->max_pages = $this->max_pages; + $v->total = $this->children_count; + if ($this->page != 1) { + $v->first_page_url = $this->item->url(); + $v->previous_page_url = $this->item->url("page=" . ($this->page - 1)); + } + + if ($this->page != $this->max_pages) { + $v->next_page_url = $this->item->url("page=" . ($this->page + 1)); + $v->last_page_url = $this->item->url("page={$this->max_pages}"); + } + + $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; + $v->last_visible_position = $this->page * $this->page_size; + } else { + $v->position = $this->position; + $v->total = $this->sibling_count; + if ($v->previous_page = $this->previous_item) { + $v->previous_page_url = $this->previous_item->url(); + } + + if ($v->next_page = $this->next_item) { + $v->next_page_url = $this->next_item->url(); + } } + + return $v; } /** |
