blob: 683d535cd2729eef537382a81b07129d1da3aed5 (
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
function print_collection_list($list) {
foreach($list as $collection) {
if ($collection instanceOf OCA\News\Folder){
$tmpl_folder = new OCP\Template("news", "part.listfolder");
$tmpl_folder->assign('folder', $collection);
$tmpl_folder->printpage();
print_collection_list($collection->getChildren());
echo '</ul></li>';
}
elseif ($collection instanceOf OCA\News\Feed) { //onhover $(element).attr('id', 'newID');
$itemmapper = new OCA\News\ItemMapper();
$items = $itemmapper->findAll($collection->getId());
$counter = 0;
foreach($items as $item) {
if(!$item->isRead())
++$counter;
}
$tmpl_feed = new OCP\Template("news", "part.listfeed");
$tmpl_feed->assign('feed', $collection);
$tmpl_feed->assign('unreadItemsCount',$counter);
$tmpl_feed->printpage();
}
else {
//TODO:handle error in this case
}
}
}
$allfeeds = isset($_['allfeeds']) ? $_['allfeeds'] : '';
print_collection_list($allfeeds);
|