summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2011-09-28 20:39:05 +0000
committerNathan Kinkade <nath@nkinka.de>2011-09-28 20:39:05 +0000
commit47456c0de8a408bca9b5a02a0fbc835ff1c01a68 (patch)
treedca2ead5e7159b28aa323465a363f81813f75acd /modules/gallery/controllers
parentd8dffba94277c2179a59eb72d6927a5bdb879648 (diff)
parentdfbfe090168ee4ed44e2c8208e79d3fe40f90437 (diff)
Manually fixed a merge conflict after pulling.
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/albums.php21
-rw-r--r--modules/gallery/controllers/movies.php25
-rw-r--r--modules/gallery/controllers/photos.php25
3 files changed, 28 insertions, 43 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 1c48c734..8aa3bb35 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -72,10 +72,29 @@ class Albums_Controller extends Items_Controller {
"breadcrumbs" => Breadcrumb::array_from_item_parents($album),
"children_count" => $children_count));
$template->content = new View("album.html");
-
$album->increment_view_count();
print $template;
+ item::set_display_context_callback("Albums_Controller::get_display_context");
+ }
+
+ static function get_display_context($item) {
+ $where = array(array("type", "!=", "album"));
+ $position = item::get_position($item, $where);
+ if ($position > 1) {
+ list ($previous_item, $ignore, $next_item) =
+ $item->parent()->viewable()->children(3, $position - 2, $where);
+ } else {
+ $previous_item = null;
+ list ($next_item) = $item->parent()->viewable()->children(1, $position, $where);
+ }
+
+ return array("position" => $position,
+ "previous_item" => $previous_item,
+ "next_item" => $next_item,
+ "sibling_count" => $item->parent()->viewable()->children_count($where),
+ "parents" => $item->parents()->as_array(),
+ "breadcrumbs" => Breadcrumb::array_from_item_parents($item));
}
public function create($parent_id) {
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index 0f12c3fb..76263dc0 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -27,28 +27,11 @@ class Movies_Controller extends Items_Controller {
access::required("view", $movie);
- $where = array(array("type", "!=", "album"));
- $position = item::get_position($movie, $where);
- if ($position > 1) {
- list ($previous_item, $ignore, $next_item) =
- $movie->parent()->viewable()->children(3, $position - 2, $where);
- } else {
- $previous_item = null;
- list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where);
- }
-
$template = new Theme_View("page.html", "item", "movie");
- $template->set_global(
- array("item" => $movie,
- "children" => array(),
- "children_count" => 0,
- "parents" => $movie->parents()->as_array(),
- "breadcrumbs" => Breadcrumb::array_from_item_parents($movie),
- "next_item" => $next_item,
- "previous_item" => $previous_item,
- "sibling_count" => $movie->parent()->viewable()->children_count($where),
- "position" => $position));
-
+ $template->set_global(array("item" => $movie,
+ "children" => array(),
+ "children_count" => 0));
+ $template->set_global(item::get_display_context($movie));
$template->content = new View("movie.html");
$movie->increment_view_count();
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php
index af8aed16..7e78b205 100644
--- a/modules/gallery/controllers/photos.php
+++ b/modules/gallery/controllers/photos.php
@@ -27,28 +27,11 @@ class Photos_Controller extends Items_Controller {
access::required("view", $photo);
- $where = array(array("type", "!=", "album"));
- $position = item::get_position($photo, $where);
- if ($position > 1) {
- list ($previous_item, $ignore, $next_item) =
- $photo->parent()->viewable()->children(3, $position - 2, $where);
- } else {
- $previous_item = null;
- list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where);
- }
-
$template = new Theme_View("page.html", "item", "photo");
- $template->set_global(
- array("item" => $photo,
- "children" => array(),
- "children_count" => 0,
- "parents" => $photo->parents()->as_array(),
- "breadcrumbs" => Breadcrumb::array_from_item_parents($photo),
- "next_item" => $next_item,
- "previous_item" => $previous_item,
- "sibling_count" => $photo->parent()->viewable()->children_count($where),
- "position" => $position));
-
+ $template->set_global(array("item" => $photo,
+ "children" => array(),
+ "children_count" => 0));
+ $template->set_global(item::get_display_context($photo));
$template->content = new View("photo.html");
$photo->increment_view_count();