summaryrefslogtreecommitdiff
path: root/app/Controller/Feed.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-19 19:38:23 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-19 19:38:23 -0400
commit73c47d9461cbfea88c84f3f2b01cdeb2d22c2f87 (patch)
treec7749fee7885ecfe6f12ae53a55c615ef0191971 /app/Controller/Feed.php
parentff85518fa8f6dc48ac5dedb4847c6bb24ea35b2f (diff)
Add RSS feed for users and change address of project feeds
Diffstat (limited to 'app/Controller/Feed.php')
-rw-r--r--app/Controller/Feed.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/app/Controller/Feed.php b/app/Controller/Feed.php
new file mode 100644
index 00000000..c08919c2
--- /dev/null
+++ b/app/Controller/Feed.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace Controller;
+
+/**
+ * Atom/RSS Feed controller
+ *
+ * @package controller
+ * @author Frederic Guillot
+ */
+class Feed extends Base
+{
+ /**
+ * RSS feed for a user
+ *
+ * @access public
+ */
+ public function user()
+ {
+ $token = $this->request->getStringParam('token');
+ $user = $this->user->getByToken($token);
+
+ // Token verification
+ if (empty($user)) {
+ $this->forbidden(true);
+ }
+
+ $projects = $this->projectPermission->getActiveMemberProjects($user['id']);
+
+ $this->response->xml($this->template->render('feed/user', array(
+ 'events' => $this->projectActivity->getProjects(array_keys($projects)),
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * RSS feed for a project
+ *
+ * @access public
+ */
+ public function project()
+ {
+ $token = $this->request->getStringParam('token');
+ $project = $this->project->getByToken($token);
+
+ // Token verification
+ if (empty($project)) {
+ $this->forbidden(true);
+ }
+
+ $this->response->xml($this->template->render('feed/project', array(
+ 'events' => $this->projectActivity->getProject($project['id']),
+ 'project' => $project,
+ )));
+ }
+}