From 691faa0e83790c0dc40a937f875e3032843d91c3 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 26 Nov 2008 23:07:37 +0000 Subject: Draw an album tree in the access -> permissions tab. --- core/controllers/welcome.php | 15 +++++++++++++++ core/views/welcome.html.php | 22 +++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 821744e8..3bfcf1fd 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -33,10 +33,12 @@ class Welcome_Controller extends Template_Controller { $this->template->photo_count = ORM::factory("item")->where("type", "photo")->count_all(); $this->template->deepest_photo = ORM::factory("item") ->where("type", "photo")->orderby("level", "desc")->find(); + $this->template->album_tree = $this->_load_album_tree(); } catch (Exception $e) { $this->template->album_count = 0; $this->template->photo_count = 0; $this->template->deepest_photo = null; + $this->template->album_tree = array(); } $this->_load_user_info(); @@ -424,4 +426,17 @@ class Welcome_Controller extends Template_Controller { } url::redirect("welcome"); } + + public function _load_album_tree() { + $tree = array(); + foreach (ORM::factory("item")->where("type", "album")->find_all() as $album) { + if ($album->parent_id) { + $tree[$album->parent_id]->children[] = $album->id; + } + $tree[$album->id]->album = $album; + $tree[$album->id]->children = array(); + } + + return $tree; + } } diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index 70e9eb19..c0f27d3b 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -306,9 +306,25 @@
-

- Nothing yet -

+ + + + + + + + + +
-- cgit v1.2.3