summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorGregor Tätzner <gregor@freenet.de>2012-07-16 21:06:02 +0200
committerGregor Tätzner <gregor@freenet.de>2012-07-16 21:06:02 +0200
commitb87705aa94467e37bafe212ab09c0cd972fe4f60 (patch)
tree8bbe0e0b4f5172c9850f170fae57a36309b68be1 /templates
parentc53efe6fa7e08863c010a51b85854b3194a764fe (diff)
Added count of unread items to feeds list.
Diffstat (limited to 'templates')
-rw-r--r--templates/part.feeds.php3
-rw-r--r--templates/part.itemcounter.php15
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