summaryrefslogtreecommitdiffstats
path: root/templates/part.items.header.php
blob: 8a2043288cfc838a768c5c780c1da15e40f77054 (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
<?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;
}

$showAll = OCP\Config::getUserValue(OCP\USER::getUser(), 'news', 'showAll'); 

?>

<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(!$showAll){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show only unread articles'); ?></option>
            <option value="all" <?php if($showAll){ echo 'selected="selected"'; }; ?>><?php echo $l->t('Show read/unread articles'); ?></option>
        </select>
    </div>
</div>