diff --git a/controllers/item.php b/controllers/item.php
index 5912bbe..b805148 100644
--- a/controllers/item.php
+++ b/controllers/item.php
@@ -58,13 +58,14 @@ Router\get_action('show', function() {
$menu = Request\param('menu');
$item = Model\Item\get($id);
$feed = Model\Feed\get($item['feed_id']);
+ $group_id = Request\int_param('group_id', null);
Model\Item\set_read($id);
$item['status'] = 'read';
switch ($menu) {
case 'unread':
- $nav = Model\Item\get_nav($item);
+ $nav = Model\Item\get_nav($item, array('unread'), array(1, 0), null, $group_id);
break;
case 'history':
$nav = Model\Item\get_nav($item, array('read'));
@@ -93,6 +94,7 @@ Router\get_action('show', function() {
'item_nav' => isset($nav) ? $nav : null,
'menu' => $menu,
'title' => $item['title'],
+ 'group_id' => $group_id,
)));
});
diff --git a/models/item.php b/models/item.php
index 5eabdb5..1baabc7 100644
--- a/models/item.php
+++ b/models/item.php
@@ -218,7 +218,7 @@ function get($id)
}
// Get item naviguation (next/prev items)
-function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $feed_id = null)
+function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $feed_id = null, $group_id = null)
{
$query = Database::getInstance('db')
->table('items')
@@ -228,6 +228,8 @@ function get_nav($item, $status = array('unread'), $bookmark = array(1, 0), $fee
if ($feed_id) $query->eq('feed_id', $feed_id);
+ if ($group_id) $query->in('feed_id', Group\get_feeds_by_group($group_id));
+
$items = $query->findAll();
$next_item = null;
diff --git a/templates/item.php b/templates/item.php
index c079e49..b68e878 100644
--- a/templates/item.php
+++ b/templates/item.php
@@ -11,7 +11,7 @@
= Helper\favicon($favicons, $item['feed_id']) ?>
= Helper\escape($item['title']) ?>
diff --git a/templates/show_item.php b/templates/show_item.php
index 23869d5..02afbff 100644
--- a/templates/show_item.php
+++ b/templates/show_item.php
@@ -13,7 +13,7 @@