diff options
author | Joe7 <jozsef.rnagy@site.hu> | 2011-01-02 18:59:23 +0100 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-01-03 11:38:13 -0800 |
commit | cfaa62370ecbdb3badf4ab68bbefa7cfedaea154 (patch) | |
tree | 7cc8dbb5c6c21ca6e693be391c18cc3116bb64b3 /modules/gallery/controllers | |
parent | e6a5f39b9113fa9cfc526b873947e365793d4e3e (diff) |
Reimplemented Kohana 2.3's View::set_global() with array support.
Allows for cleaner code and fewer function calls.
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r-- | modules/gallery/controllers/albums.php | 17 | ||||
-rw-r--r-- | modules/gallery/controllers/movies.php | 17 | ||||
-rw-r--r-- | modules/gallery/controllers/photos.php | 17 |
3 files changed, 27 insertions, 24 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index c0368488..e69f6b6d 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -61,14 +61,15 @@ class Albums_Controller extends Items_Controller { } $template = new Theme_View("page.html", "collection", "album"); - $template->set_global("page", $page); - $template->set_global("page_title", null); - $template->set_global("max_pages", $max_pages); - $template->set_global("page_size", $page_size); - $template->set_global("item", $album); - $template->set_global("children", $album->viewable()->children($page_size, $offset)); - $template->set_global("children_count", $children_count); - $template->set_global("parents", $album->parents()->as_array()); // view calls empty() on this + $template->set_global(array("page" => $page, + "page_title" => null, + "max_pages" => $max_pages, + "page_size" => $page_size, + "item" => $album, + "children" => $album->viewable()->children($page_size, $offset), + "children_count" => $children_count, + "parents" => $album->parents()->as_array())); + // view calls empty() on this $template->content = new View("album.html"); $album->increment_view_count(); diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 15d4f950..1ae969c7 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -38,14 +38,15 @@ class Movies_Controller extends Items_Controller { } $template = new Theme_View("page.html", "item", "movie"); - $template->set_global("item", $movie); - $template->set_global("children", array()); - $template->set_global("children_count", 0); - $template->set_global("parents", $movie->parents()->as_array()); - $template->set_global("next_item", $next_item); - $template->set_global("previous_item", $previous_item); - $template->set_global("sibling_count", $movie->parent()->viewable()->children_count($where)); - $template->set_global("position", $position); + $template->set_global(array("item" => $movie, + "children" => array(), + "children_count" => 0, + "parents" => $movie->parents()->as_array(), + "next_item" => $next_item, + "previous_item" => $previous_item, + "sibling_count" + => $movie->parent()->viewable()->children_count($where), + "position" => $position)); $template->content = new View("movie.html"); diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 2dc22ca4..e795f336 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -38,14 +38,15 @@ class Photos_Controller extends Items_Controller { } $template = new Theme_View("page.html", "item", "photo"); - $template->set_global("item", $photo); - $template->set_global("children", array()); - $template->set_global("children_count", 0); - $template->set_global("parents", $photo->parents()->as_array()); - $template->set_global("next_item", $next_item); - $template->set_global("previous_item", $previous_item); - $template->set_global("sibling_count", $photo->parent()->viewable()->children_count($where)); - $template->set_global("position", $position); + $template->set_global(array("item" => $photo, + "children" => array(), + "children_count" => 0, + "parents" => $photo->parents()->as_array(), + "next_item" => $next_item, + "previous_item" => $previous_item, + "sibling_count" + => $photo->parent()->viewable()->children_count($where), + "position" => $position)); $template->content = new View("photo.html"); |