diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-16 20:54:33 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2012-08-16 20:54:33 +0200 |
commit | 45828812cba18a61a9882cf84508cf55b1ba7b1a (patch) | |
tree | 646a669dd44b6d5a560282bf7ef2117d3304c471 /templates/part.items.header.php | |
parent | f61df85fe634c7f5662965bb46124af2ecd50419 (diff) |
remember last viewed feed
Diffstat (limited to 'templates/part.items.header.php')
-rw-r--r-- | templates/part.items.header.php | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/templates/part.items.header.php b/templates/part.items.header.php index 8a2043288..0a49b9e91 100644 --- a/templates/part.items.header.php +++ b/templates/part.items.header.php @@ -1,20 +1,35 @@ <?php if(isset($_['feedid'])){ - $feedMapper = new OCA\News\FeedMapper(); - $feed = $feedMapper->findById($_['feedid']); - $feedTitle = $feed->getTitle(); - + $feedId = $_['feedid']; $itemMapper = new OCA\News\ItemMapper(); - $unreadItemsCount = $itemMapper->countAllStatus($_['feedid'], OCA\News\StatusFlag::UNREAD); - if($unreadItemsCount > 0){ + switch ($feedId) { + case -1: + $feedTitle = $l->t('Starred'); + $unreadItemCount = $itemMapper->countAllStatus($feedId, OCA\News\StatusFlag::IMPORTANT); + break; + + case -2: + $feedTitle = $l->t('New articles'); + $unreadItemCount = $itemMapper->countEveryItemByStatus(OCA\News\StatusFlag::UNREAD); + break; + + default: + $feedMapper = new OCA\News\FeedMapper(); + $feed = $feedMapper->findById($feedId); + $feedTitle = $feed->getTitle(); + $unreadItemCount = $itemMapper->countAllStatus($feedId, OCA\News\StatusFlag::UNREAD); + break; + } + + if($unreadItemCount > 0){ $readClass = ''; } else { $readClass = 'all_read'; } } else { $feedTitle = ''; - $unreadItemsCount = 0; + $unreadItemCount = 0; } $showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); @@ -22,7 +37,7 @@ $showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); ?> <div class="feed_controls"> - <span title="<?php echo $l->t('Unread items'); ?>" class="unreaditemcounter <?php echo $readClass; ?>"><?php echo $unreadItemsCount; ?></span> + <span title="<?php echo $l->t('Unread items'); ?>" class="unreaditemcounter <?php echo $readClass; ?>"><?php echo $unreadItemCount; ?></span> <div class="feed_title"> <h1 title="<?php echo $feedTitle; ?>"><?php echo $feedTitle; ?></h1> </div> |