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');
|
$menu = Request\param('menu');
|
||||||
$item = Model\Item\get($id);
|
$item = Model\Item\get($id);
|
||||||
$feed = Model\Feed\get($item['feed_id']);
|
$feed = Model\Feed\get($item['feed_id']);
|
||||||
|
$group_id = Request\int_param('group_id', null);
|
||||||
|
|
||||||
Model\Item\set_read($id);
|
Model\Item\set_read($id);
|
||||||
$item['status'] = 'read';
|
$item['status'] = 'read';
|
||||||
|
|
||||||
switch ($menu) {
|
switch ($menu) {
|
||||||
case 'unread':
|
case 'unread':
|
||||||
$nav = Model\Item\get_nav($item);
|
$nav = Model\Item\get_nav($item, array('unread'), array(1, 0), null, $group_id);
|
||||||
break;
|
break;
|
||||||
case 'history':
|
case 'history':
|
||||||
$nav = Model\Item\get_nav($item, array('read'));
|
$nav = Model\Item\get_nav($item, array('read'));
|
||||||
@ -93,6 +94,7 @@ Router\get_action('show', function() {
|
|||||||
'item_nav' => isset($nav) ? $nav : null,
|
'item_nav' => isset($nav) ? $nav : null,
|
||||||
'menu' => $menu,
|
'menu' => $menu,
|
||||||
'title' => $item['title'],
|
'title' => $item['title'],
|
||||||
|
'group_id' => $group_id,
|
||||||
)));
|
)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ function get($id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get item naviguation (next/prev items)
|
// 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')
|
$query = Database::getInstance('db')
|
||||||
->table('items')
|
->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 ($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();
|
$items = $query->findAll();
|
||||||
|
|
||||||
$next_item = null;
|
$next_item = null;
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<span class="read-icon"></span>
|
<span class="read-icon"></span>
|
||||||
<?= Helper\favicon($favicons, $item['feed_id']) ?>
|
<?= Helper\favicon($favicons, $item['feed_id']) ?>
|
||||||
<a
|
<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"
|
class="show"
|
||||||
><?= Helper\escape($item['title']) ?></a>
|
><?= Helper\escape($item['title']) ?></a>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<nav class="top">
|
<nav class="top">
|
||||||
<span class="nav-left">
|
<span class="nav-left">
|
||||||
<?php if ($item_nav['previous']): ?>
|
<?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: ?>
|
<?php else: ?>
|
||||||
<?= t('Previous') ?>
|
<?= t('Previous') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<span class="nav-right">
|
<span class="nav-right">
|
||||||
<?php if ($item_nav['next']): ?>
|
<?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: ?>
|
<?php else: ?>
|
||||||
<?= t('Next') ?>
|
<?= t('Next') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
'display_mode' => $display_mode,
|
'display_mode' => $display_mode,
|
||||||
'favicons' => $favicons,
|
'favicons' => $favicons,
|
||||||
'original_marks_read' => $original_marks_read,
|
'original_marks_read' => $original_marks_read,
|
||||||
|
'group_id' => $group_id,
|
||||||
)) ?>
|
)) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user