2015-03-28 13:27:45 +00:00
|
|
|
<?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
|
|
|
|
{
|
|
|
|
/**
|
2015-05-30 11:52:26 +00:00
|
|
|
* Shows unread entries for current user.
|
2015-03-28 13:27:45 +00:00
|
|
|
*
|
|
|
|
* @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(),
|
|
|
|
0,
|
2015-03-28 20:43:49 +00:00
|
|
|
$user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
|
2015-03-28 13:27:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
|
|
|
'type' => 'unread',
|
|
|
|
'entries' => $entries,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-05-30 11:52:26 +00:00
|
|
|
* Shows read entries for current user.
|
2015-03-28 13:27:45 +00:00
|
|
|
*
|
|
|
|
* @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(),
|
|
|
|
0,
|
2015-03-28 20:43:49 +00:00
|
|
|
$user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
|
2015-03-28 13:27:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
|
|
|
'type' => 'archive',
|
|
|
|
'entries' => $entries,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-05-30 11:52:26 +00:00
|
|
|
* Shows starred entries for current user.
|
2015-03-28 13:27:45 +00:00
|
|
|
*
|
|
|
|
* @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(),
|
|
|
|
0,
|
2015-03-28 20:43:49 +00:00
|
|
|
$user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit')
|
2015-03-28 13:27:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array(
|
|
|
|
'type' => 'starred',
|
|
|
|
'entries' => $entries,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|