diff --git a/app/config/config.yml b/app/config/config.yml index ca7fb467d..c6bed7970 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -29,6 +29,21 @@ framework: twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" + globals: + share_twitter: %share_twitter% + share_mail: %share_mail% + share_shaarli: %share_shaarli% + shaarli_url: %shaarli_url% + share_diaspora: %share_diaspora% + diaspora_url: %diaspora_url% + flattr: %flattr% + flattrable: 1 + flattred: 2 + carrot: %carrot% + show_printlink: %show_printlink% + export_epub: %export_epub% + export_mobi: %export_mobi% + export_pdf: %export_pdf% # Assetic Configuration assetic: diff --git a/src/WallabagBundle/Controller/EntryController.php b/src/WallabagBundle/Controller/EntryController.php index 0c0c15690..233a6c32b 100644 --- a/src/WallabagBundle/Controller/EntryController.php +++ b/src/WallabagBundle/Controller/EntryController.php @@ -11,7 +11,7 @@ class EntryController extends Controller /** * @Route("/unread", name="unread") */ - public function unreadAction() + public function showUnreadAction() { $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries'); $entries = $repository->findUnreadByUser(1); @@ -22,4 +22,49 @@ class EntryController extends Controller ); } + + /** + * @Route("/archive", name="archive") + */ + public function showArchiveAction() + { + $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries'); + $entries = $repository->findArchiveByUser(1); + + return $this->render( + 'WallabagBundle:Entry:entries.html.twig', + array('entries' => $entries) + ); + + } + + /** + * @Route("/starred", name="starred") + */ + public function showStarredAction() + { + $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries'); + $entries = $repository->findStarredByUser(1); + + return $this->render( + 'WallabagBundle:Entry:entries.html.twig', + array('entries' => $entries) + ); + + } + + /** + * @Route("/view/{id}", requirements={"id" = "\d+"}, name="view") + */ + public function viewAction($id) + { + $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries'); + $entry = $repository->find($id); + + return $this->render( + 'WallabagBundle:Entry:entry.html.twig', + array('entry' => $entry) + ); + + } } diff --git a/src/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php index 4c13c9c2f..c355a012c 100644 --- a/src/WallabagBundle/Repository/EntriesRepository.php +++ b/src/WallabagBundle/Repository/EntriesRepository.php @@ -13,14 +13,6 @@ use Doctrine\ORM\EntityRepository; */ class EntriesRepository extends EntityRepository { - /* public function findUnreadByUser($userId) - { - return $this->createQueryBuilder('e') - ->where('e.is_read = 0') - ->andWhere('e.user_id = :userId') - ->setParameter('userId', $userId) - ->getQuery(); - }*/ public function findUnreadByUser($userId) { $qb = $this->createQueryBuilder('e') @@ -32,4 +24,28 @@ class EntriesRepository extends EntityRepository return $qb; } + + public function findArchiveByUser($userId) + { + $qb = $this->createQueryBuilder('e') + ->select('e') + ->where('e.isRead = 1') + ->andWhere('e.userId =:userId')->setParameter('userId', $userId) + ->getQuery() + ->getResult(Query::HYDRATE_ARRAY); + + return $qb; + } + + public function findStarredByUser($userId) + { + $qb = $this->createQueryBuilder('e') + ->select('e') + ->where('e.isFav = 1') + ->andWhere('e.userId =:userId')->setParameter('userId', $userId) + ->getQuery() + ->getResult(Query::HYDRATE_ARRAY); + + return $qb; + } } diff --git a/src/WallabagBundle/Resources/views/Entry/entries.html.twig b/src/WallabagBundle/Resources/views/Entry/entries.html.twig index f4d7a7ab8..811772980 100644 --- a/src/WallabagBundle/Resources/views/Entry/entries.html.twig +++ b/src/WallabagBundle/Resources/views/Entry/entries.html.twig @@ -2,25 +2,32 @@ {% block title "Unread" %} -{% block content_header '' %} +{% block menu %} + {% include "WallabagBundle::_menu.html.twig" %} +{% endblock %} {% block content %} - {% for entry in entries %} -
{{ entry.content|striptags|slice(0, 300) }}...
-{{ entry.content|striptags|slice(0, 300) }}...
+