take care of groups during navigating between items
This commit is contained in:
parent
65c7cde735
commit
1ca2444267
@ -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,
|
||||
)));
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
|
@ -11,7 +11,7 @@
|
||||
<span class="read-icon"></span>
|
||||
<?= Helper\favicon($favicons, $item['feed_id']) ?>
|
||||
<a
|
||||
href="?action=show&menu=<?= $menu ?>&id=<?= $item['id'] ?>"
|
||||
href="?action=show&menu=<?= $menu ?><?= isset($group_id) ? '&group_id='.$group_id : '' ?>&id=<?= $item['id'] ?>"
|
||||
class="show"
|
||||
><?= Helper\escape($item['title']) ?></a>
|
||||
</h2>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<nav class="top">
|
||||
<span class="nav-left">
|
||||
<?php if ($item_nav['previous']): ?>
|
||||
<a href="?action=show&menu=<?= $menu ?>&id=<?= $item_nav['previous']['id'] ?>" id="previous-item" title="<?= Helper\escape($item_nav['previous']['title']) ?>"><?= t('Previous') ?></a>
|
||||
<a href="?action=show&menu=<?= $menu ?><?= $group_id ? '&group_id='.$group_id : '' ?>&id=<?= $item_nav['previous']['id'] ?>" id="previous-item" title="<?= Helper\escape($item_nav['previous']['title']) ?>"><?= t('Previous') ?></a>
|
||||
<?php else: ?>
|
||||
<?= t('Previous') ?>
|
||||
<?php endif ?>
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
<span class="nav-right">
|
||||
<?php if ($item_nav['next']): ?>
|
||||
<a href="?action=show&menu=<?= $menu ?>&id=<?= $item_nav['next']['id'] ?>" id="next-item" title="<?= Helper\escape($item_nav['next']['title']) ?>"><?= t('Next') ?></a>
|
||||
<a href="?action=show&menu=<?= $menu ?><?= $group_id ? '&group_id='.$group_id : '' ?>&id=<?= $item_nav['next']['id'] ?>" id="next-item" title="<?= Helper\escape($item_nav['next']['title']) ?>"><?= t('Next') ?></a>
|
||||
<?php else: ?>
|
||||
<?= t('Next') ?>
|
||||
<?php endif ?>
|
||||
|
@ -37,6 +37,7 @@
|
||||
'display_mode' => $display_mode,
|
||||
'favicons' => $favicons,
|
||||
'original_marks_read' => $original_marks_read,
|
||||
'group_id' => $group_id,
|
||||
)) ?>
|
||||
<?php endforeach ?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user