diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Feed.php | 56 | ||||
-rw-r--r-- | app/Controller/Project.php | 21 |
2 files changed, 56 insertions, 21 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, + ))); + } +} diff --git a/app/Controller/Project.php b/app/Controller/Project.php index ba039b7d..faebac38 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -395,27 +395,6 @@ class Project extends Base } /** - * RSS feed for a project (public) - * - * @access public - */ - public function feed() - { - $token = $this->request->getStringParam('token'); - $project = $this->project->getByToken($token); - - // Token verification - if (empty($project)) { - $this->forbidden(true); - } - - $this->response->xml($this->template->render('project/feed', array( - 'events' => $this->projectActivity->getProject($project['id']), - 'project' => $project, - ))); - } - - /** * Display a form to create a new project * * @access public |