summaryrefslogtreecommitdiffstats
path: root/templates/part.items.header.php
blob: c54a2ae656d8f63dd68a5efb41e9a9cce1f204ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php 

if(isset($_['feedid'])){
    $feedMapper = new OCA\News\FeedMapper();
    $feed = $feedMapper->findById($_['feedid']);
    $feedTitle = $feed->getTitle();
    
    $itemMapper = new OCA\News\ItemMapper();
    $unreadItemsCount = $itemMapper->countAllStatus($_['feedid'], OCA\News\StatusFlag::UNREAD);
    if($unreadItemsCount > 0){
        $readClass = '';
    } else {
        $readClass = 'all_read';
    }
} else {
    $feedTitle = '';
    $unreadItemsCount = 0;
}

// FIXME: get this setting from the database
$showOnlyUnread = true;

?>

<div class="feed_controls">
   <span title="<?php echo $l->t('Unread items'); ?>" class="unreaditemcounter <?php echo $readClass; ?>"><?php echo $unreadItemsCount; ?></span>
    <div class="feed_title">
        <h1 title="<?php echo $feedTitle; ?>"><?php echo $feedTitle; ?></h1>
    </div>
    <div class="controls">
        <input type="button" value="<?php echo $l->t('Mark all read'); ?>" id="mark_all_as_read" />
        <select id="feed_filter">
            <option value="unread" <?php if($showOnlyUnread){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show only unread articles'); ?></option>
            <option value="all" <?php if(!$showOnlyUnread){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show read/unread articles'); ?></option>
        </select>
    </div>
</div>