1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/app/Controller/Feed.php
2015-12-29 01:24:09 +01:00

54 lines
1.2 KiB
PHP

<?php
namespace Kanboard\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);
}
$this->response->xml($this->template->render('feed/user', array(
'events' => $this->projectActivity->getProjects($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);
// 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,
)));
}
}