diff options
-rw-r--r-- | templates/part.feeds.php | 3 | ||||
-rw-r--r-- | templates/part.itemcounter.php | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/templates/part.feeds.php b/templates/part.feeds.php index f904822a3..5874f1bc1 100644 --- a/templates/part.feeds.php +++ b/templates/part.feeds.php @@ -14,8 +14,8 @@ print_folder($child, $depth+1); } elseif ($child instanceOf OC_News_Feed) { //onhover $(element).attr('id', 'newID'); - echo '<li class="feeds_list" data-id="' . $child->getId() . '"><a href="' . OCP\Util::linkTo('news', 'index.php'). '?feedid=' . $child->getId() . '">' . $child->getTitle() .'</a>'; + countUnreadItems($child->getId()); echo '<button class="svg action" id="feeds_delete" onClick="(News.Feed.delete(' . $child->getId(). '))" title="' . $l->t('Delete feed') . '"></button>'; echo '<button class="svg action" id="feeds_edit" title="' . $l->t('Edit feed') . '"></button>'; echo '</li>'; @@ -27,5 +27,6 @@ echo '</ul></li></ul>'; } + $this->inc("part.itemcounter"); print_folder($_['allfeeds'], 0); ?>
\ No newline at end of file diff --git a/templates/part.itemcounter.php b/templates/part.itemcounter.php new file mode 100644 index 000000000..aea9a3b37 --- /dev/null +++ b/templates/part.itemcounter.php @@ -0,0 +1,15 @@ +<?php + +function countUnreadItems($feedid) { + $itemmapper = new OC_News_ItemMapper(); + + $items = $itemmapper->findAll($feedid); + $counter = 0; + foreach($items as $item) { + if(!$item->isRead()) + ++$counter; + } + echo '<span id="unreaditemcounter">' . $counter . '</span>'; +} + +?>
\ No newline at end of file |