From: Chuck Hagenbuch Date: Tue, 20 Jan 2009 05:16:36 +0000 (-0500) Subject: stubs for recent feeds. needs some work in Horde_Feed for RSS to work and to fix... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=31710adffe6f317c82aa66a8f9d784b627452b23;p=horde.git stubs for recent feeds. needs some work in Horde_Feed for RSS to work and to fix the dates. --- diff --git a/content/app/controllers/TagController.php b/content/app/controllers/TagController.php index ce4764cd7..7fcc147c0 100644 --- a/content/app/controllers/TagController.php +++ b/content/app/controllers/TagController.php @@ -56,7 +56,7 @@ class TagController extends Content_ApplicationController */ public function tag() { - // Routes enforce POST or PUT only, but double-check here. + // The route configuration enforces POST or PUT only, but double-check here. } /** @@ -64,7 +64,7 @@ class TagController extends Content_ApplicationController */ public function untag() { - // Routes enforce POST or DELETE only, but double-check here. + // The route configuration enforces POST or DELETE only, but double-check here. } @@ -75,6 +75,12 @@ class TagController extends Content_ApplicationController $this->render(); break; + case 'atom': + case 'rss': + $method = '_' . $this->_action . 'Feed'; + $this->$method(); + break; + case 'json': default: $this->renderText(json_encode($this->results)); @@ -82,4 +88,76 @@ class TagController extends Content_ApplicationController } } + protected function _recentTagsFeed() + { + $entries = array(); + foreach ($this->results as $tag) { + $entries[] = array( + 'id' => 'tag/' . $tag['tag_id'], /* @TODO use routes to get the full URI here */ + 'title' => $tag['tag_name'], + 'updated' => $tag['created'], + ); + } + + $format = $this->_request->getFormat(); + $class = 'Horde_Feed_' . ucfirst((string)$this->_request->getFormat()); + $feed = new $class(array( + 'id' => 'tags/recent', /* @TODO Use routes to get url to this search */ + 'title' => 'Recent tags', + 'updated' => $this->_request->getTimestamp(), + 'entry' => $entries, + + )); + header('Content-type: ' . $format->string); + $this->renderText($feed->saveXml()); + } + + protected function _recentObjectsFeed() + { + $entries = array(); + foreach ($this->results as $object) { + $entries[] = array( + 'id' => 'object/' . $object['object_id'], /* @TODO use routes to get the full URI here */ + 'title' => $object['object_name'], + 'updated' => $object['created'], + ); + } + + $format = $this->_request->getFormat(); + $class = 'Horde_Feed_' . ucfirst((string)$this->_request->getFormat()); + $feed = new $class(array( + 'id' => 'objects/recent', /* @TODO Use routes to get url to this search */ + 'title' => 'Recent objects', + 'updated' => $this->_request->getTimestamp(), + 'entry' => $entries, + + )); + header('Content-type: ' . $format->string); + $this->renderText($feed->saveXml()); + } + + protected function _recentUsersFeed() + { + $entries = array(); + foreach ($this->results as $user) { + $entries[] = array( + 'id' => 'user/' . $user['user_id'], /* @TODO use routes to get the full URI here */ + 'title' => $user['user_name'], + 'updated' => $user['created'], + ); + } + + $format = $this->_request->getFormat(); + $class = 'Horde_Feed_' . ucfirst((string)$this->_request->getFormat()); + $feed = new $class(array( + 'id' => 'users/recent', /* @TODO Use routes to get url to this search */ + 'title' => 'Recent users', + 'updated' => $this->_request->getTimestamp(), + 'entry' => $entries, + + )); + header('Content-type: ' . $format->string); + $this->renderText($feed->saveXml()); + } + }