1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
<?php
namespace Wallabag\CoreBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Wallabag\CoreBundle\Entity\User;
use Wallabag\CoreBundle\Entity\Entry;
class RssController extends Controller
{
/**
* Shows unread entries for current user.
*
* @Route("/{username}/{token}/unread.xml", name="unread_rss", defaults={"_format"="xml"})
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showUnreadAction(User $user)
{
$entries = $this->getDoctrine()
->getRepository('WallabagCoreBundle:Entry')
->findUnreadByUser(
$user->getId()
);
$perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit');
$entries->setMaxPerPage($perPage);
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
'type' => 'unread',
'entries' => $entries,
));
}
/**
* Shows read entries for current user.
*
* @Route("/{username}/{token}/archive.xml", name="archive_rss")
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showArchiveAction(User $user)
{
$entries = $this->getDoctrine()
->getRepository('WallabagCoreBundle:Entry')
->findArchiveByUser(
$user->getId()
);
$perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit');
$entries->setMaxPerPage($perPage);
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
'type' => 'archive',
'entries' => $entries,
));
}
/**
* Shows starred entries for current user.
*
* @Route("/{username}/{token}/starred.xml", name="starred_rss")
* @ParamConverter("user", class="WallabagCoreBundle:User", converter="username_rsstoken_converter")
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function showStarredAction(User $user)
{
$entries = $this->getDoctrine()
->getRepository('WallabagCoreBundle:Entry')
->findStarredByUser(
$user->getId()
);
$perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit');
$entries->setMaxPerPage($perPage);
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
'type' => 'starred',
'entries' => $entries,
));
}
}
|