diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-13 02:48:13 +0800 |
|---|---|---|
| committer | <unostar@danalan.info> | 2009-06-13 04:22:28 +0800 |
| commit | 5f3d33b58ebbf5794eb9f432257e3eff9aaacf82 (patch) | |
| tree | 1baa5a89ea024e180edf43a04346e78ffd043ebc /modules/gallery/helpers | |
| parent | fd3a81f1ee9b1621f5be62ac4e7f595f7aa83fc0 (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
Signed-off-by: <unostar@danalan.info>
Diffstat (limited to 'modules/gallery/helpers')
| -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; + } } |
