summaryrefslogtreecommitdiff
path: root/app/Controller/FeedController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 11:31:54 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 11:31:54 -0400
commitab48a09f0d674b703467975b376c5ac7352670ae (patch)
tree99fbb0cf719acee8c500622d498bd7f6375b62a1 /app/Controller/FeedController.php
parent82b5b491bec94cb3d40a5820fbef9959435309be (diff)
Rename controllers
Diffstat (limited to 'app/Controller/FeedController.php')
-rw-r--r--app/Controller/FeedController.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/app/Controller/FeedController.php b/app/Controller/FeedController.php
new file mode 100644
index 00000000..e453ecb9
--- /dev/null
+++ b/app/Controller/FeedController.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace Kanboard\Controller;
+
+use Kanboard\Core\Controller\AccessForbiddenException;
+
+/**
+ * Atom/RSS Feed controller
+ *
+ * @package Kanboard\Controller
+ * @author Frederic Guillot
+ */
+class FeedController extends BaseController
+{
+ /**
+ * 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)) {
+ throw AccessForbiddenException::getInstance()->withoutLayout();
+ }
+
+ $this->response->xml($this->template->render('feed/user', array(
+ 'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermission->getActiveProjectIds($user['id'])),
+ 'user' => $user,
+ )));
+ }
+
+ /**
+ * RSS feed for a project
+ *
+ * @access public
+ */
+ public function project()
+ {
+ $token = $this->request->getStringParam('token');
+ $project = $this->project->getByToken($token);
+
+ if (empty($project)) {
+ throw AccessForbiddenException::getInstance()->withoutLayout();
+ }
+
+ $this->response->xml($this->template->render('feed/project', array(
+ 'events' => $this->helper->projectActivity->getProjectEvents($project['id']),
+ 'project' => $project,
+ )));
+ }
+}