From b3314fc1dcfd73c36c4bab82a5ebabca629845c8 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 19 Nov 2008 18:23:30 +0000 Subject: Update the media rss template to include the resize and the fullsize added descendants by type method to the item model to allow for the selection of children by type --- modules/media_rss/controllers/media_rss.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'modules/media_rss/controllers') diff --git a/modules/media_rss/controllers/media_rss.php b/modules/media_rss/controllers/media_rss.php index e6b499ea..f88e7004 100644 --- a/modules/media_rss/controllers/media_rss.php +++ b/modules/media_rss/controllers/media_rss.php @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Media_RSS_Controller extends Controller { + public static $LIMIT = 10; public function feed($id) { $item = ORM::factory("item", $id)->find(); if (!$item->loaded) { @@ -27,11 +28,15 @@ class Media_RSS_Controller extends Controller { $view = new View("feed.mrss"); $view->item = $item; - // This should probably be a method in ORM_MPTT - $view->children = ORM::factory("item") - ->where("parent_id", $item->id) - ->where("type", "photo") - ->find_all(); + $offset = $this->input->get("offset", 0); + $view->children = $item->decendents_by_type("photo", Media_RSS_Controller::$LIMIT, $offset); + + if (!empty($offset)) { + $view->prevOffset = $offset - Media_RSS_Controller::$LIMIT; + } + if ($view->children->count() >= Media_RSS_Controller::$LIMIT) { + $view->nextOffset = $offset + Media_RSS_Controller::$LIMIT; + } header("Content-type: application/rss+xml"); print $view; -- cgit v1.2.3