diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-12 11:48:13 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-12 11:48:13 -0700 |
commit | 30bdaa81233fc2904367cd39017597b33f05efa9 (patch) | |
tree | 68a6bc6707290e91d2f5b3427fbdb28193b28c72 /modules/gallery/helpers/gallery_rss.php | |
parent | dc6c75cd05b66b030daa9b4088ee69758f71e1e8 (diff) |
Continue refactoring the rss module and distribute the creation of album and
tag feeds to the gallery and tag modules respectively. This chould close
ticket #388
Diffstat (limited to 'modules/gallery/helpers/gallery_rss.php')
-rw-r--r-- | modules/gallery/helpers/gallery_rss.php | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 98798346..6e722ff6 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -22,7 +22,10 @@ class gallery_rss_Core { static function available_feeds($item) { return array(array("description" => t("New photos or movies"), "sidebar" => true, - "uri" => "updates")); + "uri" => "updates"), + array("description" => t("Album feed"), + "sidebar" => false, + "uri" => "albums")); } static function updates($offset, $limit) { @@ -39,4 +42,20 @@ class gallery_rss_Core { return $feed; } + + static function albums($offset, $limit, $id) { + $item = ORM::factory("item", $id); + access::required("view", $item); + + $feed = new stdClass(); + $feed->data["children"] = $item + ->viewable() + ->descendants($limit, $offset, "photo"); + $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit); + $feed->data["title"] = $item->title; + $feed->data["link"] = url::abs_site("albums/{$item->id}"); + $feed->data["description"] = $item->description; + + return $feed; + } } |